|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.caleigo.core.ProxyEntity
A ProxyEntity is a basic implementation of the IProxyEntity iterface. The class acts as a proxy to another IEntity object that may set by simple access a methods. All events are forwarded transparently. Note that controlled proxies are transient and will not be serialized.
| Nested Class Summary | |
protected class |
ProxyEntity.ControlledProxyListener
|
| Field Summary |
| Fields inherited from interface org.caleigo.core.IEntity |
DIRTY, EMPTY, PERSISTENT |
| Constructor Summary | |
ProxyEntity(IEntity entity)
Creates new ProxyEntity |
|
ProxyEntity(IEntityDescriptor descriptor)
Creates new ProxyEntity |
|
| Method Summary | |
void |
addEntityChangeListener(IEntityChangeListener listener)
Adds IEntityChangeListener to receive notifications of changes in the entity's status and data content. |
void |
addEntityListener(IEntityListener listener)
Adds IEntityListener to receive notifications of performed data operations on the entity object. |
void |
addProxyListener(IProxyListener listener)
Adds an IProxyListener to receive notifications of changes of the remote object. |
void |
clear()
Clear resets all data in the entity to their defalt values and sets the flags to reflect an empty unchanged data entity. |
void |
clearStatusFlag(int flags)
Should not normally be used by standard API users. |
int |
compareTo(java.lang.Object entity)
Compares all identity data values between the objects if they are of the same type that is are defined by the same entity descriptor. |
void |
copyData(IDataProvider provider)
Copies and replaces the, in the entity, contained data by reading each individual data field as a property from the provided property source. |
void |
delete()
This method will delete the entity from it's related persistent storage. |
void |
doOnRemoteChange()
This method is called each time the remote entity object are replaced. |
boolean |
equals(java.lang.Object entity)
Returns true if the data in all the entities IDENTIY fields are considered equal according to their DataType class. |
boolean |
equalsExactly(java.lang.Object entity)
Compares all data values between the objects if they are of the same type. |
void |
finalizeTransaction(boolean successful)
The finalizeTransaction method is called after a transaction have been fully completed. |
protected void |
fireDataChangedEvent(IFieldDescriptor fieldDescriptor,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires an EntityChangeEvent specifying a data field change to all registered IEntityChangeListener objects. |
protected void |
fireOpPerformedEvent(int opType)
Fires an EntityEvent with the provided operation type to all registered IEntityListener objects. |
protected void |
fireProxyEvent(int eventType)
Fires a ProxyEvent with the provided operation type to all registered IProxyListener objects. |
protected void |
fireStatusChangedEvent(int statusType,
boolean newStatus)
Fires an EntityChangeEvent specifying a status change to all registered IEntityChangeListener objects. |
java.util.Iterator |
getControlledProxies()
Returns an Iterator with all proxies currently controlled by the called controller. |
IControlledProxy |
getControlledProxy(IEntityDescriptor entityDescriptor,
IEntityRelationPath relationPath)
Returns an IControlledProxy object controlled by the called controller. |
protected ProxyEntity.ControlledProxyListener |
getControlledProxyListener()
Help method that returns the selections slave change listener. |
java.lang.Object |
getData(IFieldDescriptor fieldDescriptor)
Returns the data value of the addressed data field. |
java.lang.Object |
getData(java.lang.String codeName)
Access method the returns the identified data from the object. |
IDataSource |
getDataSource()
Returns the data source that the entity object belongs to. |
IEntityDescriptor |
getEntityDescriptor()
Return the entity objects IEntityDescriptor that defines it's type and structure. |
Qualifier |
getOriginQualifier()
Returns a identity qualifier that uniquely qualifies the entity in a persistent storage. |
protected org.caleigo.core.ProxyEntity.RelayListener |
getRelayListener()
Help method that returns the selections relay listener. |
IEntity |
getRemoteEntity()
Access method that returns the remote entity of the proxy. |
IEntity |
getSourceEntity()
Access method that returns the source entity of the proxy. |
protected boolean |
hasDirtyControlledProxies()
|
boolean |
hasRemoteEntity()
Boolean access method that returns true if the proxy has a remote entity if false then getRemoteEntity() will return null. |
boolean |
hasSourceEntity()
Boolean access method that returns true if the proxy has a source entity if false then getSourceEntity() will return null. |
void |
initializeEntity(IEntity entity,
IEntityRelationPath relationPath)
Help method that initializes the data in an entity object based on its relation to the controller. |
boolean |
isDataNull(IFieldDescriptor fieldDescriptor)
Returns true if the addressed entity field is contains a NULL value. |
boolean |
isDirty()
Returns true if any entity field in the entity has been changed since creation or the last syncronization with the persistent storage. |
boolean |
isEmpty()
Returns true for newly creted object that that has had no changes from the default data set at the moment of creation. |
boolean |
isFieldDirty(IFieldDescriptor fieldDescriptor)
Returns true if the addressed entity field has been changed since creation or the last syncronization with the persistent storage. |
boolean |
isPersistent()
Returns true if the the entity reflects data that exists in a related persistent storage. |
protected void |
loadControlledProxies(boolean includeLocalRemote)
|
void |
loadControlledProxiesCallback(int status)
|
void |
prepareControlledLoad(IDataTransaction transaction)
Prepares an transaction to load the proxy-chain structure that is controlled by the called IProxyController. |
void |
prepareControlledStore(IDataTransaction transaction)
Prepares an transaction to store any changes made to the proxy-chain structure that is controlled by the called IProxyController. |
void |
refresh()
This method will refresh the entity with current data from the related persistent storage. |
void |
releaseControlledProxy(IControlledProxy proxy)
Used to inform the controller that a controlled proxy instance will be discarded and gives the controller a chance to deallocate resources connected to it. |
void |
removeEntityChangeListener(IEntityChangeListener listener)
Removes the specified IEntityListener from the entity object. |
void |
removeEntityListener(IEntityListener listener)
Removes the specified IEntityListener from the entity object. |
void |
removeProxyListener(IProxyListener listener)
Removes the specified IProxyListener from the remote object. |
void |
setData(IDataProvider dataProvider)
This method implies to the called object to fetch all data it can consume from the provided IDataProvider object. |
void |
setData(IFieldDescriptor fieldDescriptor,
java.lang.Object data)
Sets the value of the addressed data field. |
void |
setData(java.lang.String codeName,
java.lang.Object dataValue)
Sets the data identified by the provided code name. |
void |
setRemoteEntity(IEntity entity)
Optional mutation method that throws an UnsupportedOperationException if the implementing class does not support the method. |
void |
setStatusFlag(int flags)
Should not normally be used by standard API users. |
void |
store()
This method will store any unsaved changes in the entity to it's realated persistent storage. |
protected void |
storeControlledProxies()
|
java.lang.String |
toString()
Overriden to display the entity description type, identifying data and state of the status flags (D)IRTY, (E)MPTY and (P)ERSISTANT. |
protected void |
updateDirtyState()
|
ValidationResult |
validateData()
Help method that validates the data contained in the called data object and returns a ValidationResult object. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ProxyEntity(IEntityDescriptor descriptor)
public ProxyEntity(IEntity entity)
| Method Detail |
public java.lang.String toString()
public boolean hasRemoteEntity()
hasRemoteEntity in interface IProxyEntitypublic IEntity getRemoteEntity()
getRemoteEntity in interface IProxyEntitypublic boolean hasSourceEntity()
hasSourceEntity in interface IProxyEntitypublic IEntity getSourceEntity()
getSourceEntity in interface IProxyEntitypublic void setRemoteEntity(IEntity entity)
setRemoteEntity in interface IProxyEntitypublic void addProxyListener(IProxyListener listener)
addProxyListener in interface IProxyEntitypublic void removeProxyListener(IProxyListener listener)
removeProxyListener in interface IProxyEntitypublic void store()
store in interface IEntitypublic void delete()
delete in interface IEntitypublic void refresh()
refresh in interface IEntitypublic void copyData(IDataProvider provider)
copyData in interface IEntitypublic boolean equals(java.lang.Object entity)
equals in interface IEntitypublic boolean equalsExactly(java.lang.Object entity)
equalsExactly in interface IEntitypublic boolean isDataNull(IFieldDescriptor fieldDescriptor)
isDataNull in interface IEntitypublic java.lang.Object getData(IFieldDescriptor fieldDescriptor)
getData in interface IEntityInvalidFieldException
public void setData(IFieldDescriptor fieldDescriptor,
java.lang.Object data)
setData in interface IEntityInvalidFieldException
ReadOnlyViolationExceptionpublic void clear()
clear in interface IEntitypublic ValidationResult validateData()
validateData in interface IEntitypublic IEntityDescriptor getEntityDescriptor()
getEntityDescriptor in interface IEntitypublic boolean isFieldDirty(IFieldDescriptor fieldDescriptor)
isFieldDirty in interface IEntitypublic boolean isDirty()
isDirty in interface IEntitypublic boolean isEmpty()
isEmpty in interface IEntitypublic boolean isPersistent()
isPersistent in interface IEntitypublic IDataSource getDataSource()
getDataSource in interface IEntitypublic Qualifier getOriginQualifier()
getOriginQualifier in interface IEntitypublic void setStatusFlag(int flags)
setStatusFlag in interface IEntitypublic void clearStatusFlag(int flags)
clearStatusFlag in interface IEntitypublic void addEntityListener(IEntityListener listener)
addEntityListener in interface IEntitypublic void removeEntityListener(IEntityListener listener)
removeEntityListener in interface IEntitypublic void addEntityChangeListener(IEntityChangeListener listener)
addEntityChangeListener in interface IEntitypublic void removeEntityChangeListener(IEntityChangeListener listener)
removeEntityChangeListener in interface IEntitypublic int compareTo(java.lang.Object entity)
compareTo in interface java.lang.Comparable
public IControlledProxy getControlledProxy(IEntityDescriptor entityDescriptor,
IEntityRelationPath relationPath)
getControlledProxy in interface IProxyControllerpublic void releaseControlledProxy(IControlledProxy proxy)
releaseControlledProxy in interface IProxyControllerpublic java.util.Iterator getControlledProxies()
getControlledProxies in interface IProxyControllerpublic void prepareControlledLoad(IDataTransaction transaction)
prepareControlledLoad in interface IProxyControllerpublic void prepareControlledStore(IDataTransaction transaction)
prepareControlledStore in interface IProxyControllerpublic void finalizeTransaction(boolean successful)
public void initializeEntity(IEntity entity,
IEntityRelationPath relationPath)
initializeEntity in interface IProxyControllerpublic java.lang.Object getData(java.lang.String codeName)
IDataProvider
getData in interface IDataProvider
public void setData(java.lang.String codeName,
java.lang.Object dataValue)
IDataConsumer
setData in interface IDataConsumerpublic void setData(IDataProvider dataProvider)
IDataConsumer
setData in interface IDataConsumerpublic void doOnRemoteChange()
protected boolean hasDirtyControlledProxies()
protected void loadControlledProxies(boolean includeLocalRemote)
throws DataServiceException
DataServiceExceptionpublic void loadControlledProxiesCallback(int status)
protected void storeControlledProxies()
throws DataServiceException
DataServiceExceptionprotected void fireOpPerformedEvent(int opType)
protected void fireDataChangedEvent(IFieldDescriptor fieldDescriptor,
java.lang.Object oldValue,
java.lang.Object newValue)
protected void fireStatusChangedEvent(int statusType,
boolean newStatus)
protected void fireProxyEvent(int eventType)
protected org.caleigo.core.ProxyEntity.RelayListener getRelayListener()
protected ProxyEntity.ControlledProxyListener getControlledProxyListener()
protected void updateDirtyState()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||