org.castor.persist.resolver
Class OneToManyRelationResolver

java.lang.Object
  extended by org.castor.persist.resolver.ManyRelationResolver
      extended by org.castor.persist.resolver.OneToManyRelationResolver
All Implemented Interfaces:
ResolverStrategy

public class OneToManyRelationResolver
extends ManyRelationResolver

Since:
0.9.9
Author:
Werner Guttmann

Field Summary
 
Fields inherited from class org.castor.persist.resolver.ManyRelationResolver
_classMolder, _debug, _fieldMolder
 
Constructor Summary
OneToManyRelationResolver(ClassMolder classMolder, FieldMolder fieldMolder, boolean debug)
          Creates an instance of OneToMany
 
Method Summary
 boolean markCreate(TransactionContext tx, OID oid, java.lang.Object object)
          Walk the object model and mark object that should be created.
 void markDelete(TransactionContext tx, java.lang.Object object, java.lang.Object field)
          Prepare to delete an object with the specified identity.
 java.lang.Object postCreate(TransactionContext tx, OID oid, java.lang.Object object, java.lang.Object field, java.lang.Object createdId)
          Called after successful creation of an object of the base class.
 UpdateFlags preStore(TransactionContext tx, OID oid, java.lang.Object object, int timeout, java.lang.Object field)
          Check the object for modification.
 void update(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.
 
Methods inherited from class org.castor.persist.resolver.ManyRelationResolver
create, expireCache, load, removeRelation, revertObject, store, updateCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneToManyRelationResolver

public OneToManyRelationResolver(ClassMolder classMolder,
                                 FieldMolder fieldMolder,
                                 boolean debug)
Creates an instance of OneToMany

Parameters:
classMolder -
fieldMolder -
debug -
Method Detail

markCreate

public boolean markCreate(TransactionContext tx,
                          OID oid,
                          java.lang.Object object)
                   throws DuplicateIdentityException,
                          PersistenceException
Description copied from interface: ResolverStrategy
Walk the object model and mark object that should be created.

Specified by:
markCreate in interface ResolverStrategy
Specified by:
markCreate in class ManyRelationResolver
Parameters:
tx - transaction in action
oid - 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:
DuplicateIdentityException
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 ObjectNotFoundException,
                       PersistenceException
Description copied from interface: ResolverStrategy
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.

Specified by:
markDelete in interface ResolverStrategy
Specified by:
markDelete in class ManyRelationResolver
Parameters:
tx - - transaction in action
object - - the target object
field - The field value as returned by the SQLEngine
Throws:
PersistenceException - If it is not possible to successfully complete this method.
ObjectNotFoundException
See Also:
#markDelete(org.castor.persist.TransactionContext, java.lang.Object, java.lang.Object)

preStore

public final UpdateFlags preStore(TransactionContext tx,
                                  OID oid,
                                  java.lang.Object object,
                                  int timeout,
                                  java.lang.Object field)
                           throws PersistenceException
Description copied from interface: ResolverStrategy
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.

Specified by:
preStore in interface ResolverStrategy
Specified by:
preStore in class ManyRelationResolver
Parameters:
tx - transaction in action
oid - the object identity of the object
object - the data object to be checked
timeout - timeout of updating the lock if needed
field - 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 final void update(TransactionContext tx,
                         OID oid,
                         java.lang.Object object,
                         AccessMode suggestedAccessMode,
                         java.lang.Object field)
                  throws PersistenceException,
                         ObjectModifiedException
Description copied from interface: ResolverStrategy
Update the object which loaded or created in the other transaction to the persistent storage.

Specified by:
update in interface ResolverStrategy
Specified by:
update in class ManyRelationResolver
Parameters:
tx - Transaction in action
oid - the object identity of the stored object
object - the object to be stored
suggestedAccessMode - Suggested access mode
field - The field value as returned by the SQLEngine
Throws:
PersistenceException - If it is not possible to successfully complete this method.
ObjectModifiedException
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 final java.lang.Object postCreate(TransactionContext tx,
                                         OID oid,
                                         java.lang.Object object,
                                         java.lang.Object field,
                                         java.lang.Object createdId)
Description copied from interface: ResolverStrategy
Called after successful creation of an object of the base class.

Specified by:
postCreate in interface ResolverStrategy
Specified by:
postCreate in class ManyRelationResolver
Parameters:
tx - transaction in action
oid - the object identity of the object to be created.
object - the object to be created
field - The field value as returned by the SQLEngine
createdId - ???
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)


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com