|
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
public abstract class LyDataSource
This class implements a collection of data of the same class. It provides methods for accessing, creating, deleting, modifying and counting datas.
Both physical class and logical class are managed by data sources. The only difference is that physical classes use direct instances of this class, and logical classes are handled by instances of an inherited class, LyObjectSource.
Each data source is connected to a data provider which is responsible to manage real objects : encoding requests and decoding results.
Data sources are valid within an application.
Objects returned via data sources are kept in caches.
LyClass
,
LyObjectSource
,
LyCache
Field Summary | |
---|---|
static java.lang.String |
__VERSION
File version |
Constructor Summary | |
---|---|
LyDataSource(LyDataProvider provider,
LyClass dataClass)
Constructs a data source within the given application that manages the specified class. |
Method Summary | |
---|---|
void |
addListener(LyDataSourceListener listener)
Registers a listener to receive all events on objects contained within this data source. |
abstract void |
addListener(LyDataSourceListener listener,
short type)
Registers a listener to receive events of the given type on objects contained within this data source. |
abstract 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. |
boolean |
checkObject(LyObjectId objectId)
Tests if an object corresponding to a given object id is found in the cache of this data source. |
boolean |
checkObject(java.lang.Object object)
Internal method to check validy of an object given as parameter. |
LyResponse |
createObject(java.lang.Object object,
LyResponseListener listener,
LyClassBinding classBinding)
Create a new object on the associated data provider. |
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,
LyResponseListener listener,
LyClassBinding classBinding)
Delete a list of objects on the associated data provider. |
LyApplication |
getApplication()
Gets the application of this data source. |
LyCache |
getCache()
Gets the cache associated to this data source. |
LyClass |
getDataClass()
Retrieves the class of data handled by this data source. |
LyDataProvider |
getDataProvider()
Gets the provider of the data in this data source. |
long |
getLastModified()
Returns the last time a modification occured within this data source. |
abstract java.lang.Object |
getObject(LyObjectId id)
Gets an object from this data source by the specified identifier. |
java.lang.Object |
getObject(LyObjectId id,
java.util.Vector<LyField> fields,
LyClassBinding classBinding)
Gets an object from this data source by the specified identifier. |
int |
getSize()
Return the number of objects within this data source. |
int |
getSize(LyFilter filter)
Return the number of objects within this data source matching the given filter. |
int |
getSize(LyFilter filter,
LyClassBinding classBinding)
Return the number of objects within this data source matching the given filter. |
boolean |
isReadOnly()
Checks if the data source is read only or not. |
boolean |
isRollBack()
The rollBack status of this datasource. |
boolean |
isSynchronous()
Checks if the data source is synchronous or not. |
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> fields,
LySort sort,
LyFilter filter,
int n,
LyResponseListener listener,
LyClassBinding classBinding)
Method for loading objects on the associated data provider. |
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. |
LyResponse |
reloadObject(LyObjectId id,
java.util.Vector<? extends LyField> fields,
LyResponseListener listener,
LyClassBinding classBinding)
Method to reload an object from its id on the associated data provider. |
abstract void |
removeListener(LyDataSourceListener listener)
Unregisters a listener for notifications from this data source. |
abstract void |
setCache(LyInfoCache cachePolicy)
Sets the cache for this data source. |
void |
setIgnoreErrorOnLoad(boolean ignoreErrorOnLoad)
Sets the ignore error on load for this datasource. |
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,
LyResponseListener listener,
LyClassBinding classBinding)
Set a list of objects on the associated data provider. |
void |
setReadOnly(boolean readOnly)
Sets the write mode of this data source. |
void |
setRollBack(boolean rollBack)
Set the rollBack status of this datasource. |
void |
setSynchronous(boolean synchronous)
Sets the synchronous mode of this data source. |
void |
unload()
Unloads completely the data of this datasource. |
void |
unload(boolean notify)
Unloads completely the data of this datasource. |
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
Constructor Detail |
---|
public LyDataSource(LyDataProvider provider, LyClass dataClass)
provider
- Provider on which this data source is connected.dataClass
- Class of data handled by this new data source.Method Detail |
---|
public abstract void setCache(LyInfoCache cachePolicy)
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 data source is already associated to a cache that
contains objects.public final LyDataProvider getDataProvider()
public final LyClass getDataClass()
public final LyCache getCache()
public final LyApplication getApplication()
public long getLastModified()
public final boolean isReadOnly()
public final boolean isSynchronous()
public void setReadOnly(boolean readOnly)
readOnly
- True if read only, false if writable.public void setIgnoreErrorOnLoad(boolean ignoreErrorOnLoad)
ignoreErrorOnLoad
- True to enable the mode, false if writable.public void setSynchronous(boolean synchronous)
synchronous
- True if the data source sends request in synchronous mode, false if they
are sent asynchronously.public void addListener(LyDataSourceListener listener)
listener
- New listener. To receive these events, the listener have to implement the
LyDataSourceListener interface.public abstract void addListener(LyDataSourceListener listener, short type)
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 abstract void addListener(LyDataSourceListener listener, java.util.Vector<LyField> fields)
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 abstract void removeListener(LyDataSourceListener listener)
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 void unload()
public void unload(boolean notify)
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 java.lang.Object getObject(LyObjectId id, java.util.Vector<LyField> fields, LyClassBinding classBinding)
id
- Object identifier of the searched object.fields
- A list of fields that need to be fetched. Null for all.classBinding
- Binding between logical class and physical class. This binding may
contain extra information required for encoding the request.
public abstract java.lang.Object getObject(LyObjectId id)
id
- Object identifier of the searched object.
public int getSize()
public int getSize(LyFilter filter)
filter
- Filter applied on objects for counting.
public int getSize(LyFilter filter, LyClassBinding classBinding)
filter
- Filter applied on objects for counting.classBinding
- Binding between logical class and physical class. This binding may
contain extra information required for encoding the request (such as
extra filter).
public boolean checkObject(LyObjectId objectId)
objectId
- Object id for which an object is searched.
public boolean checkObject(java.lang.Object object)
object
- Checked object.
public LyResponse createObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
object
- Object to create.listener
- Listener of the response.classBinding
- Binding between logical class and physical class. This binding may
contain extra information required for encoding the request.
java.lang.IllegalStateException
- If the data source is in read only mode.public LyResponse setObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
object
- Object to modify.listener
- Listener of the response.classBinding
- Binding between logical class and physical class This binding may
contain extra information required for encoding the request.
java.lang.IllegalStateException
- If the data source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public LyResponse setObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, LyClassBinding classBinding)
objects
- List of objects to modify.listener
- Listener of the response.classBinding
- Binding between logical class and physical class This binding may
contain extra information required for encoding the request.
java.lang.IllegalStateException
- If the data source is in read only mode.
java.lang.IllegalArgumentException
- If given objects list is null or if one of these objects
is invalid.public LyResponse deleteObject(java.lang.Object object, LyResponseListener listener, LyClassBinding classBinding)
object
- Object to delete.listener
- Listener of the response.classBinding
- Binding between logical class and physical class This binding may
contain extra information required for encoding the request.
java.lang.IllegalStateException
- If the data source is in read only mode.
java.lang.IllegalArgumentException
- If the given object is invalid.public LyResponse deleteObjects(java.util.Vector<? extends java.lang.Object> objects, LyResponseListener listener, LyClassBinding classBinding)
objects
- List of objects to delete.listener
- Listener of the response.classBinding
- Binding between logical class and physical class This binding may
contain extra information required for encoding the request.
java.lang.IllegalStateException
- If the data source is in read only mode.
java.lang.IllegalArgumentException
- If given objects list is null or if one of these objects
is invalid.public LyResponse reloadObject(LyObjectId id, java.util.Vector<? extends LyField> fields, LyResponseListener listener, LyClassBinding classBinding)
id
- Object identifier corresponding to the object to reload.fields
- Fields to load (null means all fields).listener
- Listener of the response.classBinding
- binding between logical class and physical class This binding may
contain extra information required for encoding the request.
public LyResponse loadObject(LyObjectId id, java.util.Vector<? extends LyField> fields, LyResponseListener listener, LyClassBinding classBinding)
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 This binding may
contain extra information required for encoding the request.
public LyResponse loadObjects(java.util.Vector<? extends LyField> fields, LySort sort, LyFilter filter, int n, LyResponseListener listener, LyClassBinding classBinding)
fields
- Fields to load (null means all fields).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.classBinding
- binding between logical class and physical class This binding may
contain extra information required for encoding the request.
public void receiveResponse(LyResponse response, LyResponse.Status status, java.lang.Object object, LyValueSet oldValues)
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(java.lang.Object, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
,
setObject(java.lang.Object, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
,
setObjects(java.util.Vector extends java.lang.Object>, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
,
deleteObject(java.lang.Object, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
,
deleteObjects(java.util.Vector extends java.lang.Object>, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
,
loadObject(leon.data.LyObjectId, java.util.Vector extends leon.data.LyField>, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
,
loadObjects(java.util.Vector extends leon.data.LyField>, leon.info.LySort, leon.info.LyFilter, int, leon.data.LyResponseListener, leon.info.binding.LyClassBinding)
public boolean receiveEvent(java.lang.String groupId, LyEventNotifier.EventType type, java.lang.Object object, LyValueSet values)
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 setRollBack(boolean rollBack)
rollBack
- true indicates that a rollback is on the waypublic boolean isRollBack()
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |