Package net.sf.basedb.core
Class DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction
- java.lang.Object
-
- 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 theadd(DerivedBioAssayData)
method. The actual fix is done as a last step before committing the transactiononBeforeCommit()
.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<DerivedBioAssayData>
allModified
private static Map<DbControl,DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction>
cache
private DbControl
dc
-
Constructor Summary
Constructors Modifier Constructor Description private
FixDerivedBioAssayParentsRecursivelyAction(DbControl dc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (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.
-
-
-
Field Detail
-
cache
private static Map<DbControl,DerivedBioAssay.FixDerivedBioAssayParentsRecursivelyAction> cache
-
dc
private final DbControl dc
-
allModified
private final Set<DerivedBioAssayData> allModified
-
-
Constructor Detail
-
FixDerivedBioAssayParentsRecursivelyAction
private 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 interfaceTransactionalAction
-
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 interfaceTransactionalAction
-
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 interfaceTransactionalAction
-
-