public abstract class AbstractDataManager extends 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(Object dest,
Object obj)
Copy the proxy state (fields __initialized__ and __detachedState__) from source to target
|
void |
copyUid(Object dest,
Object obj)
Copy the uid field (annotated with
Uid) from source to target |
boolean |
defineProxy(Object dest,
Object obj)
Define the target object as a proxy for the source entity
|
String |
getCacheKey(Object entity)
Return a unique key for the entity to be used in a local cache
|
String |
getDetachedState(Object entity)
Return the persistent detached state of an entity (private field name __detachedState__)
|
Object |
getId(Object entity)
Return the persistent id of an entity (field annotated with
Id) ? |
Object |
getPropertyValue(Object entity,
String name)
Return the value of the property for the specified entity instance
|
Map<String,Object> |
getPropertyValues(Object entity,
boolean excludeVersion,
boolean includeReadOnly)
Return a map of property values for the specified entity instance
|
Map<String,Object> |
getPropertyValues(Object entity,
boolean excludeIdUid,
boolean excludeVersion,
boolean includeReadOnly)
Return a map of property values for the specified entity instance
|
String |
getUid(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 |
Object |
getVersion(Object entity)
Return the version (field annotated with
Version) for an entity |
String |
getVersionPropertyName(Object entity)
Name of the version field for the entity
|
boolean |
hasIdProperty(Object entity)
Has the entity an id field ?
|
boolean |
hasVersionProperty(Object entity)
Has the entity a version field (annotated with
Version) ? |
protected void |
initPersistence() |
boolean |
isDeepDirtyEntity(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(Object entity)
Is the entity instance dirty (modified since last received from server) ?
|
boolean |
isEntity(Object entity)
Is the object an entity (i.e. annotated with
Entity) ? |
boolean |
isInitialized(Object object)
Is the entity initialized (field __initialized__ true) ?
|
boolean |
isLazyProperty(Object entity,
String propertyName)
Is the specified property lazy ?
|
void |
setLazyProperty(Object entity,
String propertyName)
Define a property as lazy
|
void |
setPropertyValue(Object entity,
String name,
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 org.granite.client.persistence.Persistence persistence
public AbstractDataManager()
protected void initPersistence()
public boolean isEntity(Object entity)
DataManagerEntity) ?isEntity in interface DataManagerentity - objectpublic Object getId(Object entity)
DataManagerId) ?getId in interface DataManagerentity - objectpublic boolean hasIdProperty(Object entity)
DataManagerhasIdProperty in interface DataManagerentity - objectpublic String getDetachedState(Object entity)
DataManagergetDetachedState in interface DataManagerentity - objectpublic Object getVersion(Object entity)
DataManagerVersion) for an entitygetVersion in interface DataManagerentity - entitypublic boolean hasVersionProperty(Object entity)
DataManagerVersion) ?hasVersionProperty in interface DataManagerentity - objectpublic String getVersionPropertyName(Object entity)
DataManagergetVersionPropertyName in interface DataManagerentity - objectpublic Object getPropertyValue(Object entity, String name)
DataManagergetPropertyValue in interface DataManagerentity - object instancename - property namepublic void setPropertyValue(Object entity, String name, Object value)
DataManagersetPropertyValue in interface DataManagerentity - object instancename - property namevalue - property valuepublic String getUid(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 String getCacheKey(Object entity)
DataManagergetCacheKey in interface DataManagerentity - entity instancepublic boolean isInitialized(Object object)
DataManagerisInitialized in interface DataManagerobject - entity instancepublic void copyUid(Object dest, Object obj)
DataManagerUid) from source to targetcopyUid in interface DataManagerdest - target objectobj - source entitypublic boolean defineProxy(Object dest, Object obj)
DataManagerdefineProxy in interface DataManagerdest - target objectobj - source entitypublic void copyProxyState(Object dest, Object obj)
DataManagercopyProxyState in interface DataManagerdest - target objectobj - source entitypublic Map<String,Object> getPropertyValues(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 Map<String,Object> getPropertyValues(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(Object entity, String propertyName)
DataManagerLazy or if the
server has returned an initialized valueisLazyProperty in interface DataManagerentity - entity instancepropertyName - property namepublic void setLazyProperty(Object entity, String propertyName)
DataManagersetLazyProperty in interface DataManagerentity - entity instancepropertyName - property namepublic boolean isDirtyEntity(Object entity)
DataManagerisDirtyEntity in interface DataManagerpublic boolean isDeepDirtyEntity(Object entity)
DataManagerisDeepDirtyEntity in interface DataManager