Strategy pattern to allow for common operations related to field resolution based upon
the type of the field.
create
public Object create(TransactionContext tx,
Object object)
throws PersistenceException
Create an object of the base class with specified identity into the
persistence storage.
tx
- transaction in actionobject
- the object to be created
- the identity of the object
expireCache
public void expireCache(TransactionContext tx,
Object field)
throws PersistenceException
Inspect the fields stored in the object passed as an argument for
contained objects. Request an expireCache for each contained object.
load
public void load(TransactionContext tx,
OID oid,
ProposedEntity proposedObject,
AccessMode suggestedAccessMode)
throws PersistenceException
Load an object with specified identity from the persistent storage.
tx
- the TransactionContext in actionoid
- the object identity of the desired objectproposedObject
- Object holder storing information about assumed and actual object instancessuggestedAccessMode
- the acessMode for the object
markCreate
public boolean markCreate(TransactionContext tx,
OID oid,
Object object)
throws PersistenceException
Walk the object model and mark object that should be created.
tx
- transaction in actionoid
- the object identity of the object to be created.object
- the object to be created
- true if there's objects that should be created
markDelete
public void markDelete(TransactionContext tx,
Object object,
Object field)
throws PersistenceException
Prepare to delete an object with the specified identity. If any sub-object
should be deleted along with the target object, it should be deleted
by this method.
tx
- - transaction in actionobject
- - the target objectfield
- The field value as returned by the SQLEngine
postCreate
public Object postCreate(TransactionContext tx,
OID oid,
Object object,
Object field,
Identity createdId)
throws PersistenceException
Called after successful creation of an object of the base class.
tx
- transaction in actionoid
- the object identity of the object to be created.object
- the object to be createdfield
- The field value as returned by the SQLEnginecreatedId
- ???
- the identity of the object
preStore
public UpdateFlags preStore(TransactionContext tx,
OID oid,
Object object,
int timeout,
Object field)
throws PersistenceException
Check the object for modification. If dpendent object is dereferenced, it
method will remove the object thru the transaction. If an related object
is dereferenced, it method will make sure the formally object will be
dereferenced from the other side as well.
This method is called in prepare (for commit) state of the transaction.
This method indicates if the object needed to be persist or cache should
be update using TransactionContext.markDelete.
tx
- transaction in actionoid
- the object identity of the objectobject
- the data object to be checkedtimeout
- timeout of updating the lock if neededfield
- The field value as returned by the SQLEngine
- true if the object is modified
removeRelation
public UpdateAndRemovedFlags removeRelation(TransactionContext tx,
Object object,
ClassMolder relatedMolder,
Object relatedObject)
Remove the reference of a related object from an object of
the base class.
If the related object is PersistanceCapable, the field will
be set null. If the related object is a Collection, then
the related object will be removed from the Collection.
If any changed occured, transactionContext.markModified
will be called, to indicate the object is modified.
It method will iterate thur all of the object's field and
try to remove all the occurrence.
tx
- the TransactionContext of the transaction in actionobject
- the target object of the base type of this ClassMolderrelatedMolder
- the ClassMolder of the related object to be
removed from the objectrelatedObject
- the object to be removed
- Various flags related to updating/removing object instances.
revertObject
public void revertObject(TransactionContext tx,
OID oid,
Object object,
Object field)
throws PersistenceException
Revert the object back to the state of begining of the transaction
If the object is loaded, it will be revert as it was loaded. If the
object is created, it will be revert as it was just created.
tx
- - transaction in actionoid
- - the object identity of the target objectobject
- - the target objectfield
- The field value as returned by the SQLEngine
store
public Object store(TransactionContext tx,
Object object,
Object field)
throws PersistenceException
Store a data object into the persistent storage of the base class of this
ClassMolder.
tx
- Transaction in actionobject
- the object to be storedfield
- The field value as returned by the SQLEngine
update
public void update(TransactionContext tx,
OID oid,
Object object,
AccessMode suggestedAccessMode,
Object field)
throws PersistenceException
Update the object which loaded or created in the other transaction to
the persistent storage.
tx
- Transaction in actionoid
- the object identity of the stored objectobject
- the object to be storedsuggestedAccessMode
- Suggested access modefield
- The field value as returned by the SQLEngine
updateCache
public Object updateCache(TransactionContext tx,
OID oid,
Object object)
Update the dirty checking cache. This method is called after a transaction
completed successfully.
tx
- - transaction in actionoid
- - object's identity of the target objectobject
- - the target object
- The object tha twas stored in the cache previously.
updateWhenNoTimestampSet
public boolean updateWhenNoTimestampSet(TransactionContext tx,
OID oid,
Object object,
AccessMode suggestedAccessMode)
throws PersistenceException
Update the object which loaded or created in the other transaction to
the persistent storage.
tx
- Transaction in actionoid
- the object identity of the stored objectobject
- the object to be storedsuggestedAccessMode
- Suggested access mode