public interface EntityManager
| Modifier and Type | Interface and Description |
|---|---|
static interface |
EntityManager.Function |
static interface |
EntityManager.Propagation |
static interface |
EntityManager.PropagationPolicy |
static class |
EntityManager.Update
Update received from the server
|
static class |
EntityManager.UpdateKind
Kinds of updates than can be received from the server
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptConflict(Conflict conflict,
boolean acceptClient)
Accept values for conflict
|
void |
addListener(DataConflictListener listener)
Register a listener for data conflicts
|
void |
addReference(Object entity,
Object parent,
String propName)
Register a reference to the provided object with either a parent or res
|
void |
clear()
Clear the current context
Destroys all components/context variables
|
void |
clearCache()
Clear entity cache
|
Object |
getCachedObject(Object object,
boolean nullIfAbsent)
Retrieve an entity in the cache from its uid
|
DataManager |
getDataManager()
Data manager for this entity manager
|
String |
getId()
Return the entity manager id
|
Object[] |
getOwnerEntity(Object object)
Return the owner entity for the specified object (collection/map, embedded object or associated object)
|
Map<String,Object> |
getSavedProperties(Object entity)
Current map of saved properties for the specified entity
|
DataManager.TrackingHandler |
getTrackingHandler()
Tracking handler for this entity manager
|
void |
handleUpdates(MergeContext mergeContext,
String sourceSessionId,
List<EntityManager.Update> updates)
Handle data updates
|
boolean |
initializeObject(ServerSession serverSession,
Object entity,
String propertyName,
Object object)
Trigger remote initialization of lazy-loaded objects
|
MergeContext |
initMerge()
Initialize the merge context in the current thread
MergeContext should be released at the end of the process
|
boolean |
isActive()
Return the entity manager state
|
boolean |
isDeepDirtyEntity(Object entity)
Entity is deep dirty when any element in its object graph has been modified
|
boolean |
isDirty()
Entity manager is dirty when any entity/collection/map has been modified
|
boolean |
isDirtyEntity(Object entity)
Entity is dirty when any direct property has been modified
|
boolean |
isPersisted(Object entity)
Indicates if the entity is persisted on the server (id/version not null/NaN)
|
boolean |
isUninitializeAllowed()
Allow uninitialize of persistent collections ?
|
Object |
mergeExternal(MergeContext mergeContext,
Object obj,
Object previous,
Object parent,
String propertyName,
boolean forceUpdate)
Merge an object in the local context
|
Object |
mergeExternalData(Object obj)
Merge an object coming from a remote location (in general from a service) in the local context
|
Object |
mergeExternalData(Object obj,
Object prev,
String externalDataSessionId,
List<Object> removals,
List<Object> persists)
Merge an object coming from a remote location (in general from a service) in the local context
|
Object |
mergeExternalData(ServerSession serverSession,
Object obj)
Merge an object coming from a remote location (in general from a service) in the local context
|
Object |
mergeExternalData(ServerSession serverSession,
Object obj,
Object prev,
String externalDataSessionId,
List<Object> removals,
List<Object> persists)
Merge an object coming from a remote location (in general from a service) in the local context
|
Object |
mergeFromEntityManager(EntityManager sourceEntityManager,
Object obj,
String externalDataSessionId,
boolean uninitializing)
Merge an object coming from another entity manager (in general in the global context) in the local context
|
void |
mergeInEntityManager(EntityManager entityManager)
Merge conversation entity manager context variables in global entity manager
Only applicable to conversation contexts
|
EntityManager |
newTemporaryEntityManager()
Create a new temporary entity manager
|
void |
raiseUpdateEvents(Context context,
List<EntityManager.Update> updates)
Dispatch update events on the context
|
void |
removeListener(DataConflictListener listener)
Unregister a listener for data conflicts
|
boolean |
removeReference(Object entity,
Object parent,
String propName)
Remove a reference on the provided object
|
void |
resetAllEntities()
Discard changes of all cached entities from last version received from the server
|
void |
resetEntity(Object entity)
Discard changes of entity from last version received from the server
|
void |
setEntityManagerPropagation(EntityManager.Propagation propagation)
Set the propagation manager
|
void |
setRemoteInitializer(RemoteInitializer remoteInitializer)
Setter for the remote initializer implementation
|
void |
setRemoteValidator(RemoteValidator remoteValidator)
Setter for the remote validator implementation
|
void |
setUninitializeAllowed(boolean allowed)
Allow uninitialize of persistent collections
|
boolean |
validateObject(Object object,
String property,
Object value)
Trigger remote validation of objects
|
boolean isActive()
void clearCache()
void clear()
DataManager getDataManager()
DataManager.TrackingHandler getTrackingHandler()
void setUninitializeAllowed(boolean allowed)
allowed - allow uninitialize of collectionsboolean isUninitializeAllowed()
void setRemoteInitializer(RemoteInitializer remoteInitializer)
remoteInitializer - instance of IRemoteInitializervoid setRemoteValidator(RemoteValidator remoteValidator)
remoteValidator - instance of IRemoteValidatorEntityManager newTemporaryEntityManager()
void addReference(Object entity, Object parent, String propName)
entity - an entityparent - the parent entitypropName - name of the parent entity property that references the entityboolean removeReference(Object entity, Object parent, String propName)
entity - an entityparent - the parent entity to dereferencepropName - name of the parent entity property that references the entityboolean isDirty()
boolean isDirtyEntity(Object entity)
entity - boolean isDeepDirtyEntity(Object entity)
entity - root of the entity graphboolean isPersisted(Object entity)
entity - an entityObject getCachedObject(Object object, boolean nullIfAbsent)
object - an entitynullIfAbsent - return null if entity not cached in contextObject[] getOwnerEntity(Object object)
object - an objectMergeContext initMerge()
Object mergeExternal(MergeContext mergeContext, Object obj, Object previous, Object parent, String propertyName, boolean forceUpdate)
mergeContext - current merge contextobj - object to mergeprevious - previous instanceparent - parent/owning entitypropertyName - property name from the owning entityforceUpdate - true to force update of the destination object even if versions do not matchObject mergeExternalData(Object obj, Object prev, String externalDataSessionId, List<Object> removals, List<Object> persists)
obj - external objectprev - existing local object to merge withexternalDataSessionId - sessionId from which the data is coming (other user/server), null if local or current user sessionremovals - list of entities to remove from the entity manager cachepersists - list of entities newly persisted to be added in the entity manager cacheObject mergeExternalData(ServerSession serverSession, Object obj)
serverSession - the current server sessionobj - external objectObject mergeExternalData(ServerSession serverSession, Object obj, Object prev, String externalDataSessionId, List<Object> removals, List<Object> persists)
serverSession - the current server sessionobj - external objectprev - existing local object to merge withexternalDataSessionId - sessionId from which the data is coming (other user/server), null if local or current user sessionremovals - array of entities to remove from the entity manager cachepersists - list of entities newly persisted to be added in the entity manager cacheObject mergeExternalData(Object obj)
obj - external objectObject mergeFromEntityManager(EntityManager sourceEntityManager, Object obj, String externalDataSessionId, boolean uninitializing)
sourceEntityManager - source context of incoming dataobj - external objectexternalDataSessionId - is merge from external datauninitializing - the merge should uninitialize all collections/entities when possiblevoid mergeInEntityManager(EntityManager entityManager)
entityManager - conversation entity managervoid resetEntity(Object entity)
entity - entity to restorevoid resetAllEntities()
Map<String,Object> getSavedProperties(Object entity)
entity - an entityvoid handleUpdates(MergeContext mergeContext, String sourceSessionId, List<EntityManager.Update> updates)
mergeContext - current merge contextsourceSessionId - sessionId from which data updates come (null when from current session)updates - list of data updatesvoid raiseUpdateEvents(Context context, List<EntityManager.Update> updates)
context - tide contextupdates - list of data updatesvoid addListener(DataConflictListener listener)
listener - listenervoid removeListener(DataConflictListener listener)
listener - listenervoid acceptConflict(Conflict conflict, boolean acceptClient)
conflict - conflictacceptClient - true: keep client changes, false: override with server changesboolean initializeObject(ServerSession serverSession, Object entity, String propertyName, Object object)
serverSession - current server sessionentity - owner entitypropertyName - property nameobject - a lazily loaded objectboolean validateObject(Object object, String property, Object value)
object - an object to remotely validateproperty - a property to validatevalue - value to checkvoid setEntityManagerPropagation(EntityManager.Propagation propagation)
propagation - propagation function that will visit child entity managers