LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyObject

java.lang.Object
  extended by leon.data.LyObject

public class LyObject
extends java.lang.Object

This class implements a logical object.

A logical object belongs to a class info, has an object identifier (LyObjectId) that is unique within an application and may have a name.

Logical objects are mapped on physical objects (peer), that contain real values corresponding to non local fields. Local values are managed on logical objects and are not persistent.

Logical objects can be created, modified and deleted. These Operations are managed by objects source (LyObjectSource).

They can be given in objects list or workspaces (dynamic objects lists that may send events on objects).

This class may be inherited to offer non abstract interfaces to access or modify fields. Each class info can have its own subclass.

See Also:
LyClassInfo, LyObjectId, LyApplication, LyObjectList, LyObjectSource

Field Summary
static java.lang.String __VERSION
          File version
static int _nbObjects
          Number of objects for debug.
static boolean CHECK_OPTIONAL_ON_OBJECTS
           
static short CONTROL_APP_CLASS_CONTROLS
           
static short CONTROL_APP_FIELD_CONTROLS
           
static short CONTROL_APP_ID
           
static short CONTROL_CLASS_CONTROLS
           
static short CONTROL_DISABLED_ON_LOADING
           
static short CONTROL_FIELD_CONTROLS
           
static short CONTROL_FULL
           
static short CONTROL_ID
           
static short CONTROL_LOADING
           
static short CONTROL_MANDATORY
           
static short CONTROL_NONE
          Controls that may be applied on objects.
static short CONTROL_RULES
           
static short CONTROL_UNICITY
           
static short CONTROL_VALUE
           
static short DEFAULT_CONTROL
           
static short LEVEL_ERROR
           
static short LEVEL_OK
          Error levels.
static short LEVEL_WARNING
           
static short OPER_LOCAL
           
static short OPER_NEED_CONTEXT
           
static short OPER_NEED_REFRESH
           
static short OPER_NEED_SET
           
static short OPER_NONE
          Flags for operations.
 
Constructor Summary
LyObject()
          Default Constructor.
LyObject(LyClassInfo classInfo)
          Constructs a logical object for a given class info.
LyObject(LyClassInfo classInfo, LyValueSet values)
          Constructs a logical object for a given class info with the specified list of values.
 
Method Summary
 void addError(LyError error)
          To add an error to this object.
 short callClassControls(LyValueSet values)
          Internal method to call controls associated to class info of this object.
 short callFieldControls(LyFieldInfo fieldInfo, java.lang.Object value)
          Method to call controls corresponding to the given fieldInfo.
 short checkAppId(LyValueSet values)
          Checks application id.
 short checkId(LyValueSet values)
          Checks id.
 boolean checkInstance()
          Checks if this instance is found on its object source cache.
 boolean checkObject()
          Checks if this object is found on its object source cache.
 int compare(LyObject object, boolean byName)
          Compares this object with another object using default comparison.
 int compare(LyObject object, LySort sort, boolean byName)
          Compares this object with another object using the given sort.
 short control()
          Method for controlling this object before its creation or set.
 short control(LyValueSet oldValues)
          Method changes made on this object following an external notification.
 short control(LyValueSet oldValues, boolean loading)
          Method changes made on this object following an external notification.
 LyResponse create()
          Creates an object : to commit its creation on the underlying data provider.
 LyResponse create(boolean local)
          Creates an object : to commit its creation on the underlying data provider.
 LyResponse delete()
          Deletes an object : to commit its deletion on the underlying data provider.
 LyResponse delete(boolean local)
          Deletes an object : to commit its deletion on the underlying data provider.
 void freeDaemonValues()
          Free local values computed by daemon.
 LyApplication getApplication()
          Retrieves application of the class info of this object.
 LyObjectList getArrayObjects()
          Get list of array objects For internal use only.
 LyBooleanValue getBooleanValue(LyChoiceFieldInfo fieldInfo)
          Get choice value from this object corresponding to the given choice field.
 LyBooleanValue getBooleanValue(java.lang.String fieldId)
          Get choice value from this object corresponding to the given choice field.
 LyChoiceValue getChoiceValue(LyChoiceFieldInfo fieldInfo)
          Get choice value from this object corresponding to the given choice field.
 LyChoiceValue getChoiceValue(java.lang.String fieldId)
          Get choice value from this object corresponding to the given choice field.
 LyClassInfo getClassInfo()
          Retrieves the class info of this object.
 LyDateValue getDateValue(LyDateFieldInfo fieldInfo)
          Get date value from this object corresponding to the given date field.
 LyDateValue getDateValue(java.lang.String fieldId)
          Get date value from this object corresponding to the given date field.
 java.lang.String getDisplayId()
          Get the id of this object in a displayable form.
 LyEnvironment getEnvironment()
          Retrieves environment of the class info of this object.
 LyError getError(int idx)
          To get the error at the specified index.
 LyError getError(java.lang.String errorId)
          To get the error with the specified id.
 short getErrorLevel()
          To get the error level of this object.
 short getErrorLevel(LyFieldInfo fieldInfo)
          Get error level on this object for the given fieldInfo.
 int getErrorsCount()
          To get the number of errors associated to this object.
 LyValue getFieldValue(LyFieldInfo fieldInfo)
          Gets the field value from this object for the given field info.
 LyValue getFieldValue(java.lang.String fieldId)
          Gets the field value from this object for the given field info.
 LyFileValue getFileValue(LyFileFieldInfo fieldInfo)
          Get file value from this object corresponding to the given file field.
 LyFileValue getFileValue(java.lang.String fieldId)
          Get file value from this object corresponding to the given file field.
 java.lang.Object getFromMemory(LyFieldInfo fieldInfo)
          Access a value of an object, but do not compute value.
 java.lang.String getId()
          Get object id as a string.
 LyObjectList getJoinObjects()
          Get list of join-objects (objects pointed by this object on join relations).
 java.lang.String getLabel(LyFieldInfo fieldInfo, java.lang.Object fieldValue)
          Gets label for given field and value.
 LyError getLastError(short level)
          To get the last error on this object with the specified level.
 LyObjectList getList(LyDataSession session, LyClassInfo targetClass)
          Gets in the given session a list of objects of the specified target class related to this object.
 LyObjectList getList(LyDataSession session, LyClassInfo targetClass, boolean dynamic)
          Gets in the given session a list of objects of the specified target class related to this object.
 LyObjectList getList(LyDataSession session, LyClassInfo targetClass, boolean dynamic, boolean sorted)
          Gets in the given session a list of objects of the specified target class related to this object.
 LyObjectList getList(LyDataSession session, LyClassInfo targetClass, boolean dynamic, boolean sorted, boolean local)
          Gets in the given session a list of objects of the specified target class related to this object.
 java.lang.Object getLocalValue(LyFieldInfo fieldInfo)
          Internal method to get a local value.
 java.lang.Object getLocalValue(LyFieldInfo fieldInfo, boolean compute)
          Internal method to get a local value.
 LyValueSet getLocalValues()
          Fetchs the complete set of local values for this object.
 java.lang.String getName()
          Get name of this object.
 LyValueSet getNewValues()
          Fetchs the complete set of new values for this object.
 LyNumberValue getNumberValue(LyNumberFieldInfo fieldInfo)
          Get number value from this object corresponding to the given number field.
 LyNumberValue getNumberValue(java.lang.String fieldId)
          Get number value from this object corresponding to the given number field.
 LyObjectId getObjectId()
          Returns the identifier of this object (LyObjectId).
 LyObjectId getObjectId(LyValueSet values)
          Returns the identifier of this object (LyObjectId).
 LyObjectSource getObjectSource()
          Shortcut to get object source for this object.
 java.lang.Object getOldValue(LyFieldInfo fieldInfo)
          Gets old value (excluding new value) on this object for given field info.
 LyValueSet getOldValues()
          Fetchs the complete set of old values for this object (values for which a new value exists).
 LyObject getParent()
          Deprecated. use getParents
 LyObjectList getParents()
          Get parents object of this object.
 java.lang.Object getPeer()
          Retrieves the associated peer (physical object that really stores values for non local fields).
 LyValueSet getPendingValues()
          Fetchs the complete set of pending values for this object.
 LyRelationValue getRelationValue(LyRelationFieldInfo fieldInfo)
          Get relation value from this object corresponding to the given relation field.
 LyRelationValue getRelationValue(java.lang.String fieldId)
          Get relation value from this object corresponding to the given relation field.
 java.lang.String getShortLabel(LyFieldInfo fieldInfo, java.lang.Object fieldValue)
          Gets short label for given field and value.
 LyObjectList getSubObjects(boolean local)
          Get list of sub-objects (objects pointed by this object on composition relations).
 LyTextValue getTextValue(LyTextFieldInfo fieldInfo)
          Get text value from this object corresponding to the given text field.
 LyTextValue getTextValue(java.lang.String fieldId)
          Get text value from this object corresponding to the given text field.
 java.lang.Object getValue(LyFieldInfo fieldInfo)
          Fetchs the value from this object corresponding to the given field info.
 java.lang.Object getValue(java.lang.String fieldId)
          Fetchs the value from this object corresponding to the given fieldId.
 LyValueSet getValues()
          Fetchs the complete set of values for this object.
 LyValueSet getValues(boolean fromMemory)
          Fetchs the complete set of values for this object.
 LyValueSet getValues(LyInfoList<LyFieldInfo> fieldInfos)
          Fetchs the set of values for the given field infos on this object.
 boolean hasNewValue(LyFieldInfo fieldInfo)
          Checks if this object has a new value registered for the given field info.
 boolean hasNewValues()
          Checks if this object has some new values.
 boolean hasPendingValue(LyFieldInfo fieldInfo)
          Checks if this object has a pending value registered for the given field info.
 boolean hasPendingValues()
          Checks if this object has some pending values.
 boolean instanceOf(LyClassInfo classInfo)
          Checks if this object is an instance of the given class info.
 boolean isDeleted()
          Indicated if this object has been deleted or not.
 boolean isFullyLoaded()
          Accessor to the the loaded state.
 boolean isHidden()
          Accessor to the the visibility state.
 boolean isSelected()
          Accessor to the the selection state.
 boolean isTemporary()
          Check if this is a temporary object (never created in the system, just an holder for values).
 void modified(LyValueSet values)
          Method called when a modification notification has been received.
 void refresh()
          Refresh new values.
 void refresh(LyInfoList<LyFieldInfo> fieldInfos)
          Refresh a list of fields on this object.
 void refresh(LyValueSet values)
          Send an update event for this object.
 void refreshErrorLevel()
          Deprecated. This method must'nt be used directly and will be not public in future releases.
 void reload(LyInfoList<LyFieldInfo> fieldInfos)
          Method to force the reload of the object.
 LyError removeError(int idx)
          Remove the error at the specified index.
 LyError removeError(LyError error)
          Remove the specified error.
 java.lang.Object removeLocalValue(LyFieldInfo fieldInfo)
          Remove local value for given field info.
 void removeNewValue(LyFieldInfo fieldInfo)
          Remove the fieldInfo value from the new values list.
 void removeNewValues(LyInfoList<LyFieldInfo> fieldInfos)
          Remove the list of fieldInfo value from the new values list.
 void removePendingValue(LyFieldInfo fieldInfo)
          Remove the fieldInfo value from the pending values list.
 void removePendingValues(LyInfoList<LyFieldInfo> fieldInfos)
          Remove the list of fieldInfo value from the pending values list.
 void resetClassErrors()
          Reset all errors caused by class controls.
 void resetFieldInfoErrors(LyFieldInfo fieldInfo)
          Reset all errors caused by the specified fieldInfo.
 void resetObjectId()
          Reset storing cache of the id.
 LyResponse set()
          Sets an object : to commit its modification on the underlying data provider.
 LyResponse set(boolean local)
          Sets an object : to commit its modification on the underlying data provider.
 void setClassInfo(LyClassInfo classInfo)
          Sets class info for this object.
 void setContextType(LyContext.Type type)
          Context type during modification state of this object : this information may be used by the LyContext to indicate the kind of modification (User or by code) for read only attributes The default value -1 means 'undefined' or not within a context.
 void setFieldValue(LyValue value)
          Sets a field value on this object.
 void setHidden(boolean hidden)
          Modifier of the visibility state.
 void setLocalValue(LyFieldInfo fieldInfo, java.lang.Object value)
          Internal method to set a local value.
 void setPeer(java.lang.Object peer)
          Sets the peer (physical layer) of this object.
 void setSelected(boolean selected)
          Modifier of the selection state.
 void setTemporary(boolean temporary)
          Set this object as a temporary object (never created in the system, just an holder for values).
 void setValue(LyFieldInfo fieldInfo, java.lang.Object value)
          Sets a value for this object on the given fieldInfo.
 void setValue(java.lang.String fieldId, java.lang.Object value)
          Sets a value for this object on the fieldInfo corresponding to the given id.
 void setValues(LyValueSet values)
          Set values on this object with the given values set.
 void skipEncoding(boolean encoding)
          Skip encoding of value untill next set() or create() call, or untill this parameter is changed.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values

LEVEL_OK

public static final short LEVEL_OK
Error levels. Erros levels greater than LEVEL_WARNING are user specific levels.

See Also:
Constant Field Values

LEVEL_ERROR

public static final short LEVEL_ERROR
See Also:
Constant Field Values

LEVEL_WARNING

public static final short LEVEL_WARNING
See Also:
Constant Field Values

CONTROL_NONE

public static final short CONTROL_NONE
Controls that may be applied on objects.

See Also:
Constant Field Values

CONTROL_ID

public static final short CONTROL_ID
See Also:
Constant Field Values

CONTROL_APP_ID

public static final short CONTROL_APP_ID
See Also:
Constant Field Values

CONTROL_MANDATORY

public static final short CONTROL_MANDATORY
See Also:
Constant Field Values

CONTROL_UNICITY

public static final short CONTROL_UNICITY
See Also:
Constant Field Values

CONTROL_VALUE

public static final short CONTROL_VALUE
See Also:
Constant Field Values

CONTROL_RULES

public static final short CONTROL_RULES
See Also:
Constant Field Values

CONTROL_APP_FIELD_CONTROLS

public static final short CONTROL_APP_FIELD_CONTROLS
See Also:
Constant Field Values

CONTROL_APP_CLASS_CONTROLS

public static final short CONTROL_APP_CLASS_CONTROLS
See Also:
Constant Field Values

CONTROL_LOADING

public static final short CONTROL_LOADING
See Also:
Constant Field Values

CONTROL_CLASS_CONTROLS

public static final short CONTROL_CLASS_CONTROLS
See Also:
Constant Field Values

CONTROL_FIELD_CONTROLS

public static final short CONTROL_FIELD_CONTROLS
See Also:
Constant Field Values

CONTROL_FULL

public static final short CONTROL_FULL
See Also:
Constant Field Values

CONTROL_DISABLED_ON_LOADING

public static final short CONTROL_DISABLED_ON_LOADING
See Also:
Constant Field Values

DEFAULT_CONTROL

public static short DEFAULT_CONTROL

OPER_NONE

public static final short OPER_NONE
Flags for operations.

See Also:
Constant Field Values

OPER_LOCAL

public static final short OPER_LOCAL
See Also:
Constant Field Values

OPER_NEED_REFRESH

public static final short OPER_NEED_REFRESH
See Also:
Constant Field Values

OPER_NEED_CONTEXT

public static final short OPER_NEED_CONTEXT
See Also:
Constant Field Values

OPER_NEED_SET

public static final short OPER_NEED_SET
See Also:
Constant Field Values

CHECK_OPTIONAL_ON_OBJECTS

public static boolean CHECK_OPTIONAL_ON_OBJECTS

_nbObjects

public static int _nbObjects
Number of objects for debug.

Constructor Detail

LyObject

public LyObject()
Default Constructor. Note that in this case the class info is not set at first, before using this object this class info must be set using setClassInfo method.


LyObject

public LyObject(LyClassInfo classInfo)
Constructs a logical object for a given class info.

Parameters:
classInfo - Class info of this object.

LyObject

public LyObject(LyClassInfo classInfo,
                LyValueSet values)
Constructs a logical object for a given class info with the specified list of values.

Parameters:
classInfo - Class info of this object.
values - List of values for this object.
Method Detail

setClassInfo

public void setClassInfo(LyClassInfo classInfo)
Sets class info for this object. This method can only be used for an object constructed with default constructor (the one with no parameters).

Parameters:
classInfo - Class info of this object.
Throws:
java.lang.IllegalStateException - If the class info of this object was already set.

freeDaemonValues

public void freeDaemonValues()
Free local values computed by daemon.


getClassInfo

public final LyClassInfo getClassInfo()
Retrieves the class info of this object.

Returns:
Class info of this object.

instanceOf

public final boolean instanceOf(LyClassInfo classInfo)
Checks if this object is an instance of the given class info.

Parameters:
classInfo - Class info to check.
Returns:
True if this object is an instance of the given class info, false otherwise.

getApplication

public final LyApplication getApplication()
Retrieves application of the class info of this object.

Returns:
Application of the class info of this object.

getEnvironment

public final LyEnvironment getEnvironment()
Retrieves environment of the class info of this object.

Returns:
Environment of the class info of this object.

getObjectSource

public final LyObjectSource getObjectSource()
Shortcut to get object source for this object. The object source is retrieved from the class info of this object.

Returns:
Object source corresponding to the class info of this object.
See Also:
LyClassInfo.getObjectSource()

getObjectId

public LyObjectId getObjectId()
Returns the identifier of this object (LyObjectId).

Returns:
Identifier of the object.

getObjectId

public LyObjectId getObjectId(LyValueSet values)
Returns the identifier of this object (LyObjectId).

Returns:
Identifier of the object.

getId

public final java.lang.String getId()
Get object id as a string. This is an internal unique representation of the identifier \ To get the value of the idField, use getValue() or getObjectId().toString() instead.

Returns:
Object identifier returned as a string.
See Also:
LyObjectId.getFullString()

getDisplayId

public java.lang.String getDisplayId()
Get the id of this object in a displayable form.

Returns:
A string representation of the id of this object computed with the LyInfoLabel of type ID if any, else returns the result of the getId() method.

getName

public java.lang.String getName()
Get name of this object.

Returns:
Values on this object for all fields that have MARK_NAME concatenated in a string and separated by the name separator (NAME_SEP) of the application.

getValue

public java.lang.Object getValue(LyFieldInfo fieldInfo)
Fetchs the value from this object corresponding to the given field info.

Parameters:
fieldInfo - Field info for which a value is requested. The fieldInfo must exist in the associated class info.
Returns:
Value of the given field info for this object. The class of the returned value depends on the type of the fieldInfo (Integer, Date, String ...).
See Also:
LyFieldInfo.getValueClass()

getValue

public final java.lang.Object getValue(java.lang.String fieldId)
Fetchs the value from this object corresponding to the given fieldId.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Value of the field info for this object. The class of the returned value depends on the type of the fieldInfo (Integer, Date, String ...).
Throws:
java.lang.IllegalArgumentException - If the field id doesn't correspond to a field info in the class info of this object.

getFieldValue

public LyValue getFieldValue(java.lang.String fieldId)
Gets the field value from this object for the given field info.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Field value of the given field info for this object. The class of the returned value depends on the type of the fieldInfo (Integer, Date, String ...).

getFieldValue

public LyValue getFieldValue(LyFieldInfo fieldInfo)
Gets the field value from this object for the given field info.

Returns:
Field value of the given field info for this object. The class of the returned value depends on the type of the fieldInfo (Integer, Date, String ...).

getChoiceValue

public final LyChoiceValue getChoiceValue(java.lang.String fieldId)
Get choice value from this object corresponding to the given choice field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Choice value corresponding to the given choice field for this object.

getChoiceValue

public final LyChoiceValue getChoiceValue(LyChoiceFieldInfo fieldInfo)
Get choice value from this object corresponding to the given choice field.

Parameters:
fieldInfo - Choice field info for which a value is requested.
Returns:
Choice value corresponding to the given choice field for this object.

getBooleanValue

public final LyBooleanValue getBooleanValue(java.lang.String fieldId)
Get choice value from this object corresponding to the given choice field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Choice value corresponding to the given choice field for this object.

getBooleanValue

public final LyBooleanValue getBooleanValue(LyChoiceFieldInfo fieldInfo)
Get choice value from this object corresponding to the given choice field.

