LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.peer
Class LyPeerDataSource

java.lang.Object
  extended by leon.data.LyDataSource
      extended by leon.peer.LyPeerDataSource

public class LyPeerDataSource
extends 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.

See Also:
LyClass, LyDataSource

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LyPeerDataSource(LyDataProvider provider, LyClass dataClass)
          Constructs a data source within the given application that manages the specified class.
 
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.
 java.lang.Object getObject(LyObjectId id)
          Gets an object from this data source by the specified identifier.
 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.
 void removeListener(LyDataSourceListener listener)
          Unregisters a listener for notifications from this data source.
 void setCache(LyInfoCache cachePolicy)
          Sets the cache for this data source.
 
Methods inherited from class leon.data.LyDataSource
addListener, checkObject, checkObject, createObject, deleteObject, deleteObjects, getApplication, getCache, getDataClass, getDataProvider, getLastModified, getObject, getSize, isReadOnly, isRollBack, isSynchronous, loadObject, loadObjects, receiveEvent, receiveResponse, reloadObject, setIgnoreErrorOnLoad, setObject, setObjects, setReadOnly, setRollBack, setSynchronous, unload, 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
Constructor Detail

LyPeerDataSource

public LyPeerDataSource(LyDataProvider provider,
                        LyClass dataClass)
Constructs a data source within the given application that manages the specified class.

Parameters:
provider - Provider on which this data source is connected.
dataClass - Class of data handled by this new data source.
Method Detail

setCache

public void setCache(LyInfoCache cachePolicy)
Sets the cache for this data 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 data source is already associated to a cache that contains objects.

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.

getObject

public java.lang.Object getObject(LyObjectId id)
Gets an object from this data 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.

getSize

public int getSize(LyFilter filter)
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.
Returns:
Number of objects matching the given filter in this data source.

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. This binding may contain extra information required for encoding the request (such as extra filter).
Returns:
Number of objects matching the given filter in this data source.

(c) January 2013 - W4 S.A.

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