LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyObjectSource

java.lang.Object
  extended by leon.data.LyDataSource
      extended by leon.data.LyObjectSource
Direct Known Subclasses:
LyExtendObjectSource, LyFilteredObjectSource, LyTemporaryObjectSource

public class LyObjectSource
extends LyDataSource

An object source is associated to each logical class (LyClassInfo). The object source is the entry point for loading, creating, modifying and deleting logical objects (LyObject).

Objects sources are associated to data sources to dispatch demands on the underlying physical layer when requests are made for logical objects.

See Also:
LyObject, LyClassInfo

Field Summary
static java.lang.String __VERSION
           
static long GET_SIZE_CACHE_DELAY
          Param max duration of _getSizeCache in ms.
 
Constructor Summary
LyObjectSource(LyDataProvider provider, LyClassInfo classInfo)
          Constructs an object source for a given class info and a provider.
 
Method Summary
 void addListener(LyDataSourceListener listener, short type)
          Registers a listener to receive events of the given type on objects contained within this data source.
 void addListener(LyDataSourceListener listener, java.util.Vector<LyField> fields)
          Registers a listener to receive modification events concerning given fields on objects contained within this data source.
 void addLoadedFieldInfos(java.util.Vector<LyFieldInfo> fieldInfos)
          Sets the list of loaded fieldinfos for this object source.
 boolean areFieldsLoaded(LyInfoList<LyFieldInfo> fieldInfos)
          To know if the specified list of fieldInfos are loaded or not.
 LyResponse createObject(LyObject object)
          Create a new object in this object source.
 LyResponse createObject(LyObject object, LyResponseListener listener)
          Create a new object in this object source.
 LyResponse createObject(LyObject object, LyResponseListener listener, boolean local, boolean refresh)
          Create a new object in this object source.
 LyResponse createObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
          Create a new object on the associated data provider.
 LyResponse deleteObject(LyObject object)
          Delete an object of this object source.
 LyResponse deleteObject(LyObject object, LyResponseListener listener)
          Delete an object of this object source.
 LyResponse deleteObject(LyObject object, LyResponseListener listener, boolean local, boolean refresh)
          Delete an object of this object source.
 LyResponse deleteObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
          Delete an object on the associated data provider.
 LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects)
          Delete a list of objects of this object source.
 LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener)
          Delete a list of objects of this object source.
 LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, boolean local, boolean refresh)
          Delete a list of objects of this object source.
 LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, boolean local, boolean refresh, boolean deleteLinkedObjects)
          Delete a list of objects of this object source.
 LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, LyClassBinding classBinding)
          Delete a list of objects on the associated data provider.
 void finalizeObject(LyObject object)
          Finalize method for an object, remove from cache
 void free()
          Free this object source.
 LyClassInfo getClassInfo()
          Retrieves the class info for which this object source was constructed.
 LyDataSourceListener getListener()
          To get the instance of LyDataSourceListener of this object source.
 java.lang.Object getObject(LyObjectId id)
          Gets an object from this object source by the specified identifier.
 java.lang.Object getObject(LyObjectId id, boolean local)
          Gets an object from this object source by the specified identifier.
 java.lang.Object getObject(LyObjectId id, LyClassBinding classBinding)
          Gets an object from this data source by the specified identifier.
 LyObject getObjectFromPeer(java.lang.Object peer)
          Finds an object from its object peer (associated physical object).
 LyResponse getObjects(LyFilter filter)
          Retrieve objects on this object source that match a given filter.
 LyResponse getObjects(LySort sort)
          Retrieve objects on this object source sorted by a given sort.
 LyResponse getObjects(LySort sort, LyFilter filter, int n)
          Retrieve objects on this object source.
 LyResponse getObjects(java.util.Vector<LyFieldInfo> fieldInfos, LySort sort, LyFilter filter, int n, boolean local, LyResponseListener listener)
          Retrieve objects on this object source.
 LyDataSource getPeerDataSource()
          Gets data source of physical layer associated to this object source.
 LyClassInfo getRealClassInfo(LyObject object)
          Given an object, return the real class info of this object.
 int getSize(LyFilter filter)
          Return the number of objects within this object source matching the given filter.
 int getSize(LyFilter filter, boolean local)
          Return the number of objects within this object source matching the given filter.
 int getSize(LyFilter filter, LyClassBinding classBinding)
          Return the number of objects within this data source matching the given filter.
 void listenTo(LyDataSource dataSource)
          Associates this object source to a data source representing the physical layer.
 void load()
          Loads completely this object source : loads the associated cache according to the cache policy.
 LyResponse loadObject(LyObjectId id)
          Method to load an object by its id from this object source.
 LyResponse loadObject(LyObjectId id, LyResponseListener listener)
          Method to load an object by its id from this object source.
 LyResponse loadObject(LyObjectId id, java.util.Vector<? extends LyField> fields, LyResponseListener listener)
          Method to load an object from its id on the associated data provider.
 LyResponse loadObject(LyObjectId id, java.util.Vector<? extends LyField> fields, LyResponseListener listener, LyClassBinding classBinding)
          Method to load an object from its id on the associated data provider.
 LyResponse loadObjects(java.util.Vector<? extends LyField> fieldInfos, LySort sort, LyFilter filter, int n, LyResponseListener listener)
          Method for loading objects on this object source.
 LyResponse loadObjects(java.util.Vector<? extends LyField> fields, LySort sort, LyFilter filter, int n, LyResponseListener listener, LyClassBinding classBinding)
          Method for loading objects on the associated data provider.
 LyResponse loadObjects(java.util.Vector<LyFieldInfo> fieldInfos, LySort sort, LyFilter filter, int n)
          Method for loading objects on this object source.
 void notifyClassLoading(LyClassInfo classInfo)
          Method to notify the loading of a class to an object source.
 void raiseError(LyError error, LyObject object)
          Raises an error on this object source.
 boolean receiveEvent(java.lang.String groupId, LyEventNotifier.EventType type, java.lang.Object object, LyValueSet values)
          This method is used by the event notifier to notify the data source for data changes made by other applications using the same datas.
 void receiveResponse(LyResponse response, LyResponse.Status status, java.lang.Object object, LyValueSet oldValues)
          Method used to receive a new response from data provider to a request sent by this data source.
 void recordId(LyObject object)
          Method used to record object id for test mode.
 void rehash(LyObject object)
          Recompute the object id of the specified object.
 LyResponse reloadObject(LyObjectId id)
          Method to reload an object by its id from this object source.
 LyResponse reloadObject(LyObjectId id, LyResponseListener listener)
          Method to reload an object by its id from this object source.
 LyResponse reloadObject(LyObjectId id, java.util.Vector<LyFieldInfo> fields, LyResponseListener listener)
          Method to reload an object from its id on the associated data provider.
 void removeError(LyError error, LyObject object)
          Removes an error on this object source.
 void removeListener(LyDataSourceListener listener)
          Unregisters a listener for notifications from this data source.
 void resetLoadedFieldInfos()
          Reset the list of loaded fieldInfos.
 void setCache(LyInfoCache cachePolicy)
          Sets the cache for this object source.
 LyResponse setObject(LyObject object)
          Set an object of this object source.
 LyResponse setObject(LyObject object, LyResponseListener listener)
          Set an object of this object source.
 LyResponse setObject(LyObject object, LyResponseListener listener, boolean local, boolean refresh)
          Set an object of this object source.
 LyResponse setObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
          Set an object on the associated data provider.
 LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects)
          Set a list of objects of this object source.
 LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener)
          Set a list of objects of this object source.
 LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, LyClassBinding classBinding)
          Set a list of objects on the associated data provider.
 void unload(boolean notify)
          Unloads completely this object source : unloads the associated cache and data source.
 void validate()
          To validate this objectSource.
 
Methods inherited from class leon.data.LyDataSource
addListener, checkObject, checkObject, getApplication, getCache, getDataClass, getDataProvider, getLastModified, getObject, getSize, isReadOnly, isRollBack, isSynchronous, reloadObject, setIgnoreErrorOnLoad, setReadOnly, setRollBack, setSynchronous, unload
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

GET_SIZE_CACHE_DELAY

public static long GET_SIZE_CACHE_DELAY
Param max duration of _getSizeCache in ms.

Constructor Detail

LyObjectSource

public LyObjectSource(LyDataProvider provider,
                      LyClassInfo classInfo)
Constructs an object source for a given class info and a provider.

Parameters:
provider - The provider of this data source.
classInfo - Class info for which an object source is constructed.
Method Detail

getClassInfo

public LyClassInfo getClassInfo()
Retrieves the class info for which this object source was constructed.

Returns:
Class info of this object source.

listenTo

public void listenTo(LyDataSource dataSource)
Associates this object source to a data source representing the physical layer.

Parameters:
dataSource - Data source to which this object source is associated.
Throws:
java.lang.IllegalArgumentException - If the given data source is null.
java.lang.IllegalStateException - If this object source is already associated to a data source.

setCache

public void setCache(LyInfoCache cachePolicy)
Sets the cache for this object source.

Specified by:
setCache in class LyDataSource
Parameters:
cachePolicy - Informations for the cache to associate to this object source.
Throws:
java.lang.IllegalArgumentException - If the given cache policy is null.
java.lang.IllegalStateException - If the object source is already associated to a cache that contains objects.

free

public void free()
Free this object source. Remove this object source as listener of the associated data source.


load

public void load()
Loads completely this object source : loads the associated cache according to the cache policy.


unload

public void unload(boolean notify)
Unloads completely this object source : unloads the associated cache and data source. Empties associated cache.

Overrides:
unload in class LyDataSource
Parameters:
notify - indicates wether the unload action should notify objects deletion. Notifying deletions makes sense when views are opened and when application is not exiting.

addLoadedFieldInfos

public void addLoadedFieldInfos(java.util.Vector<LyFieldInfo> fieldInfos)
Sets the list of loaded fieldinfos for this object source.

Parameters:
fieldInfos - The list of loaded fieldInfos.

resetLoadedFieldInfos

public void resetLoadedFieldInfos()
Reset the list of loaded fieldInfos.


getRealClassInfo

public LyClassInfo getRealClassInfo(LyObject object)
Given an object, return the real class info of this object. For a normal object, return the object classInfo if it belongs to this objectsource.

Parameters:
object - the LyObject
Returns:
the correct classInfo for this object.

areFieldsLoaded

public boolean areFieldsLoaded(LyInfoList<LyFieldInfo> fieldInfos)
To know if the specified list of fieldInfos are loaded or not.

Parameters:
fieldInfos - The list of fieldInfos
Returns:
true if the fieldInfos are loaded else false.

getObject

public java.lang.Object getObject(LyObjectId id)
Gets an object from this object source by the specified identifier.

Specified by:
getObject in class LyDataSource
Parameters:
id - Object identifier of the searched object.
Returns:
The requested object if it was found, or null if it could not be found. This object is an instance of LyObject (or an inherited class).

getObject

public java.lang.Object getObject(LyObjectId id,
                                  boolean local)
Gets an object from this object source by the specified identifier.

Parameters:
id - Object identifier of the searched object.
local - Indicates if the demand is local (gets object from memory) or not.
Returns:
The requested object if it was found, or null if it could not be found. This object is an instance of LyObject (or an inherited class).

getSize

public int getSize(LyFilter filter)
Return the number of objects within this object source matching the given filter.

Overrides:
getSize in class LyDataSource
Parameters:
filter - Filter applied on objects for counting.
Returns:
Number of objects matching the given filter in this object source.

getSize

public int getSize(LyFilter filter,
                   boolean local)
Return the number of objects within this object source matching the given filter.

Parameters:
filter - Filter applied on objects for counting.
local - Indicates if the request must be local or not.
Returns:
Number of objects matching the given filter in this object source.

createObject

public final LyResponse createObject(LyObject object)
Create a new object in this object source. This method commits local creation by creating the corresponding physical object.

Parameters:
object - Object to create.
Returns:
Response to the creation.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.

createObject

public LyResponse createObject(LyObject object,
                               LyResponseListener listener)
Create a new object in this object source. This method commits local creation by creating the corresponding physical object.

Parameters:
object - Object to create.
listener - Listener of the response.
Returns:
Response to the creation.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.

createObject

public LyResponse createObject(LyObject object,
                               LyResponseListener listener,
                               boolean local,
                               boolean refresh)
Create a new object in this object source. This method commits local creation by creating the corresponding physical object.

Parameters:
object - Object to create.
listener - Listener of the response.
local - Indicates if the creation must be local or not.
refresh - Indicates if the creation may be notified or not.
Returns:
Response to the creation.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.

setObject