Parameters:
fieldInfo - Choice field info for which a value is requested.
Returns:
Choice value corresponding to the given choice field for this object.

getDateValue

public final LyDateValue getDateValue(java.lang.String fieldId)
Get date value from this object corresponding to the given date field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Date value corresponding to the given date field for this object.

getDateValue

public final LyDateValue getDateValue(LyDateFieldInfo fieldInfo)
Get date value from this object corresponding to the given date field.

Parameters:
fieldInfo - Date field info for which a value is requested.
Returns:
Date value corresponding to the given date field for this object.

getFileValue

public final LyFileValue getFileValue(java.lang.String fieldId)
Get file value from this object corresponding to the given file field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
File value corresponding to the given file field for this object.

getFileValue

public final LyFileValue getFileValue(LyFileFieldInfo fieldInfo)
Get file value from this object corresponding to the given file field.

Parameters:
fieldInfo - File field info for which a value is requested.
Returns:
File value corresponding to the given file field for this object.

getNumberValue

public final LyNumberValue getNumberValue(java.lang.String fieldId)
Get number value from this object corresponding to the given number field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Number value corresponding to the given number field for this object.

getNumberValue

public final LyNumberValue getNumberValue(LyNumberFieldInfo fieldInfo)
Get number value from this object corresponding to the given number field.

Parameters:
fieldInfo - Number field info for which a value is requested.
Returns:
Number value corresponding to the given number field for this object.

getRelationValue

public final LyRelationValue getRelationValue(java.lang.String fieldId)
Get relation value from this object corresponding to the given relation field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Relation value corresponding to the given relation field for this object.

getRelationValue

public final LyRelationValue getRelationValue(LyRelationFieldInfo fieldInfo)
Get relation value from this object corresponding to the given relation field.

Parameters:
fieldInfo - Relation field info for which a value is requested.
Returns:
Relation value corresponding to the given relation field for this object.

getTextValue

public final LyTextValue getTextValue(java.lang.String fieldId)
Get text value from this object corresponding to the given text field.

Parameters:
fieldId - Id of the associated fieldInfo. Must be a valid fieldInfo for the class info of this object.
Returns:
Text value corresponding to the given text field for this object.

getTextValue

public final LyTextValue getTextValue(LyTextFieldInfo fieldInfo)
Get text value from this object corresponding to the given text field.

Parameters:
fieldInfo - Text field info for which a value is requested.
Returns:
Text value corresponding to the given text field for this object.

getFromMemory

public final java.lang.Object getFromMemory(LyFieldInfo fieldInfo)
Access a value of an object, but do not compute value. This only seeks into memory and is reserved for internal use only application should use get() method instead.

Parameters:
fieldInfo - Field info on which a value is requested.
IllegalArgumentException - If the given field info is not contained in the class info of this object.
IllegalStateException - If the binding of the given field info is not supported.
Returns:
Value for the given field info on this object. The value is an instance of the class returned by getValueClass method of the given field info.
See Also:
LyFieldInfo.getValueClass(), get(LyFieldInfo)

getLocalValue

public final java.lang.Object getLocalValue(LyFieldInfo fieldInfo)
Internal method to get a local value. This method compute the value if it is not in _localValues list.

Parameters:
fieldInfo - The local fieldInfo
Returns:
The local value for the given field info.

getLocalValue

public java.lang.Object getLocalValue(LyFieldInfo fieldInfo,
                                      boolean compute)
Internal method to get a local value. This method compute the value if it is not in _localValues list.

Parameters:
fieldInfo - The local fieldInfo
compute - Allow computing of computed values.
Returns:
The local value for the given field info.

setLocalValue

public void setLocalValue(LyFieldInfo fieldInfo,
                          java.lang.Object value)
Internal method to set a local value. Should *not be used* by the application (internal use only)

Parameters:
fieldInfo - The local fieldInfo
value - The local value for the given field info.

removeLocalValue

public java.lang.Object removeLocalValue(LyFieldInfo fieldInfo)
Remove local value for given field info.

Parameters:
fieldInfo - Local field info for which value is removed.
Returns:
Old value, null if not found or if neither field nor class are local.

getValues

public LyValueSet getValues(boolean fromMemory)
Fetchs the complete set of values for this object.

Returns:
Values set containing values for all fieldInfos of the class info to which this object belongs.

getValues

public LyValueSet getValues()
Fetchs the complete set of values for this object.

Returns:
Values set containing values for all fieldInfos of the class info to which this object belongs.

getValues

public LyValueSet getValues(LyInfoList<LyFieldInfo> fieldInfos)
Fetchs the set of values for the given field infos on this object.

Parameters:
fieldInfos - Field infos on which values are requested.
Returns:
Values set containing values for all given fields of the class info to which this object belongs.

getLocalValues

public LyValueSet getLocalValues()
Fetchs the complete set of local values for this object.

Returns:
Values set containing all local values for this object.

getNewValues

public LyValueSet getNewValues()
Fetchs the complete set of new values for this object.

Returns:
Values set containing all new values for this object.

getPendingValues

public LyValueSet getPendingValues()
Fetchs the complete set of pending values for this object.

Returns:
Values set containing all pending values for this object.

