3.2.4: 2013-12-06

net.sf.basedb.core
Class DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction

java.lang.Object
  extended by net.sf.basedb.core.DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction
All Implemented Interfaces:
TransactionalAction
Enclosing class:
DerivedBioAssay

static class DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction
extends Object
implements TransactionalAction

Whenever we modify the parent items to a derived bioassay, we must make sure that the physical bioassays for all child items are synchronized with the same changes. This is a bit complicated due to the fact that a single transaction may affect multiple derived bioassays at different levels in the parent-child tree. The fix must be made top-down and must handle accidentally created circular references. Whenever a change is deteced a single instance of this class is associated with the DbControl. All changed derived bioassays are collected with the add(DerivedBioAssayData) method. The actual fix is done as a last step before committing the transaction onBeforeCommit().


Field Summary
private  Set<DerivedBioAssayData> allModified
           
private static Map<DbControl,DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction> cache
           
private  DbControl dc
           
 
Constructor Summary
private DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction(DbControl dc)
           
 
Method Summary
(package private)  void add(DerivedBioAssayData dba)
          Register the given derived bioassay as one that has had it's parent items changed.
(package private) static DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction get(DbControl dc)
          Get an instance tht handles the fixes for the given DbControl.
 void onAfterCommit()
          Called after a successful commit.
 void onBeforeCommit()
          This method is called before the commit is about to happen.
 void onRollback()
          Called after an unsuccessful commit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private static Map<DbControl,DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction> cache

dc

private final DbControl dc

allModified

private final Set<DerivedBioAssayData> allModified
Constructor Detail

DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction

private DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction(DbControl dc)
Method Detail

get

static DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction get(DbControl dc)
Get an instance tht handles the fixes for the given DbControl. If no instance exists yet, a new one is created.


add

void add(DerivedBioAssayData dba)
Register the given derived bioassay as one that has had it's parent items changed.


onBeforeCommit

public void onBeforeCommit()
Description copied from interface: TransactionalAction
This method is called before the commit is about to happen. If this method throws an exception the transaction will be rolled back.

Specified by:
onBeforeCommit in interface TransactionalAction

onAfterCommit

public void onAfterCommit()
Description copied from interface: TransactionalAction
Called after a successful commit. Implementations should not throw any exceptions from this method. If they do, the message is logged, by no other action is taken.

Specified by:
onAfterCommit in interface TransactionalAction

onRollback

public void onRollback()
Description copied from interface: TransactionalAction
Called after an unsuccessful commit. Implementations should not throw any exceptions from this method. If they do, the message is logged, by no other action is taken.

Specified by:
onRollback in interface TransactionalAction

3.2.4: 2013-12-06