public final LyResponse setObject(LyObject object)
Set an object of this object source. This method commits local modification by setting the corresponding physical object.

Parameters:
object - Object to modify.
Returns:
Response to the modification.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If the given object is invalid.

setObject

public LyResponse setObject(LyObject object,
                            LyResponseListener listener)
Set an object of this object source. This method commits local modification by setting the corresponding physical object.

Parameters:
object - Object to modify.
listener - Listener of the response.
Returns:
Response to the modification.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If the given object is invalid.

setObject

public LyResponse setObject(LyObject object,
                            LyResponseListener listener,
                            boolean local,
                            boolean refresh)
Set an object of this object source. This method commits local modification by setting the corresponding physical object.

Parameters:
object - Object to modify.
listener - Listener of the response.
local - Indicates if the modification is local or not.
refresh - Indicates if the modification may be notified or not.
Returns:
Response to the modification.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If the given object is invalid.

setObjects

public final LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects)
Set a list of objects of this object source. This method commits local modifications by setting the corresponding physical objects.

Parameters:
objects - List of objects to modify.
Returns:
Response to the modification.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

setObjects

public LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects,
                             LyResponseListener listener)
Set a list of objects of this object source. This method commits local modifications by setting the corresponding physical objects.

Parameters:
objects - List of objects to modify.
listener - Listener of the response.
Returns:
Response to the modification.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

deleteObject

public final LyResponse deleteObject(LyObject object)
Delete an object of this object source. This method commits local deletion by deleting the corresponding physical object.

Parameters:
object - Object to delete.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

deleteObject

public LyResponse deleteObject(LyObject object,
                               LyResponseListener listener)
Delete an object of this object source. This method commits local deletion by deleting the corresponding physical object.

Parameters:
object - Object to delete.
listener - Listener of the response.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If the given object is invalid.

deleteObject

public LyResponse deleteObject(LyObject object,
                               LyResponseListener listener,
                               boolean local,
                               boolean refresh)
Delete an object of this object source. This method commits local deletion by deleting the corresponding physical object.

Parameters:
object - Object to delete.
listener - Listener of the response.
local - Indicates if the deletion is local or not.
refresh - Indicates if the deletion may be notified or not.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If the given object is invalid.

deleteObjects

public final LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects)
Delete a list of objects of this object source. This method commits local deletions by deleting the corresponding physical objects.

Parameters:
objects - List of objects to delete.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

deleteObjects

public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects,
                                LyResponseListener listener)
Delete a list of objects of this object source. This method commits local deletions by deleting the corresponding physical objects.

Parameters:
objects - List of objects to delete.
listener - Listener of the response.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

deleteObjects

public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects,
                                LyResponseListener listener,
                                boolean local,
                                boolean refresh)
Delete a list of objects of this object source. This method commits local deletions by deleting the corresponding physical objects.

Parameters:
objects - List of objects to delete.
listener - Listener of the response.
local - Indicates if the deletion is local or not.
refresh - Indicates if the deletion may be notified or not.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

deleteObjects

public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects,
                                LyResponseListener listener,
                                boolean local,
                                boolean refresh,
                                boolean deleteLinkedObjects)
Delete a list of objects of this object source. This method commits local deletions by deleting the corresponding physical objects.

Parameters:
objects - List of objects to delete.
listener - Listener of the response.
local - Indicates if the deletion is local or not.
refresh - Indicates if the deletion may be notified or not.
deleteLinkObjects - Indicates if linked objects (composition relations, ...) must be deleted or not.
Returns:
Response to the deletion.
Throws:
java.lang.IllegalStateException - If the object source is in read only mode.
java.lang.IllegalArgumentException - If one of the given objects is invalid.

reloadObject

public final LyResponse reloadObject(LyObjectId id)
Method to reload an object by its id from this object source.

Parameters:
id - Object identifier corresponding to the object to reload.
Returns:
Response to the loading.

reloadObject

public LyResponse reloadObject(LyObjectId id,
                               LyResponseListener listener)
Method to reload an object by its id from this object source.

Parameters:
id - Object identifier corresponding to the object to reload.
listener - Listener of the response.
Returns:
Response to the loading.

reloadObject

public LyResponse reloadObject(LyObjectId id,
                               java.util.Vector<LyFieldInfo> fields,
                               LyResponseListener listener)
Method to reload an object from its id on the associated data provider.

Parameters:
id - Object identifier corresponding to the object to reload.
fields - Fields to load (null means all fields).
listener - Listener of the response.
Returns:
Response to the loading.

loadObject

public final LyResponse loadObject(LyObjectId id)
Method to load an object by its id from this object source.

Parameters:
id - Object identifier corresponding to the object to load.
Returns:
Response to the loading.

loadObject

public final LyResponse loadObject(LyObjectId id,
                                   LyResponseListener listener)
Method to load an object by its id from this object source.

Parameters:
id - Object identifier corresponding to the object to load.
listener - Listener of the response.
Returns:
Response to the loading.

loadObject

public LyResponse loadObject(LyObjectId id,
                             java.util.Vector<? extends LyField> fields,
                             LyResponseListener listener)
Method to load an object from its id on the associated data provider.

Parameters:
id - Object identifier corresponding to the object to load.
fields - Fields to load (null means all fields).
listener - Listener of the response.
Returns:
Response to the loading.

loadObjects

public final LyResponse loadObjects(java.util.Vector<LyFieldInfo> fieldInfos,
                                    LySort sort,
                                    LyFilter filter,
                                    int n)
Method for loading objects on this object source. Load a specified number of objects sorted by a given sort and that match a given filter.

Parameters:
fieldInfos - The list of the fieldInfos to load if necessary. If this parameter is null all the field infos are loaded. If the list is empty, only fields with mark id or name and fields used by sort and filter are loaded.
sort - Gives sort criteria, or null if there is no sort (the order is the one of the physical layer).
filter - Gives filter criteria, or null if there is no filter (all objects).
n - Indicates the number of objects to load (-1 means no limit).
Returns:
Response to the loading.

loadObjects

public LyResponse loadObjects(java.util.Vector<? extends LyField> fieldInfos,
                              LySort sort,
                              LyFilter filter,
                              int n,
                              LyResponseListener listener)
Method for loading objects on this object source. Load a specified number of objects sorted by a given sort and that match a given filter.

Parameters:
fieldInfos - The list of the fieldInfos to load if necessary. If this parameter is null all the field infos are loaded. If the list is empty, only fields with mark id or name and fields used by sort and filter are loaded.
sort - Gives sort criteria, or null if there is no sort (the order is the one of the physical layer).
filter - Gives filter criteria, or null if there is no filter (all objects).
n - Indicates the number of objects to load (-1 means no limit).
listener - Listener of the response.
Returns:
Response to the loading.

getObjects

public LyResponse getObjects(java.util.Vector<LyFieldInfo> fieldInfos,
                             LySort sort,
                             LyFilter filter,
                             int n,
                             boolean local,
                             LyResponseListener listener)
Retrieve objects on this object source. Retrieve a specified number of objects sorted by a given sort and that match a given filter. These objects are first searched in the associated cache to avoid requests to the physical layer.

Parameters:
fieldInfos - The list of the fieldInfos to load if necessary. If this parameter is null all the field infos are loaded. If the list is empty, only fields with mark id or name and fields used by sort and filter are loaded.
sort - Gives sort criteria, or null if there is no sort (the order is the one of the physical layer).
filter - Gives filter criteria, or null if there is no filter (all objects).
n - Indicates the number of objects to retrieve (-1 means no limit).
local - Indicates if the request is local (from memory) or not.
listener - Listener of the response.
Returns:
Response to this search.

getObjects

public final LyResponse getObjects(LySort sort,
                                   LyFilter filter,
                                   int n)
Retrieve objects on this object source. Retrieve a specified number of objects sorted by a given sort and that match a given filter. These objects are first searched in the associated cache to avoid requests to the physical layer.

Parameters:
sort - Gives sort criteria, or null if there is no sort (the order is the one of the physical layer).
filter - Gives filter criteria, or null if there is no filter (all objects).
n - Indicates the number of objects to retrieve (-1 means no limit).
Returns:
Response to this search.

getObjects

public final LyResponse getObjects(LyFilter filter)
Retrieve objects on this object source that match a given filter. These objects are first searched in the associated cache to avoid requests to the physical layer.

Parameters:
filter - Gives filter criteria, or null if there is no filter (all objects).
Returns:
Response to this search.

getObjects

public final LyResponse getObjects(LySort sort)
Retrieve objects on this object source sorted by a given sort. These objects are first searched in the associated cache to avoid requests to the physical layer.

Parameters:
sort - Gives sort criteria, or null if there is no sort (the order is the one of the physical layer).
Returns:
Response to this search.

rehash

public final void rehash(LyObject object)
Recompute the object id of the specified object.

Parameters:
object - the object to recompute its id.

getObjectFromPeer

public LyObject getObjectFromPeer(java.lang.Object peer)
Finds an object from its object peer (associated physical object). The object is searched in the cache and if it is not found, it is created.

Parameters:
peer - Physical object.
Returns:
The logical object that was found or created, or null if the creation fails.

recordId

public void recordId(LyObject object)
Method used to record object id for test mode.


receiveResponse

public void receiveResponse(LyResponse response,
                            LyResponse.Status status,
                            java.lang.Object object,
                            LyValueSet oldValues)
Method used to receive a new response from data provider to a request sent by this data source. This method may be called several times if several objects are concerned.

Overrides:
receiveResponse in class LyDataSource
Parameters:
response - Response where there is a new object concerned.
status - Status of the new response. Valid status are defined in LyResponse.
object - Object concerned by this response.
oldValues - Values that have changed for the object with this response (null when the operation is not a load or a modifcation).
Throws:
java.lang.IllegalArgumentException - If response parameter is null.
See Also:
LyResponse, createObject(leon.data.LyObject), setObject(leon.data.LyObject), setObjects(java.util.Vector), deleteObject(leon.data.LyObject), deleteObjects(java.util.Vector), loadObject(leon.data.LyObjectId), loadObjects(java.util.Vector, leon.info.LySort, leon.info.LyFilter, int)

receiveEvent

public boolean receiveEvent(java.lang.String groupId,
                            LyEventNotifier.EventType type,
                            java.lang.Object object,
                            LyValueSet values)
This method is used by the event notifier to notify the data source for data changes made by other applications using the same datas.

Overrides:
receiveEvent in class LyDataSource
Parameters:
groupId - Id of the group of events. May be null for non grouped events.
type - Type of the event. Valid types are defined in LyEventNotifier.
object - Object concerned by the event
values - New values.
Returns:
True if the event was treated with success, false otherwise.

validate

public void validate()
To validate this objectSource. This method scans all fields of the associated class info and register this object source as listener on all object sources corresponding to classes that are pointed by relations. The purpose is to receive events on id. and name changes on related objects to transform them as modifications on objects managed by this objects source. As related objects are presented by their names, the goal is to ease the refreshing of the display when names change.


notifyClassLoading

public void notifyClassLoading(LyClassInfo classInfo)
Method to notify the loading of a class to an object source.

Parameters:
classInfo - the loaded class

getListener

public LyDataSourceListener getListener()
To get the instance of LyDataSourceListener of this object source.

Returns:
the instance of LyDataSourceListener of this object source.

getObject

public java.lang.Object getObject(LyObjectId id,
                                  LyClassBinding classBinding)
Gets an object from this data source by the specified identifier.

Parameters:
id - Object identifier of the searched object.
classBinding - Binding between logical class and physical class.
Returns:
The requested object if it was found, or null if it could not be found.

getSize

public int getSize(LyFilter filter,
                   LyClassBinding classBinding)
Return the number of objects within this data source matching the given filter.

Overrides:
getSize in class LyDataSource
Parameters:
filter - Filter applied on objects for counting.
classBinding - Binding between logical class and physical class.
Returns:
Number of objects matching the given filter in this data source.

createObject

public final LyResponse createObject(java.lang.Object object,
                                     LyResponseListener listener,
                                     LyClassBinding classBinding)
Create a new object on the associated data provider.

Overrides:
createObject in class LyDataSource
Parameters:
object - Object to create.
listener - Listener of the response.
classBinding - Binding between logical class and physical class.
Returns:
Response to the creation.

setObject

public final LyResponse setObject(java.lang.Object object,
                                  LyResponseListener listener,
                                  LyClassBinding classBinding)
Set an object on the associated data provider.

Overrides:
setObject in class LyDataSource
Parameters:
object - Object to modify.
listener - Listener of the response.
classBinding - Binding between logical class and physical class
Returns:
Response to the modification.

setObjects

public final LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects,
                                   LyResponseListener listener,
                                   LyClassBinding classBinding)
Set a list of objects on the associated data provider.

Overrides:
setObjects in class LyDataSource
Parameters:
objects - List of objects to modify.
listener - Listener of the response.
classBinding - Binding between logical class and physical class
Returns:
Response to the modification.

deleteObject

public final LyResponse deleteObject(java.lang.Object object,
                                     LyResponseListener listener,
                                     LyClassBinding classBinding)
Delete an object on the associated data provider.

Overrides:
deleteObject in class LyDataSource
Parameters:
object - Object to delete.
listener - Listener of the response.
classBinding - Binding between logical class and physical class
Returns:
Response to the deletion.

deleteObjects

public final LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects,
                                      LyResponseListener listener,
                                      LyClassBinding classBinding)
Delete a list of objects on the associated data provider.

Overrides:
deleteObjects in class LyDataSource
Parameters:
objects - List of objects to delete.
listener - Listener of the response.
classBinding - Binding between logical class and physical class
Returns:
Response to the deletion.

loadObject

public final LyResponse loadObject(LyObjectId id,
                                   java.util.Vector<? extends LyField> fields,
                                   LyResponseListener listener,
                                   LyClassBinding classBinding)
Method to load an object from its id on the associated data provider.

Overrides:
loadObject in class LyDataSource
Parameters:
id - Object identifier corresponding to the object to load.
fields - Fields to load (null means all fields).
listener - Listener of the response.
classBinding - binding between logical class and physical class
Returns:
Response to the loading.

loadObjects

public final LyResponse loadObjects(java.util.Vector<? extends LyField> fields,
                                    LySort sort,
                                    LyFilter filter,
                                    int n,
                                    LyResponseListener listener,
                                    LyClassBinding classBinding)
Method for loading objects on the associated data provider.

Overrides:
loadObjects in class LyDataSource
Parameters:
fields - Fields to load (null means all fields).
sort - Gives sort criteria, or null if there is no sort.
filter - Gives filter criteria, or null if there is no filter.
n - Indicates the number of objects to load (-1 means no limit).
listener - Listener of the response.
classBinding - binding between logical class and physical class
Returns:
Response to the loading.

addListener

public void addListener(LyDataSourceListener listener,
                        short type)
Registers a listener to receive events of the given type on objects contained within this data source.

Specified by:
addListener in class LyDataSource
Parameters:
listener - New listener. To receive these events, the listener have to implement the LyDataSourceListener interface.
type - Indicates which type of event the listener wants to receive. Types are defined as constant in LyDataSourceEvent class : TYPE_CREATE, TYPE_SET, TYPE_DELETE
Throws:
java.lang.IllegalArgumentException - If the listener is null or if the given type is unknown.

addListener

public void addListener(LyDataSourceListener listener,
                        java.util.Vector<LyField> fields)
Registers a listener to receive modification events concerning given fields on objects contained within this data source. Warning ! This method only registers the listener for modification events.

Specified by:
addListener in class LyDataSource
Parameters:
listener - New listener. To receive these events, the listener have to implement the LyDataSourceListener interface.
fields - List of fields on which the listener wants to be notified when they are modified.
Throws:
java.lang.IllegalArgumentException - If the listener is null.

removeListener

public void removeListener(LyDataSourceListener listener)
Unregisters a listener for notifications from this data source. The given listener is unregistered for all types of events he has been registered for.

Specified by:
removeListener in class LyDataSource
Parameters:
listener - The listener which shall not receive further events.
Throws:
java.lang.IllegalArgumentException - If the listener is null or if it is not known as listener on this data source.

getPeerDataSource

public LyDataSource getPeerDataSource()
Gets data source of physical layer associated to this object source.

Returns:
The data source of physical layer associated to this object source

raiseError

public void raiseError(LyError error,
                       LyObject object)
Raises an error on this object source.

Parameters:
error - The raised error
object - The object in error

removeError

public void removeError(LyError error,
                        LyObject object)
Removes an error on this object source.

Parameters:
error - The removed error
object - The object in error

finalizeObject

public void finalizeObject(LyObject object)
Finalize method for an object, remove from cache

Parameters:
object - LyObject being finalized

(c) January 2013 - W4 S.A.

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