|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.data.LyDataSource
leon.data.LyObjectSource
public class LyObjectSource
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.
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 |
---|
public static final java.lang.String __VERSION
public static long GET_SIZE_CACHE_DELAY
Constructor Detail |
---|
public LyObjectSource(LyDataProvider provider, LyClassInfo classInfo)
provider
- The provider of this data source.classInfo
- Class info for which an object source is constructed.Method Detail |
---|
public LyClassInfo getClassInfo()
public void listenTo(LyDataSource dataSource)
dataSource
- Data source to which this object source is associated.
java.lang.IllegalArgumentException
- If the given data source is null.
java.lang.IllegalStateException
- If this object source is already associated to a data
source.public void setCache(LyInfoCache cachePolicy)
setCache
in class LyDataSource
cachePolicy
- Informations for the cache to associate to this object source.
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.public void free()
public void load()
public void unload(boolean notify)
unload
in class LyDataSource
notify
- indicates wether the unload action should notify objects deletion. Notifying
deletions makes sense when views are opened and when application is not
exiting.public void addLoadedFieldInfos(java.util.Vector<LyFieldInfo> fieldInfos)
fieldInfos
- The list of loaded fieldInfos.public void resetLoadedFieldInfos()
public LyClassInfo getRealClassInfo(LyObject object)
object
- the LyObject
public boolean areFieldsLoaded(LyInfoList<LyFieldInfo> fieldInfos)
fieldInfos
- The list of fieldInfos
public java.lang.Object getObject(LyObjectId id)
getObject
in class LyDataSource
id
- Object identifier of the searched object.
public java.lang.Object getObject(LyObjectId id, boolean local)
id
- Object identifier of the searched object.local
- Indicates if the demand is local (gets object from memory) or not.
public int getSize(LyFilter filter)
getSize
in class LyDataSource
filter
- Filter applied on objects for counting.
public int getSize(LyFilter filter, boolean local)
filter
- Filter applied on objects for counting.local
- Indicates if the request must be local or not.
public final LyResponse createObject(LyObject object)
object
- Object to create.
java.lang.IllegalStateException
- If the object source is in read only mode.public LyResponse createObject(LyObject object, LyResponseListener listener)
object
- Object to create.listener
- Listener of the response.
java.lang.IllegalStateException
- If the object source is in read only mode.public LyResponse createObject(LyObject object, LyResponseListener listener, boolean local, boolean refresh)
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.
java.lang.IllegalStateException
- If the object source is in read only mode.public final LyResponse setObject(LyObject object)
object
- Object to modify.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public LyResponse setObject(LyObject object, LyResponseListener listener)
object
- Object to modify.listener
- Listener of the response.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public LyResponse setObject(LyObject object, LyResponseListener listener, boolean local, boolean refresh)
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.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public final LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects)
objects
- List of objects to modify.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener)
objects
- List of objects to modify.listener
- Listener of the response.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public final LyResponse deleteObject(LyObject object)
object
- Object to delete.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public LyResponse deleteObject(LyObject object, LyResponseListener listener)
object
- Object to delete.listener
- Listener of the response.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public LyResponse deleteObject(LyObject object, LyResponseListener listener, boolean local, boolean refresh)
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.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public final LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects)
objects
- List of objects to delete.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener)
objects
- List of objects to delete.listener
- Listener of the response.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, boolean local, boolean refresh)
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.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, boolean local, boolean refresh, boolean deleteLinkedObjects)
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.
java.lang.IllegalStateException
- If the object source is in read only mode.
java.lang.IllegalArgumentException
- If one of the given objects is invalid.public final LyResponse reloadObject(LyObjectId id)
id
- Object identifier corresponding to the object to reload.
public LyResponse reloadObject(LyObjectId id, LyResponseListener listener)
id
- Object identifier corresponding to the object to reload.listener
- Listener of the response.
public LyResponse reloadObject(LyObjectId id, java.util.Vector<LyFieldInfo> fields, LyResponseListener listener)
id
- Object identifier corresponding to the object to reload.fields
- Fields to load (null means all fields).listener
- Listener of the response.
public final LyResponse loadObject(LyObjectId id)
id
- Object identifier corresponding to the object to load.
public final LyResponse loadObject(LyObjectId id, LyResponseListener listener)
id
- Object identifier corresponding to the object to load.listener
- Listener of the response.
public LyResponse loadObject(LyObjectId id, java.util.Vector<? extends LyField> fields, LyResponseListener listener)
id
- Object identifier corresponding to the object to load.fields
- Fields to load (null means all fields).listener
- Listener of the response.
public final LyResponse loadObjects(java.util.Vector<LyFieldInfo> fieldInfos, LySort sort, LyFilter filter, int n)
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).
public LyResponse loadObjects(java.util.Vector<? extends LyField> fieldInfos, LySort sort, LyFilter filter, int n, LyResponseListener listener)
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.
public LyResponse getObjects(java.util.Vector<LyFieldInfo> fieldInfos, LySort sort, LyFilter filter, int n, boolean local, LyResponseListener listener)
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.
public final LyResponse getObjects(LySort sort, LyFilter filter, int n)
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).
public final LyResponse getObjects(LyFilter filter)
filter
- Gives filter criteria, or null if there is no filter (all objects).
public final LyResponse getObjects(LySort sort)
sort
- Gives sort criteria, or null if there is no sort (the order is the one of the
physical layer).
public final void rehash(LyObject object)
object
- the object to recompute its id.public LyObject getObjectFromPeer(java.lang.Object peer)
peer
- Physical object.
public void recordId(LyObject object)
public void receiveResponse(LyResponse response, LyResponse.Status status, java.lang.Object object, LyValueSet oldValues)
receiveResponse
in class LyDataSource
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).
java.lang.IllegalArgumentException
- If response parameter is null.LyResponse
,
createObject(leon.data.LyObject)
,
setObject(leon.data.LyObject)
,
setObjects(java.util.Vector extends java.lang.Object>)
,
deleteObject(leon.data.LyObject)
,
deleteObjects(java.util.Vector extends java.lang.Object>)
,
loadObject(leon.data.LyObjectId)
,
loadObjects(java.util.Vector, leon.info.LySort, leon.info.LyFilter, int)
public boolean receiveEvent(java.lang.String groupId, LyEventNotifier.EventType type, java.lang.Object object, LyValueSet values)
receiveEvent
in class LyDataSource
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 eventvalues
- New values.
public void validate()
public void notifyClassLoading(LyClassInfo classInfo)
classInfo
- the loaded classpublic LyDataSourceListener getListener()
public java.lang.Object getObject(LyObjectId id, LyClassBinding classBinding)
id
- Object identifier of the searched object.classBinding
- Binding between logical class and physical class.
public int getSize(LyFilter filter, LyClassBinding classBinding)
getSize
in class LyDataSource
filter
- Filter applied on objects for counting.classBinding
- Binding between logical class and physical class.
public final LyResponse createObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
createObject
in class LyDataSource
object
- Object to create.listener
- Listener of the response.classBinding
- Binding between logical class and physical class.
public final LyResponse setObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
setObject
in class LyDataSource
object
- Object to modify.listener
- Listener of the response.classBinding
- Binding between logical class and physical class
public final LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, LyClassBinding classBinding)
setObjects
in class LyDataSource
objects
- List of objects to modify.listener
- Listener of the response.classBinding
- Binding between logical class and physical class
public final LyResponse deleteObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
deleteObject
in class LyDataSource
object
- Object to delete.listener
- Listener of the response.classBinding
- Binding between logical class and physical class
public final LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, LyClassBinding classBinding)
deleteObjects
in class LyDataSource
objects
- List of objects to delete.listener
- Listener of the response.classBinding
- Binding between logical class and physical class
public final LyResponse loadObject(LyObjectId id, java.util.Vector<? extends LyField> fields, LyResponseListener listener, LyClassBinding classBinding)
loadObject
in class LyDataSource
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
public final LyResponse loadObjects(java.util.Vector<? extends LyField> fields, LySort sort, LyFilter filter, int n, LyResponseListener listener, LyClassBinding classBinding)
loadObjects
in class LyDataSource
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
public void addListener(LyDataSourceListener listener, short type)
addListener
in class LyDataSource
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
java.lang.IllegalArgumentException
- If the listener is null or if the given type is unknown.public void addListener(LyDataSourceListener listener, java.util.Vector<LyField> fields)
addListener
in class LyDataSource
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.
java.lang.IllegalArgumentException
- If the listener is null.public void removeListener(LyDataSourceListener listener)
removeListener
in class LyDataSource
listener
- The listener which shall not receive further events.
java.lang.IllegalArgumentException
- If the listener is null or if it is not known as listener
on this data source.public LyDataSource getPeerDataSource()
public void raiseError(LyError error, LyObject object)
error
- The raised errorobject
- The object in errorpublic void removeError(LyError error, LyObject object)
error
- The removed errorobject
- The object in errorpublic void finalizeObject(LyObject object)
object
- LyObject being finalized
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |