public interface DataManager
| Modifier and Type | Interface and Description |
|---|---|
static class |
DataManager.ChangeKind
Kinds of changes for collections and maps
|
static interface |
DataManager.TrackingHandler
Callback interface for objects that need to be notified when modifications are made on managed entities
|
static class |
DataManager.TrackingType
Types of tracked events
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Reset all currently tracked objects
|
void |
copyProxyState(Object target,
Object source)
Copy the proxy state (fields __initialized__ and __detachedState__) from source to target
|
void |
copyUid(Object target,
Object source)
Copy the uid field (annotated with
Uid) from source to target |
boolean |
defineProxy(Object target,
Object source)
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) ? |
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 |
isDirty()
Is the data manager dirty (any managed entity instance 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 object)
Is the object an entity (i.e. annotated with
Entity) ? |
boolean |
isInitialized(Object entity)
Is the entity initialized (field __initialized__ true) ?
|
boolean |
isLazyProperty(Object entity,
String name)
Is the specified property lazy ?
|
void |
notifyDirtyChange(boolean oldDirty,
boolean dirty)
Notify listeners that the dirty state of this data manager has changed
Called by dirty checking
|
void |
notifyEntityDirtyChange(Object entity,
boolean oldDirtyEntity,
boolean newDirtyEntity)
Notify listeners that the dirty state of the specified has changed
|
void |
setLazyProperty(Object entity,
String name)
Define a property as lazy
|
void |
setPropertyValue(Object entity,
String name,
Object value)
Set the value of the property for the specified entity instance
|
void |
setTrackingHandler(DataManager.TrackingHandler trackingHandler)
Register a handler that will be notified when any managed entity is modified
|
void |
startTracking(Object previous,
Object parent)
Start tracking for the specified object / parent
|
void |
stopTracking(Object previous,
Object parent)
Stop tracking for the specified object / parent
|
boolean isEntity(Object object)
Entity) ?object - objectObject getId(Object entity)
Id) ?entity - objectboolean hasIdProperty(Object entity)
entity - objectString getDetachedState(Object entity)
entity - objectboolean defineProxy(Object target, Object source)
target - target objectsource - source entityvoid copyProxyState(Object target, Object source)
target - target objectsource - source entityvoid copyUid(Object target, Object source)
Uid) from source to targettarget - target objectsource - source entityObject getVersion(Object entity)
Version) for an entityentity - entityboolean hasVersionProperty(Object entity)
Version) ?entity - objectString getVersionPropertyName(Object entity)
entity - objectString getUid(Object entity)
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 presententity - objectMap<String,Object> getPropertyValues(Object entity, boolean excludeIdUid, boolean excludeVersion, boolean includeReadOnly)
entity - 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 mapMap<String,Object> getPropertyValues(Object entity, boolean excludeVersion, boolean includeReadOnly)
entity - object instanceexcludeVersion - true to exclude version field from the mapincludeReadOnly - true to include readonly fields in the mapObject getPropertyValue(Object entity, String name)
entity - object instancename - property namevoid setPropertyValue(Object entity, String name, Object value)
entity - object instancename - property namevalue - property valueboolean isLazyProperty(Object entity, String name)
Lazy or if the
server has returned an initialized valueentity - entity instancename - property namevoid setLazyProperty(Object entity, String name)
entity - entity instancename - property nameString getCacheKey(Object entity)
entity - entity instanceboolean isInitialized(Object entity)
entity - entity instanceboolean isDirty()
boolean isDirtyEntity(Object entity)
boolean isDeepDirtyEntity(Object entity)
void setTrackingHandler(DataManager.TrackingHandler trackingHandler)
trackingHandler - tracking handlervoid startTracking(Object previous, Object parent)
previous - previously existing object in the entity manager cache (null if no existing object)parent - parent object for collectionsvoid stopTracking(Object previous, Object parent)
previous - previously existing object in the entity manager cache (null if no existing object)parent - parent object for collectionsvoid clear()
void notifyDirtyChange(boolean oldDirty, boolean dirty)
oldDirty - old valuedirty - new valueDirtyCheckContextvoid notifyEntityDirtyChange(Object entity, boolean oldDirtyEntity, boolean newDirtyEntity)
entity - entity instanceoldDirtyEntity - old valuenewDirtyEntity - new valueDirtyCheckContext