Packageorg.granite.tide.data
Classpublic class EntityManager

PersistenceContext is the base implementation of the entity container context



Public Properties
 PropertyDefined by
  dirty : Boolean
[read-only] Entity manager is dirty when any entity/collection/map has been modified
EntityManager
  dirtyCheckEnabled : Boolean
[write-only] Enables or disabled dirty checking in this context
EntityManager
  mergeConflicts : Conflicts
[read-only] List of conflicts detected during last merge operation
EntityManager
  savedProperties : Dictionary
[read-only] Current map of saved properties
EntityManager
Public Methods
 MethodDefined by
  
EntityManager
  
clearDirtyState(dispatch:Boolean = true):void
Clear the current dirty state context
EntityManager
  
defaultMerge(em:IEntityManager, obj:Object, dest:Object, mergeUpdate:Boolean = true, expr:IExpression = null, parent:Object = null, propertyName:String = null):void
[static] Default implementation of entity merge for simple ActionScript beans with public properties Can be used to implement Tide managed entities with simple objects
EntityManager
  
getRefs(object:Object):Array
EntityManager
  
Dispatch an event when last merge generated conflicts
EntityManager
  
handleRemovalsAndPersists(removals:Array, persists:Array = null):void
Remove elements from cache and managed collections
EntityManager
  
isEntityChanged(entity:IEntity, propName:String = null, value:* = null):Boolean
Check if entity has changed since last save point
EntityManager
  
isEntityDeepChanged(entity:IEntity):Boolean
EntityManager
  
isEntityPropertyChanged(entity:IEntity, propertyName:String, value:Object):Boolean
Check if entity property has been changed since last remote call
EntityManager
  
isSimple(object:Object):Boolean
[static]
EntityManager
  
mergeExternal(obj:Object, previous:Object = null, expr:IExpression = null, parent:Object = null, propertyName:String = null, setter:Function = null, forceUpdate:Boolean = false):Object
Merge an object coming from the server in the context
EntityManager
  
Merge conversation context variables in global context Only applicable to conversation contexts
EntityManager
  
objectEquals(obj1:Object, obj2:Object):Boolean
Equality for objects, using uid property when possible
EntityManager
  
resetAllEntities(cache:Dictionary):void
Discard changes of all cached entities from last version received from the server
EntityManager
  
resetEntity(entity:IEntity, cache:Dictionary):void
Discard changes of entity from last version received from the server
EntityManager
  
resolveMergeConflicts(modifiedEntity:Object, localEntity:Object, resolving:Boolean):void
EntityManager
Public Constants
 ConstantDefined by
  INITIALIZE : String = "initialize"
[static]
EntityManager
  LOAD_STATE_CHANGE : String = "loadStateChange"
[static]
EntityManager
  UNINITIALIZE : String = "uninitialize"
[static]
EntityManager
Property detail
dirtyproperty
dirty:Boolean  [read-only]

Entity manager is dirty when any entity/collection/map has been modified

Implementation
    public function get dirty():Boolean
dirtyCheckEnabledproperty 
dirtyCheckEnabled:Boolean  [write-only]

Enables or disabled dirty checking in this context

Implementation
    public function set dirtyCheckEnabled(value:Boolean):void
mergeConflictsproperty 
mergeConflicts:Conflicts  [read-only]

List of conflicts detected during last merge operation

Implementation
    public function get mergeConflicts():Conflicts
savedPropertiesproperty 
savedProperties:Dictionary  [read-only]

Current map of saved properties

Implementation
    public function get savedProperties():Dictionary
Constructor detail
EntityManager()constructor
public function EntityManager(context:BaseContext)Parameters
context:BaseContext
Method detail
clearDirtyState()method
public function clearDirtyState(dispatch:Boolean = true):void

Clear the current dirty state context

Parameters
dispatch:Boolean (default = true) — dispatch a PropertyChangeEvent on meta_dirty if the context was dirty before clearing
defaultMerge()method 
public static function defaultMerge(em:IEntityManager, obj:Object, dest:Object, mergeUpdate:Boolean = true, expr:IExpression = null, parent:Object = null, propertyName:String = null):void

