public abstract class AbstractDataManager extends java.lang.Object implements DataManager
DataManager.ChangeKind, DataManager.TrackingHandler, DataManager.TrackingType| Modifier and Type | Field and Description |
|---|---|
protected org.granite.client.persistence.Persistence |
persistence |
| Constructor and Description |
|---|
AbstractDataManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
copyProxyState(java.lang.Object dest,
java.lang.Object obj)
Copy the proxy state (fields __initialized__ and __detachedState__) from source to target
|
void |
copyUid(java.lang.Object dest,
java.lang.Object obj)
Copy the uid field (annotated with
Uid) from source to target |
boolean |
defineProxy(java.lang.Object dest,
java.lang.Object obj)
Define the target object as a proxy for the source entity
|
java.lang.String |
getCacheKey(java.lang.Object entity)
Return a unique key for the entity to be used in a local cache
|
java.lang.String |
getDetachedState(java.lang.Object entity)
Return the persistent detached state of an entity (private field name __detachedState__)
|
java.lang.Object |
getId(java.lang.Object entity)
Return the persistent id of an entity (field annotated with
Id) ? |
java.lang.String |
getIdPropertyName(java.lang.Object entity)
Name of the id field for the entity
|
java.lang.Object |
getPropertyValue(java.lang.Object entity,
java.lang.String name)
Return the value of the property for the specified entity instance
|
java.util.Map<java.lang.String,java.lang.Object> |
getPropertyValues(java.lang.Object entity,
boolean excludeVersion,
boolean includeReadOnly)
Return a map of property values for the specified entity instance
|
java.util.Map<java.lang.String,java.lang.Object> |
getPropertyValues(java.lang.Object entity,
boolean excludeIdUid,
boolean excludeVersion,
boolean includeReadOnly)
Return a map of property values for the specified entity instance
|
java.lang.String |
getUid(java.lang.Object entity)
Get the uid field (annotated with
Uid) for the entity
Note that the data manager implementation is allowed to generate a reasonable uid value from other fields
if no uid field is present |
java.lang.String |
getUidPropertyName(java.lang.Object entity)
Name of the uid field for the entity
|
java.lang.Object |
getVersion(java.lang.Object entity)
Return the version (field annotated with
Version) for an entity |
java.lang.String |
getVersionPropertyName(java.lang.Object entity)
Name of the version field for the entity
|
boolean |
hasIdProperty(java.lang.Object entity)
Has the entity an id field ?
|
boolean |
hasProperty(java.lang.Object entity,
java.lang.String name)
Return the value of the property for the specified entity instance
|
boolean |
hasVersionProperty(java.lang.Object entity)
Has the entity a version field (annotated with
Version) ? |
protected void |
initPersistence() |
void |
initProxy(java.lang.Object dest,
java.lang.Object id,
boolean initialized,
java.lang.String detachedState)
Init state of a proxy object
|
boolean |
isDeepDirtyEntity(java.lang.Object entity)
Is the entity graph dirty (any object in the graph of this entity has been modified since last received from server) ?
|
boolean |
isDirtyEntity(java.lang.Object entity)
Is the entity instance dirty (modified since last received from server) ?
|
boolean |
isEntity(java.lang.Object entity)
Is the object an entity (i.e. annotated with
Entity) ? |
boolean |
isInitialized(java.lang.Object object)
Is the entity initialized (field __initialized__ true) ?
|
boolean |
isLazyProperty(java.lang.Object entity,
java.lang.String propertyName)
Is the specified property lazy ?
|
<T> T |
newInstance(java.lang.Object source,
java.lang.Class<T> cast)
Create an empty instance of the same class as the source
|
void |
setInitialized(java.lang.Object object,
boolean initialized) |
void |
setLazyProperty(java.lang.Object entity,
java.lang.String propertyName)
Define a property as lazy
|
void |
setPropertyValue(java.lang.Object entity,
java.lang.String name,
java.lang.Object value)
Set the value of the property for the specified entity instance
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, isDirty, notifyDirtyChange, notifyEntityDirtyChange, setTrackingHandler, startTracking, stopTrackingprotected void initPersistence()
public boolean isEntity(java.lang.Object entity)
DataManagerEntity) ?isEntity in interface DataManagerentity - objectpublic java.lang.Object getId(java.lang.Object entity)
DataManagerId) ?getId in interface DataManagerentity - objectpublic boolean hasIdProperty(java.lang.Object entity)
DataManagerhasIdProperty in interface DataManagerentity - objectpublic java.lang.String getIdPropertyName(java.lang.Object entity)
DataManagergetIdPropertyName in interface DataManagerentity - objectpublic java.lang.String getDetachedState(java.lang.Object entity)
DataManagergetDetachedState in interface DataManagerentity - objectpublic java.lang.Object getVersion(java.lang.Object entity)
DataManagerVersion) for an entitygetVersion in interface DataManagerentity - entitypublic boolean hasVersionProperty(java.lang.Object entity)
DataManagerVersion) ?hasVersionProperty in interface DataManagerentity - objectpublic java.lang.String getVersionPropertyName(java.lang.Object entity)
DataManagergetVersionPropertyName in interface DataManagerentity - objectpublic boolean hasProperty(java.lang.Object entity,
java.lang.String name)
DataManagerhasProperty in interface DataManagerentity - object instancename - property namepublic java.lang.Object getPropertyValue(java.lang.Object entity,
java.lang.String name)
DataManagergetPropertyValue in interface DataManagerentity - object instancename - property namepublic void setPropertyValue(java.lang.Object entity,
java.lang.String name,
java.lang.Object value)
DataManagersetPropertyValue in interface DataManagerentity - object instancename - property namevalue - property valuepublic java.lang.String getUid(java.lang.Object entity)
DataManagerUid) for the entity
Note that the data manager implementation is allowed to generate a reasonable uid value from other fields
if no uid field is presentgetUid in interface DataManagerentity - objectpublic java.lang.String getUidPropertyName(java.lang.Object entity)
DataManagergetUidPropertyName in interface DataManagerentity - objectpublic java.lang.String getCacheKey(java.lang.Object entity)
DataManagergetCacheKey in interface DataManagerentity - entity instancepublic boolean isInitialized(java.lang.Object object)
DataManagerisInitialized in interface DataManagerobject - entity instancepublic void setInitialized(java.lang.Object object,
boolean initialized)
public void copyUid(java.lang.Object dest,
java.lang.Object obj)
DataManagerUid) from source to targetcopyUid in interface DataManagerdest - target objectobj - source entitypublic void initProxy(java.lang.Object dest,
java.lang.Object id,
boolean initialized,
java.lang.String detachedState)
DataManagerinitProxy in interface DataManagerdest - proxy objectid - proxy idinitialized - is initializeddetachedState - detached statepublic boolean defineProxy(java.lang.Object dest,
java.lang.Object obj)
DataManagerdefineProxy in interface DataManagerdest - target objectobj - source entitypublic void copyProxyState(java.lang.Object dest,
java.lang.Object obj)
DataManagercopyProxyState in interface DataManagerdest - target objectobj - source entitypublic java.util.Map<java.lang.String,java.lang.Object> getPropertyValues(java.lang.Object entity,
boolean excludeVersion,
boolean includeReadOnly)
DataManagergetPropertyValues in interface DataManagerentity - object instanceexcludeVersion - true to exclude version field from the mapincludeReadOnly - true to include readonly fields in the mappublic java.util.Map<java.lang.String,java.lang.Object> getPropertyValues(java.lang.Object entity,
boolean excludeIdUid,
boolean excludeVersion,
boolean includeReadOnly)
DataManagergetPropertyValues in interface DataManagerentity - object instanceexcludeIdUid - true to exclude id and uid fields from the mapexcludeVersion - true to exclude version field from the mapincludeReadOnly - true to include readonly fields in the mappublic boolean isLazyProperty(java.lang.Object entity,
java.lang.String propertyName)
DataManagerLazy or if the
server has returned an initialized valueisLazyProperty in interface DataManagerentity - entity instancepropertyName - property namepublic void setLazyProperty(java.lang.Object entity,
java.lang.String propertyName)
DataManagersetLazyProperty in interface DataManagerentity - entity instancepropertyName - property namepublic <T> T newInstance(java.lang.Object source,
java.lang.Class<T> cast)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
DataManagernewInstance in interface DataManagerT - expected typesource - source objectcast - expected typejava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionpublic boolean isDirtyEntity(java.lang.Object entity)
DataManagerisDirtyEntity in interface DataManagerpublic boolean isDeepDirtyEntity(java.lang.Object entity)
DataManagerisDeepDirtyEntity in interface DataManager