getOldValues

public LyValueSet getOldValues()
Fetchs the complete set of old values for this object (values for which a new value exists).

Returns:
Values set containing all old values fo this object.

getOldValue

public final java.lang.Object getOldValue(LyFieldInfo fieldInfo)
Gets old value (excluding new value) on this object for given field info.

Parameters:
fieldInfo - Field info for which the old value is requested.
Returns:
The old value of the specified field.

getPeer

public java.lang.Object getPeer()
Retrieves the associated peer (physical object that really stores values for non local fields).

Returns:
Peer associated to this object, null if the object belongs to a local class info (class with no persistence) or if the object was not yet created on the physical layer.

setValue

public void setValue(java.lang.String fieldId,
                     java.lang.Object value)
Sets a value for this object on the fieldInfo corresponding to the given id.

Parameters:
fieldId - Id of the set field info.
value - Value to set on the corresponding field info. This value should be an instance of the class returned by getValueClass of the field info.
IllegalArgumentException - If the field id doesn't correspond to a field info in the class info of this object.
See Also:
LyFieldInfo.getValueClass()

setValue

public void setValue(LyFieldInfo fieldInfo,
                     java.lang.Object value)
Sets a value for this object on the given fieldInfo.

Parameters:
fieldInfo - Field info to set.
value - Value to set on that field. This value should be an instance of the class returned by getValueClass of the field info.
See Also:
LyFieldInfo.getValueClass()

setFieldValue

public void setFieldValue(LyValue value)
Sets a field value on this object.

Parameters:
value - Field value to set on this object.

setValues

public void setValues(LyValueSet values)
Set values on this object with the given values set.

Parameters:
values - Values set containing field values to set on this object.

setPeer

public void setPeer(java.lang.Object peer)
Sets the peer (physical layer) of this object. This method should normally not be used except by the object source when creating a logical object from its peer. Once associated, the peer can't be changed anymore.

Throws:
java.lang.IllegalStateException - If this object has already a peer.
java.lang.IllegalArgumentException - If the class of the given peer is not the expected physical object class.

create

public LyResponse create()
Creates an object : to commit its creation on the underlying data provider. Values for this object should have been given previously using setFieldValue or setValue methods.

Returns:
Returns a response indicating status of this creation.
Throws:
java.lang.IllegalStateException - If the class info for this object is abstract.
See Also:
setFieldValue(leon.data.LyValue), setValue(java.lang.String, java.lang.Object)

create

public LyResponse create(boolean local)
Creates an object : to commit its creation on the underlying data provider. Values for this object should have been given previously using setFieldValue or setValue methods.

Parameters:
local - Indicates if the creation must be local or not.
Returns:
Returns a response indicating status of this creation.
Throws:
java.lang.IllegalStateException - If the class info for this object is abstract.
See Also:
setFieldValue(leon.data.LyValue), setValue(java.lang.String, java.lang.Object)

set

public LyResponse set()
Sets an object : to commit its modification on the underlying data provider. Values for this object should have been given previously using setFieldValue or setValue methods.

Returns:
Returns a response indicating status of this modification.
Throws:
java.lang.IllegalStateException - If the peer (physical object) doesn't exist and the class info for this object is not local.
See Also:
setFieldValue(leon.data.LyValue), setValue(java.lang.String, java.lang.Object)

set

public LyResponse set(boolean local)
Sets an object : to commit its modification on the underlying data provider. Values for this object should have been given previously using setFieldValue or setValue methods.

Parameters:
local - Indicates if the modification must be local or not.
Returns:
Returns a response indicating status of this modification.
Throws:
java.lang.IllegalStateException - If the peer (physical object) doesn't exist and the class info for this object is not local.
See Also:
setFieldValue(leon.data.LyValue), setValue(java.lang.String, java.lang.Object)

delete

public LyResponse delete()
Deletes an object : to commit its deletion on the underlying data provider.

Returns:
Returns a response indicating status of this deletion.
Throws:
java.lang.IllegalStateException - If the peer (physical object) doesn't exist and the class info for this object is not local.

delete

public LyResponse delete(boolean local)
Deletes an object : to commit its deletion on the underlying data provider.

Parameters:
local - Indicates if the deletion is local or not
Returns:
Returns a response indicating status of this deletion.
Throws:
java.lang.IllegalStateException - If the peer (physical object) doesn't exist and the class info for this object is not local.

checkObject

public boolean checkObject()
Checks if this object is found on its object source cache.

Returns:
True if it exists, false otherwise.

compare

public int compare(LyObject object,
                   LySort sort,
                   boolean byName)
Compares this object with another object using the given sort. This method can be overriden to provide a specific but more efficient implementation.

Parameters:
object - Object to compare with this object.
sort - Sort used to compare the two objects.
byName - Boolean indicating whether default sorting is done on ids or names when the two objects are similar for the given sort. This is used to have a full order when sorting an objects list to be sure that sorting the same list twice will give the same result.
Returns:
0 If the two objects are identical for the specified fieldInfo, a positive number if this object is "greater" than object. If object is "greater" than this object, a negative number is returned.

compare

public int compare(LyObject object,
                   boolean byName)
Compares this object with another object using default comparison. This comparison is based on object ids or names depending on byName parameter.

