Package org.castor.persist.resolver
Class OneToManyRelationResolver
- java.lang.Object
-
- org.castor.persist.resolver.BaseRelationResolver
-
- org.castor.persist.resolver.ManyRelationResolver
-
- org.castor.persist.resolver.OneToManyRelationResolver
-
- All Implemented Interfaces:
ResolverStrategy
public final class OneToManyRelationResolver extends ManyRelationResolver
- Since:
- 0.9.9
- Author:
- Werner Guttmann
-
-
Field Summary
-
Fields inherited from class org.castor.persist.resolver.BaseRelationResolver
_classMolder, _fieldMolder
-
-
Constructor Summary
Constructors Constructor Description OneToManyRelationResolver(ClassMolder classMolder, FieldMolder fieldMolder, int fieldIndex)Creates an instance of OneToMany.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanmarkCreate(TransactionContext tx, OID oid, java.lang.Object object)Walk the object model and mark object that should be created.voidmarkDelete(TransactionContext tx, java.lang.Object object, java.lang.Object field)Prepare to delete an object with the specified identity.java.lang.ObjectpostCreate(TransactionContext tx, OID oid, java.lang.Object object, java.lang.Object field, Identity createdId)Called after successful creation of an object of the base class.UpdateFlagspreStore(TransactionContext tx, OID oid, java.lang.Object object, int timeout, java.lang.Object field)Check the object for modification.voidupdate(TransactionContext tx, OID oid, java.lang.Object object, AccessMode suggestedAccessMode, java.lang.Object field)Update the object which loaded or created in the other transaction to the persistent storage.booleanupdateWhenNoTimestampSet(TransactionContext tx, OID oid, java.lang.Object object, AccessMode suggestedAccessMode)Update the object which loaded or created in the other transaction to the persistent storage.-
Methods inherited from class org.castor.persist.resolver.ManyRelationResolver
create, expireCache, load, removeRelation, revertObject, store, updateCache
-
Methods inherited from class org.castor.persist.resolver.BaseRelationResolver
isCascadingCreate, isCascadingDelete, isCascadingUpdate
-
-
-
-
Constructor Detail
-
OneToManyRelationResolver
public OneToManyRelationResolver(ClassMolder classMolder, FieldMolder fieldMolder, int fieldIndex)
Creates an instance of OneToMany.- Parameters:
classMolder-fieldMolder-fieldIndex- Field index within all fields of parent class molder.
-
-
Method Detail
-
markCreate
public boolean markCreate(TransactionContext tx, OID oid, java.lang.Object object) throws PersistenceException
Description copied from interface:ResolverStrategyWalk the object model and mark object that should be created.- Specified by:
markCreatein interfaceResolverStrategy- Specified by:
markCreatein classManyRelationResolver- Parameters:
tx- transaction in actionoid- the object identity of the object to be created.object- the object to be created- Returns:
- true if there's objects that should be created
- Throws:
PersistenceException- See Also:
#markCreate(org.castor.persist.TransactionContext, org.exolab.castor.persist.OID, java.lang.Object)
-
markDelete
public void markDelete(TransactionContext tx, java.lang.Object object, java.lang.Object field) throws PersistenceException
Description copied from interface:ResolverStrategyPrepare 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.- Specified by:
markDeletein interfaceResolverStrategy- Specified by:
markDeletein classManyRelationResolver- Parameters:
tx- - transaction in actionobject- - the target objectfield- The field value as returned by the SQLEngine- Throws:
PersistenceException- If it is not possible to successfully complete this method.- See Also:
#markDelete(org.castor.persist.TransactionContext, java.lang.Object, java.lang.Object)
-
preStore
public UpdateFlags preStore(TransactionContext tx, OID oid, java.lang.Object object, int timeout, java.lang.Object field) throws PersistenceException
Description copied from interface:ResolverStrategyCheck 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.- Specified by:
preStorein interfaceResolverStrategy- Specified by:
preStorein classManyRelationResolver- Parameters:
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- Returns:
- true if the object is modified
- Throws:
PersistenceException- If it is not possible to successfully complete this method.- See Also:
#preStore(org.castor.persist.TransactionContext, org.exolab.castor.persist.OID, java.lang.Object, int, java.lang.Object)
-
update
public void update(TransactionContext tx, OID oid, java.lang.Object object, AccessMode suggestedAccessMode, java.lang.Object field) throws PersistenceException
Description copied from interface:ResolverStrategyUpdate the object which loaded or created in the other transaction to the persistent storage.- Specified by:
updatein interfaceResolverStrategy- Specified by:
updatein classManyRelationResolver- Parameters:
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- Throws:
PersistenceException- If it is not possible to successfully complete this method.- See Also:
#update(org.castor.persist.TransactionContext, org.exolab.castor.persist.OID, java.lang.Object, org.exolab.castor.mapping.AccessMode, java.lang.Object)
-
postCreate
public java.lang.Object postCreate(TransactionContext tx, OID oid, java.lang.Object object, java.lang.Object field, Identity createdId)
Description copied from interface:ResolverStrategyCalled after successful creation of an object of the base class.- Specified by:
postCreatein interfaceResolverStrategy- Specified by:
postCreatein classManyRelationResolver- Parameters:
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- ???- Returns:
- the identity of the object
- See Also:
#postCreate(org.castor.persist.TransactionContext, org.exolab.castor.persist.OID, org.exolab.castor.persist.DepositBox, java.lang.Object, org.exolab.castor.mapping.AccessMode, java.lang.Object)
-
updateWhenNoTimestampSet
public boolean updateWhenNoTimestampSet(TransactionContext tx, OID oid, java.lang.Object object, AccessMode suggestedAccessMode) throws PersistenceException
Description copied from interface:ResolverStrategyUpdate the object which loaded or created in the other transaction to the persistent storage.- Parameters:
tx- Transaction in actionoid- the object identity of the stored objectobject- the object to be storedsuggestedAccessMode- Suggested access mode- Returns:
- TODO
- Throws:
PersistenceException- If it is not possible to successfully complete this method.
-
-