Package net.sf.basedb.core
Class MeasuredBioMaterial.RemainingQuantityAction
java.lang.Object
net.sf.basedb.core.MeasuredBioMaterial.RemainingQuantityAction
- All Implemented Interfaces:
TransactionalAction
- Enclosing class:
- MeasuredBioMaterial
static class MeasuredBioMaterial.RemainingQuantityAction extends Object implements TransactionalAction
Transaction handler for updating the remaining quantity of a biomaterial
based on the sum of the used quantity in this transaction.
- Since:
- 3.3
-
Field Summary
Fields Modifier and Type Field Description private MeasuredBioMaterialData
bioMaterial
private static Map<String,MeasuredBioMaterial.RemainingQuantityAction>
cache
We need a single action per DbControl and BioMaterialprivate DbControl
dc
private float
usedQuantity
-
Constructor Summary
Constructors Modifier Constructor Description private
RemainingQuantityAction(DbControl dc, MeasuredBioMaterialData bioMaterial)
-
Method Summary
Modifier and Type Method Description (package private) void
addUsedQuantity(float usedQuantity)
Add some used quantity to what has currently been recorded.(package private) static MeasuredBioMaterial.RemainingQuantityAction
get(DbControl dc, MeasuredBioMaterialData bioMaterial)
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.private void
removeFromCache()
-
Field Details
-
cache
We need a single action per DbControl and BioMaterial -
dc
-
bioMaterial
-
usedQuantity
private float usedQuantity
-
-
Constructor Details
-
RemainingQuantityAction
-
-
Method Details
-
get
static MeasuredBioMaterial.RemainingQuantityAction get(DbControl dc, MeasuredBioMaterialData bioMaterial) -
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
-
removeFromCache
private void removeFromCache() -
addUsedQuantity
void addUsedQuantity(float usedQuantity)Add some used quantity to what has currently been recorded.
-