Parameters:
object - Object to compare with this object.
byName - Boolean indicating whether sorting is done on ids or names.
Returns:
0 If the two objects are identical for the specified fieldInfo, a positive number if this object is "greater" than object. If object is "greater" than this object, a negative number is returned.

getList

public LyObjectList getList(LyDataSession session,
                            LyClassInfo targetClass,
                            boolean dynamic,
                            boolean sorted)
Gets in the given session a list of objects of the specified target class related to this object. Depending on the dynamic parameter, the result list can be static or dynamic (may send events when its content is modified).

Parameters:
session - Session in which this search occurs. This parameter may be null if the request is not dynamic.
targetClass - Target class.
dynamic - Boolean indicating if the result list has to be dynamic or not.
Returns:
Result list containing objects of the target class related to this object in the given session.

getList

public LyObjectList getList(LyDataSession session,
                            LyClassInfo targetClass,
                            boolean dynamic,
                            boolean sorted,
                            boolean local)
Gets in the given session a list of objects of the specified target class related to this object. Depending on the dynamic parameter, the result list can be static or dynamic (may send events when its content is modified).

Parameters:
session - Session in which this search occurs. This parameter may be null if the request is not dynamic.
targetClass - Target class.
dynamic - Boolean indicating if the result list has to be dynamic or not.
Returns:
Result list containing objects of the target class related to this object in the given session.

getList

public LyObjectList getList(LyDataSession session,
                            LyClassInfo targetClass,
                            boolean dynamic)
Gets in the given session a list of objects of the specified target class related to this object. Depending on the dynamic parameter, the result list can be static or dynamic (may send events when its content is modified).

Parameters:
session - Session in which this search occurs. This parameter may be null if the request is not dynamic.
targetClass - Target class.
dynamic - Boolean indicating if the result list has to be dynamic or not.
Returns:
Result list containing objects of the target class related to this object in the given session.

getList

public LyObjectList getList(LyDataSession session,
                            LyClassInfo targetClass)
Gets in the given session a list of objects of the specified target class related to this object. This list is not dynamic.

Parameters:
session - Session in which this search occurs. This parameter may be null.
targetClass - Target class.
Returns:
Result list containing objects of the target class related to this object in the given session.

getArrayObjects

public LyObjectList getArrayObjects()
Get list of array objects For internal use only.

Returns:
List of array objects

getSubObjects

public LyObjectList getSubObjects(boolean local)
Get list of sub-objects (objects pointed by this object on composition relations).

Returns:
List of sub-objects.

getJoinObjects

public LyObjectList getJoinObjects()
Get list of join-objects (objects pointed by this object on join relations).

Returns:
List of join-objects.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
This object returned as a string. This string contains the name of this object followed by its id enclosed within parenthesis.

isDeleted

public final boolean isDeleted()
Indicated if this object has been deleted or not.

Returns:
true if the object has been deleted.

removeNewValue

public void removeNewValue(LyFieldInfo fieldInfo)
Remove the fieldInfo value from the new values list.

Parameters:
fieldInfo - The fieldInfo

removeNewValues

public void removeNewValues(LyInfoList<LyFieldInfo> fieldInfos)
Remove the list of fieldInfo value from the new values list.

Parameters:
fieldInfos - The list of fieldInfos

removePendingValue

public void removePendingValue(LyFieldInfo fieldInfo)
Remove the fieldInfo value from the pending values list. For internal use only.

Parameters:
fieldInfo -

removePendingValues

public void removePendingValues(LyInfoList<LyFieldInfo> fieldInfos)
Remove the list of fieldInfo value from the pending values list. For internal use only.

Parameters:
fieldInfos - The list for fieldInfos.

resetObjectId

public void resetObjectId()
Reset storing cache of the id. The next call of getObjectId will recompute the id of this object.


getErrorLevel

public final short getErrorLevel()
To get the error level of this object.

Returns:
the error level of the object. Error levels greater than LEVEL_WARNING are user specific levels.

getErrorLevel

public short getErrorLevel(LyFieldInfo fieldInfo)
Get error level on this object for the given fieldInfo.

Parameters:
fieldInfo - FieldInfo on which error level is requested.
Returns:
Status of calling controls.

addError

public void addError(LyError error)
To add an error to this object.

Parameters:
error - the error to add.

removeError

public LyError removeError(int idx)
Remove the error at the specified index.

Parameters:
idx -
Returns:
The removed error

removeError

public LyError removeError(LyError error)
Remove the specified error.

Parameters:
idx -
Returns:
The removed error

getErrorsCount

public int getErrorsCount()
To get the number of errors associated to this object.

Returns:
The number of errors.

getError

public LyError getError(int idx)
To get the error at the specified index.

Parameters:
idx - the index
Returns:
the error at the idx position.

getError

public LyError getError(java.lang.String errorId)
To get the error with the specified id.

Parameters:
errorId - Id of the requested error.
Returns:
the error with the given id if it exists.

getLastError

public LyError getLastError(short level)
To get the last error on this object with the specified level.

Parameters:
level - the level of the error
Returns:
the last error.

resetFieldInfoErrors

public void resetFieldInfoErrors(LyFieldInfo fieldInfo)
Reset all errors caused by the specified fieldInfo.

Parameters:
fieldInfo - Cause of errors to reset.

resetClassErrors

public void resetClassErrors()
Reset all errors caused by class controls.


refreshErrorLevel

public void refreshErrorLevel()
Deprecated. This method must'nt be used directly and will be not public in future releases.

Recomputes the error level of the object and post a state change event if necessary.


refresh

public void refresh(LyInfoList<LyFieldInfo> fieldInfos)
Refresh a list of fields on this object. Updates all views that contains this object.

Parameters:
fieldInfos - List of fields to refresh (may be null).

refresh

public void refresh()
Refresh new values.


refresh

public void refresh(LyValueSet values)
Send an update event for this object. Updates all views that contains this object.

Parameters:
values - List of oldValues updated (may be null).

getParent

public LyObject getParent()
Deprecated. use getParents

Get parent object of this sub object.

Returns:
The parent object if this object is a sub-object, null otherwise.

getParents

public LyObjectList getParents()
Get parents object of this object.

Returns:
The parent objects if this object is a sub-object, null otherwise.

callFieldControls

public short callFieldControls(LyFieldInfo fieldInfo,
                               java.lang.Object value)
Method to call controls corresponding to the given fieldInfo.

Parameters:
fieldInfo - FieldInfo that holds on controls to apply.
value - Value assigned on this object for the given field info.
Returns:
Result status of calling controls.

callClassControls

public short callClassControls(LyValueSet values)
Internal method to call controls associated to class info of this object.

Parameters:
values - List of controlled values.
Returns:
Result of calling controls.

checkId

public short checkId(LyValueSet values)
Checks id.


checkAppId

public short checkAppId(LyValueSet values)
Checks application id.


setSelected

public void setSelected(boolean selected)
Modifier of the selection state.


isSelected

public boolean isSelected()
Accessor to the the selection state.


setHidden

public void setHidden(boolean hidden)
Modifier of the visibility state.


isHidden

public final boolean isHidden()
Accessor to the the visibility state.


hasNewValue

public boolean hasNewValue(LyFieldInfo fieldInfo)
Checks if this object has a new value registered for the given field info.

Parameters:
fieldInfo - The field info to check.
Returns:
True if this object has a new value for the field info given as parameter, false otherwise.

hasNewValues

public boolean hasNewValues()
Checks if this object has some new values.

Returns:
True if this object has some new values, false otherwise.

hasPendingValue

public boolean hasPendingValue(LyFieldInfo fieldInfo)
Checks if this object has a pending value registered for the given field info.

Parameters:
fieldInfo - The field info to check.
Returns:
True if this object has a pending value for the field info given as parameter, false otherwise.

hasPendingValues

public boolean hasPendingValues()
Checks if this object has some pending values.

Returns:
True if this object has some pending values, false otherwise.

getLabel

public java.lang.String getLabel(LyFieldInfo fieldInfo,
                                 java.lang.Object fieldValue)
Gets label for given field and value.

Parameters:
fieldInfo -
fieldValue -
Returns:
The label.

getShortLabel

public java.lang.String getShortLabel(LyFieldInfo fieldInfo,
                                      java.lang.Object fieldValue)
Gets short label for given field and value.

Parameters:
fieldInfo -
fieldValue -
Returns:
The short label.

control

public short control()
Method for controlling this object before its creation or set. Apply all class and field controls on values of the object.

Returns:
The global status returned by controls.

control

public short control(LyValueSet oldValues)
Method changes made on this object following an external notification.

Parameters:
oldValues - Old values for all the changes made on this object.

control

public short control(LyValueSet oldValues,
                     boolean loading)
Method changes made on this object following an external notification.

Parameters:
oldValues - Old values for all the changes made on this object.
loading - Boolean indicating if controls occur on loading or not.

isTemporary

public final boolean isTemporary()
Check if this is a temporary object (never created in the system, just an holder for values).

Returns:
temporary state of the object.

setTemporary

public final void setTemporary(boolean temporary)
Set this object as a temporary object (never created in the system, just an holder for values).

Parameters:
temporary - state of the object.

skipEncoding

public final void skipEncoding(boolean encoding)
Skip encoding of value untill next set() or create() call, or untill this parameter is changed. Should be for internal use only.

Parameters:
boolean - encoding status. set() or create() clears this skip encoding status

reload

public void reload(LyInfoList<LyFieldInfo> fieldInfos)
Method to force the reload of the object.

Parameters:
fieldInfos - List of fieldInfos to reload.

setContextType

public void setContextType(LyContext.Type type)
Context type during modification state of this object : this information may be used by the LyContext to indicate the kind of modification (User or by code) for read only attributes The default value -1 means 'undefined' or not within a context.

Parameters:
type - one of the LyContext.TYPE_xxx or -1 if undefined.

checkInstance

public boolean checkInstance()
Checks if this instance is found on its object source cache.

Returns:
True if it exists, false otherwise.

modified

public void modified(LyValueSet values)
Method called when a modification notification has been received. This method should be overriden to copmpute local fields.

Parameters:
values - List of old values before the modification.

isFullyLoaded

public final boolean isFullyLoaded()
Accessor to the the loaded state.


(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com