net.sf.jzeno.aop
Class AutoSyncSession

java.lang.Object
  extended by net.sf.jzeno.aop.AutoSyncSession

public class AutoSyncSession
extends java.lang.Object

Helper class for autosync functionality. It contains a shadow cache of the elements in the current hibernate session. The hibernate session itself cannot be used for this purpose, because it does not expose the needed functionality.


Constructor Summary
AutoSyncSession()
           
 
Method Summary
 void addOrReplace(Entity entity)
          Add an entity to the session
 void clear()
          clears the objects that are registered and waiting for autosync should be called after autosync of registered entities
 boolean contains(Entity entity)
          Check if this entity identified by it's id is present in the current session.
 Entity getCurrentSessionEntity(Entity entity)
          return the entity registered in the session with the same id as the supplied entity.
 java.util.List getEntitiesToDelete()
           
 java.util.List getEntitiesToSync()
           
 boolean isNew(Entity entity)
           
 boolean isRegisteredForSync(Entity e)
           
 void registerForDelete(Entity entity)
          Add an entity for future reference to be autosynchronized This method will be called in the constructor of an AbstractMutableEntity when the CallByValue aspect is deserializing the parameters.
 void registerForSync(Entity entity)
          Add an entity for future reference to be autosynchronized This method will be called in the constructor of an AbstractMutableEntity when the CallByValue aspect is deserializing the parameters.
 void sync()
          syncs the current items with the hibernate session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoSyncSession

public AutoSyncSession()
Method Detail

contains

public boolean contains(Entity entity)
Check if this entity identified by it's id is present in the current session.

Parameters:
entity -
Returns:
true if entity is part of the session

getCurrentSessionEntity

public Entity getCurrentSessionEntity(Entity entity)
return the entity registered in the session with the same id as the supplied entity.

Parameters:
entity -
Returns:
the entity instance bound in the session

addOrReplace

public void addOrReplace(Entity entity)
Add an entity to the session

Parameters:
entity -
lockMode - the session lockmode of the entity

registerForSync

public void registerForSync(Entity entity)
Add an entity for future reference to be autosynchronized This method will be called in the constructor of an AbstractMutableEntity when the CallByValue aspect is deserializing the parameters.

Parameters:
entity -

registerForDelete

public void registerForDelete(Entity entity)
Add an entity for future reference to be autosynchronized This method will be called in the constructor of an AbstractMutableEntity when the CallByValue aspect is deserializing the parameters.

Parameters:
entity -

getEntitiesToSync

public java.util.List getEntitiesToSync()

getEntitiesToDelete

public java.util.List getEntitiesToDelete()

clear

public void clear()
clears the objects that are registered and waiting for autosync should be called after autosync of registered entities


isNew

public boolean isNew(Entity entity)

sync

public void sync()
syncs the current items with the hibernate session


isRegisteredForSync

public boolean isRegisteredForSync(Entity e)