Default implementation of entity merge for simple ActionScript beans with public properties Can be used to implement Tide managed entities with simple objects

Parameters
em:IEntityManager — the context
 
obj:Object — source object
 
dest:Object — destination object
 
mergeUpdate:Boolean (default = true) — current path of the entity in the context (mostly for internal use)
 
expr:IExpression (default = null) — owning object
 
parent:Object (default = null) — property name of the owning object
 
propertyName:String (default = null)
getRefs()method 
public function getRefs(object:Object):ArrayParameters
object:Object

Returns
Array
handleMergeConflicts()method 
public function handleMergeConflicts():void

Dispatch an event when last merge generated conflicts

handleRemovalsAndPersists()method 
public function handleRemovalsAndPersists(removals:Array, persists:Array = null):void

Remove elements from cache and managed collections

Parameters
removals:Array — array of entity instances to remove from the cache
 
persists:Array (default = null)
isEntityChanged()method 
public function isEntityChanged(entity:IEntity, propName:String = null, value:* = null):Boolean

Check if entity has changed since last save point

Parameters
entity:IEntity — entity to restore
 
propName:String (default = null) — property name
 
value:* (default = null)

Returns
Boolean — entity is dirty
isEntityDeepChanged()method 
public function isEntityDeepChanged(entity:IEntity):BooleanParameters
entity:IEntity

Returns
Boolean
isEntityPropertyChanged()method 
public function isEntityPropertyChanged(entity:IEntity, propertyName:String, value:Object):Boolean

Check if entity property has been changed since last remote call

Parameters
entity:IEntity — entity to check
 
propertyName:String — property to check
 
value:Object — current value to compare with saved value

Returns
Boolean — true is value has been changed
isSimple()method 
public static function isSimple(object:Object):BooleanParameters
object:Object

Returns
Boolean
mergeExternal()method 
public function mergeExternal(obj:Object, previous:Object = null, expr:IExpression = null, parent:Object = null, propertyName:String = null, setter:Function = null, forceUpdate:Boolean = false):Object

Merge an object coming from the server in the context

Parameters
obj:Object — external object
 
previous:Object (default = null) — previously existing object in the context (null if no existing object)
 
expr:IExpression (default = null) — current path from the context
 
parent:Object (default = null) — parent object for collections
 
propertyName:String (default = null) — property name of the current object in the parent object
 
setter:Function (default = null) — setter function to update the private property
 
forceUpdate:Boolean (default = false) — force update of property (used for externalized properties)

Returns
Object — merged object (should === previous when previous not null)
mergeInContext()method 
public function mergeInContext(context:BaseContext):void

Merge conversation context variables in global context Only applicable to conversation contexts

Parameters
context:BaseContext
objectEquals()method 
public function objectEquals(obj1:Object, obj2:Object):Boolean

Equality for objects, using uid property when possible

Parameters
obj1:Object — object
 
obj2:Object — object

Returns
Boolean — true when objects are instances of the same entity
resetAllEntities()method 
public function resetAllEntities(cache:Dictionary):void

Discard changes of all cached entities from last version received from the server

Parameters
cache:Dictionary
resetEntity()method 
public function resetEntity(entity:IEntity, cache:Dictionary):void

Discard changes of entity from last version received from the server

Parameters
entity:IEntity — entity to restore
 
cache:Dictionary
resolveMergeConflicts()method 
public function resolveMergeConflicts(modifiedEntity:Object, localEntity:Object, resolving:Boolean):voidParameters
modifiedEntity:Object
 
localEntity:Object
 
resolving:Boolean
Constant detail
INITIALIZEconstant
public static const INITIALIZE:String = "initialize"
LOAD_STATE_CHANGEconstant 
public static const LOAD_STATE_CHANGE:String = "loadStateChange"
UNINITIALIZEconstant 
public static const UNINITIALIZE:String = "uninitialize"