public abstract class MeasuredBioMaterial extends BioMaterial implements Registered
The core keeps track of the remaining quantity whenever an item is used to create other items.
As it is, an item can be used when creating another item of the same type
(pooling) or when creating an item of the appropriate subtype, ie.
Sample -> Extract -> LabeledExtract
.
It is also possible to add a note using a BioMaterialEvent
saying that the quantity has been changed and why.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MeasuredBioMaterial.RemainingQuantityAction
Transaction handler for updating the remaining quantity of a biomaterial
based on the sum of the used quantity in this transaction.
|
Modifier and Type | Field and Description |
---|---|
private BioPlateEventParticipant |
bioPlateEventParticipant |
private BioMaterialEvent |
creationEvent |
MAX_EXTERNAL_ID_LENGTH
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
MeasuredBioMaterial(MeasuredBioMaterialData measuredBioMaterialData) |
Modifier and Type | Method and Description |
---|---|
(package private) int |
breakCircularReferences(Set<ItemProxy> items)
Any parent items found among the given items are removed from
the creation event of this item.
|
Set<Annotatable> |
getAnnotatableParents()
Get the biosource or pooled samples and the bioplate
the biomaterial is located on.
|
Set<Annotatable> |
getAnnotatableParents(Collection<? extends MeasuredBioMaterial> parents)
Get the annotable parents, possible only a given set of specific parents items.
|
BioWell |
getBioWell()
Get the well this biomaterial is located in.
|
BioMaterialEvent |
getCreationEvent()
Get the event that represents the creation of this biomaterial.
|
(package private) MeasuredBioMaterialData |
getData()
Get the
BasicData object that holds all data for this item. |
Date |
getEntryDate()
Get the date that the item was registered in the database.
|
ItemQuery<BioMaterialEvent> |
getEvents()
Get a query that returns all events for this biomaterial.
|
ItemSubtype |
getItemSubtype()
Get the subtype of the item.
|
Float |
getOriginalQuantity()
Get the original quantity of the biomaterial.
|
BioMaterial |
getParent()
Get the parent biomaterial if there is a single parent item only.
|
Item |
getParentType()
Get the item type of the parent biomaterial.
|
Protocol |
getProtocol()
Get the protocol from the creation event.
|
Float |
getRemainingQuantity()
Get the remaining quantity of the biomaterial.
|
Set<ItemProxy> |
getUsingItems()
Get all:
BioMaterial :s where this item has been used as a source
|
boolean |
hasSingleParent()
Checks if this biomaterial has a single parent item or not.
|
boolean |
isInWell()
Check if this biomaterial is located in a well on a bioplate or not.
|
boolean |
isLockedInWell()
Check if this biomaterial is placed in a well that it can't be removed from.
|
boolean |
isUsed()
Check that:
no pooled biomaterial has been created from this item
|
BioMaterialEvent |
newEvent()
Create a new event for this biomaterial.
|
BioMaterialEvent |
newEvent(BioPlateEventParticipant master)
Create a new event for this biomaterial that is part of a
master bioplate event.
|
(package private) void |
onBeforeCommit(Transactional.Action action)
Make sure the creation event is created at the same time this item
is created and that source biomaterials get their used quantities back
if this item is deleted.
|
(package private) void |
setBioPlateEventParticipant(BioPlateEventParticipant bioPlateEventParticipant) |
void |
setBioWell(BioWell well)
Sets the
BioWell where this biomaterial is located. |
void |
setEntryDate(Date entryDate)
Set the date the entry was registered in the database.
|
void |
setOriginalQuantity(Float originalQuantity)
Set the original quantity of the biomaterial.
|
private void |
updateFreeWells(BioPlateData plate,
int delta) |
(package private) static void |
updateRemainingQuantity(DbControl dc,
MeasuredBioMaterialData bioMaterial,
Float usedQuantity)
Update the remaining quantity of a biomaterial.
|
countChildren, getById, getChildCreationEvents, getExternalId, setExternalId, setItemSubtype
getAnnotationSet, isAnnotated, removeAnnotations
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
getItemKey, getProjectKey, initPermissions, isShared, setItemKey, setProjectKey
getOwner, isOwner, setOwner, takeOwnership
addAnnotatableParents, addUsingItems, addUsingItems, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getType, getVersion
checkPermission, getPermissions, hasPermission
getDescription, getName, setDescription, setName
getOwner, isOwner, setOwner, takeOwnership
private BioPlateEventParticipant bioPlateEventParticipant
private BioMaterialEvent creationEvent
MeasuredBioMaterial(MeasuredBioMaterialData measuredBioMaterialData)
MeasuredBioMaterialData getData()
BasicItem
BasicData
object that holds all data for this item.getData
in class BioMaterial
public boolean isUsed() throws BaseException
isUsed
in class BasicItem
BaseException
- If not able to tell if item is used or not.BasicItem.getUsingItems()
public Set<ItemProxy> getUsingItems()
BioMaterial
:s where this item has been used as a source
getUsingItems
in class BasicItem
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)
int breakCircularReferences(Set<ItemProxy> items)
breakCircularReferences
in class BasicItem
void onBeforeCommit(Transactional.Action action) throws BaseException
onBeforeCommit
in class SharedItem
BaseException
- If there is another errorTransactional
,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classespublic Protocol getProtocol()
getProtocol
in interface Annotatable
getProtocol
in class AnnotatedItem
public Date getEntryDate()
Registered
getEntryDate
in interface Registered
public void setEntryDate(Date entryDate)
Registered
setEntryDate
in interface Registered
entryDate
- A date or null to use today's datepublic Set<Annotatable> getAnnotatableParents() throws BaseException
getAnnotatableParents
in interface Annotatable
getAnnotatableParents
in class BioMaterial
BaseException
- If there is an errorpublic Set<Annotatable> getAnnotatableParents(Collection<? extends MeasuredBioMaterial> parents) throws BaseException
parents
- If not null or empty, only include the given parent items (for pooled items only)BaseException
@SubtypableRelatedItems(value={PROTOCOL,HARDWARE}) public ItemSubtype getItemSubtype()
Subtypable
getItemSubtype
in interface Subtypable
getItemSubtype
in class BioMaterial
SubtypableRelatedItems
public BioMaterialEvent getCreationEvent() throws PermissionDeniedException, BaseException
BioMaterialEvent
data.PermissionDeniedException
- If logged in user doesn't have read permission on the biomaterial.BaseException
- If there is some other error.void setBioPlateEventParticipant(BioPlateEventParticipant bioPlateEventParticipant)
public Float getOriginalQuantity()
Float
holding the original quantity, or null
if not knownpublic void setOriginalQuantity(Float originalQuantity) throws PermissionDeniedException, InvalidDataException, BaseException
originalQuantity
- The new value for the original quantity, or
null if not knownPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the original quantity is below zeroBaseException
- If there is some other kind of error.public Float getRemainingQuantity()
newEvent()
method to get an event object where you
can specify the used quantity.Float
holding the remaining quantity or null
if not knownstatic void updateRemainingQuantity(DbControl dc, MeasuredBioMaterialData bioMaterial, Float usedQuantity)
usedQuantity
parameter is null or if the remaining
quantity is null.public Item getParentType()
public BioMaterial getParent()
hasSingleParent()
public boolean hasSingleParent()
getParentType()
public BioMaterialEvent newEvent() throws PermissionDeniedException, BaseException
BioMaterialEvent
object.PermissionDeniedException
- If the logged in user doesn't have
use permission for this biomaterialBaseException
- If there is another errorpublic BioMaterialEvent newEvent(BioPlateEventParticipant master) throws PermissionDeniedException, BaseException
BioMaterialEvent
object.PermissionDeniedException
- If the logged in user doesn't have
use permission for this biomaterialBaseException
- If there is another errorpublic ItemQuery<BioMaterialEvent> getEvents()
ItemQuery
objectpublic void setBioWell(BioWell well) throws PermissionDeniedException, BaseException
BioWell
where this biomaterial is located.well
- The BioWell
to set.ItemInUseException
- If the well is already used by another
biomaterialPermissionDeniedException
- If logged in user doesn't have
Permission.WRITE
for this MeasuredBioMaterial or
Permission.USE
for the BioWell.BaseException
- If there is another error.public BioWell getBioWell()
private void updateFreeWells(BioPlateData plate, int delta)
public boolean isInWell()
public boolean isLockedInWell()