Package net.sf.basedb.core
Class BioPlate
- All Implemented Interfaces:
AccessControlled
,Annotatable
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
public class BioPlate extends AnnotatedItem implements Registered
This class is represents physical bio-plates. A bio-plate must have
a
PlateGeometry
A bio-plate consists of BioWell
:s which are organised into rows and
columns as specified by the plate geometry.
- Version:
- 2.10
- Author:
- martin
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_BARCODE_LENGTH
The maximum length of the barcode that can be stored in the database.static int
MAX_POSITION_LENGTH
The maximum length of the position coordinate that can be stored in the database.static int
MAX_SECTION_LENGTH
The maximum length of the section coordinate that can be stored in the database.static int
MAX_TRAY_LENGTH
The maximum length of the tray coordinate that can be stored in the database.static Item
TYPE
The type of item represented by this class.Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
Constructors Constructor Description BioPlate(BioPlateData annotatedData)
-
Method Summary
Modifier and Type Method Description Set<Annotatable>
getAnnotatableParents()
Get the freezer.String
getBarcode()
Gets the barcode of this bio plate.MeasuredBioMaterial
getBioMaterial(PlateCoordinate wellC)
Get the biomaterial in the well at the given location.BioPlateType
getBioPlateType()
Get theBioPlateType
of this bioplate.BioWell
getBioWell(int row, int column)
Gets bio well for specific location.BioWell
getBioWell(PlateCoordinate wellC)
Gets bio well for specific location.ItemQuery<BioWell>
getBioWells()
Gets a query that returns allBioWell
s on this plate.static BioPlate
getById(DbControl dc, int id)
Gets a BioPlate when knowing the item's idint
getColumns()
Get the number of rows on this plate.(package private) BioPlateData
getData()
Get theBasicData
object that holds all data for this item.Date
getEntryDate()
Get the date that the item was registered in the database.Date
getEventDate()
Get the date this plate was created.ItemQuery<BioPlateEvent>
getEvents()
Get a query returning events that this plate has been a part of.String
getExternalId()
Gets the external id of this bio plateint
getFreeWells()
Get the number of free wells on this plate.Hardware
getFreezer()
Gets the storage location of this bio platestatic BioPlate
getNew(DbControl dc, PlateGeometry geometry, BioPlateType plateType)
Creates a new bioplate with a specific plate geometry and type.PlateGeometry
getPlateGeometry()
Get thePlateGeometry
of this bioplate.String
getPosition()
Get the position within the "storage location" for this bioplate.static ItemQuery<BioPlate>
getQuery()
Gets query that selects all available bioplatesint
getRows()
Get the number of rows on this plate.String
getSection()
Get the section within the "storage location" for this bioplate.int
getTotalWells()
Get the total number of wells on this plate.String
getTray()
Get the tray within the "storage location" for this bioplate.Item
getType()
Get the type of item represented by the object.int
getUsedWells()
Get the number of used wells on this plate.Set<ItemProxy>
getUsingItems()
Gets allMeasuredBioMaterial
located on this plate and all child plates created from this plate.boolean
isDestroyed()
Check if the plate has been destroyed.boolean
isUsed()
Check if there are anyMeasuredBioMaterial
on this plate.(package private) void
onBeforeCommit(Transactional.Action action)
If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).void
setBarcode(String barcode)
Sets the bio plates barcodeprivate void
setBioPlateType(BioPlateType plateType)
void
setDestroyed(boolean destroyed)
Set the destroyed flag.void
setEntryDate(Date entryDate)
Set the date the entry was registered in the database.void
setEventDate(Date eventDate)
Set the date this plate was created.void
setExternalId(String externalId)
Sets the external id of this bio platevoid
setFreezer(Hardware freezer)
Sets the freezer where this bio plate is storedprivate void
setPlateGeometry(PlateGeometry plateGeometry)
void
setPosition(String position)
Set the position within the "storage location" for this bioplate.void
setSection(String section)
Set the section within the "storage location" for this bioplate.void
setTray(String tray)
Set the tray within the "storage location" for this bioplate.Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, setItemKey, setProjectKey
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
Item.BIOPLATE
,getType()
-
MAX_BARCODE_LENGTH
public static final int MAX_BARCODE_LENGTHThe maximum length of the barcode that can be stored in the database. Check the length against this value before calling thesetBarcode(String)
method to avoid exceptions.- See Also:
- Constant Field Values
-
MAX_SECTION_LENGTH
public static final int MAX_SECTION_LENGTHThe maximum length of the section coordinate that can be stored in the database. Check the length against this value before calling thesetSection(String)
method to avoid exceptions.- Since:
- 3.2
- See Also:
- Constant Field Values
-
MAX_TRAY_LENGTH
public static final int MAX_TRAY_LENGTHThe maximum length of the tray coordinate that can be stored in the database. Check the length against this value before calling thesetTray(String)
method to avoid exceptions.- Since:
- 3.2
- See Also:
- Constant Field Values
-
MAX_POSITION_LENGTH
public static final int MAX_POSITION_LENGTHThe maximum length of the position coordinate that can be stored in the database. Check the length against this value before calling thesetPosition(String)
method to avoid exceptions.- Since:
- 3.2
- See Also:
- Constant Field Values
-
-
Constructor Details
-
BioPlate
BioPlate(BioPlateData annotatedData)
-
-
Method Details
-
getNew
public static BioPlate getNew(DbControl dc, PlateGeometry geometry, BioPlateType plateType) throws BaseException, InvalidDataExceptionCreates a new bioplate with a specific plate geometry and type.- Parameters:
dc
- DbControl used for database accessgeometry
- The geometry the new plate should haveplateType
- The type of the new plate- Returns:
- A new BioPlate object
- Throws:
BaseException
- If anything goes wrong when creating.InvalidDataException
- If gemoetry or type is null- Since:
- 2.16
-
getById
public static BioPlate getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseExceptionGets a BioPlate when knowing the item's id- Parameters:
dc
- DbControl used for database accessid
- The item's id.- Returns:
BioPlate
object- Throws:
ItemNotFoundException
- If no item with the given id was foundPermissionDeniedException
- If logged in user doesn't have enough permission to the requested itemBaseException
- If there is another error.
-
getQuery
Gets query that selects all available bioplates- Returns:
ItemQuery
object
-
getData
BioPlateData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classAnnotatedItem
-
getAnnotatableParents
Get the freezer.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- A set containing annotatable items, or null
- Throws:
BaseException
- If there is an error
-
getType
Description copied from interface:Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in theItem
enumeration.- Specified by:
getType
in interfaceIdentifiable
- Returns:
- A value indicating the type of item
-
getEntryDate
Description copied from interface:Registered
Get the date that the item was registered in the database.- Specified by:
getEntryDate
in interfaceRegistered
- Returns:
- A date or null if this is not known
- Since:
- 3.1
-
setEntryDate
Description copied from interface:Registered
Set the date the entry was registered in the database. Implementations should only allow this property to be set before the item is first stored in the database. The intention of this method is to facilitate export/import of data between server.- Specified by:
setEntryDate
in interfaceRegistered
- Parameters:
entryDate
- A date or null to use today's date
-
isUsed
public boolean isUsed()Check if there are anyMeasuredBioMaterial
on this plate.- Overrides:
isUsed
in classBasicItem
- Returns:
- TRUE if this item is used, FALSE otherwise
- See Also:
BasicItem.getUsingItems()
-
getUsingItems
Gets allMeasuredBioMaterial
located on this plate and all child plates created from this plate.- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- See Also:
BasicItem.addUsingItems(Set, Item, org.hibernate.query.Query)
-
onBeforeCommit
Description copied from class:SharedItem
If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).- Overrides:
onBeforeCommit
in classSharedItem
- Throws:
NotLoggedInException
- If no user is logged inBaseException
- If there is another error- See Also:
Transactional
, Developer documentation: Transactions, Developer documentation: Coding rules and guidelines for item classes
-
getPlateGeometry
Get thePlateGeometry
of this bioplate.- Returns:
- The
PlateGeometry
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plate geometryBaseException
- If there is another error
-
setPlateGeometry
private void setPlateGeometry(PlateGeometry plateGeometry) throws PermissionDeniedException, InvalidDataException -
getBioPlateType
Get theBioPlateType
of this bioplate.- Returns:
- The
BioPlateType
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plate typeBaseException
- If there is another error- Since:
- 2.16
-
setBioPlateType
private void setBioPlateType(BioPlateType plateType) throws PermissionDeniedException, InvalidDataException -
setExternalId
public void setExternalId(String externalId) throws PermissionDeniedException, InvalidDataExceptionSets the external id of this bio plate- Parameters:
externalId
- The external id to set. Null is allowed. Maximum lengthBioPlateData.MAX_EXTERNAL_ID_LENGTH
characters.- Throws:
PermissionDeniedException
- If logged in user doesn't havePermission.WRITE
on the plateInvalidDataException
- If maximum length of externalId is exceeded.
-
getExternalId
Gets the external id of this bio plate- Returns:
- A String object or null
-
setBarcode
Sets the bio plates barcode- Parameters:
barcode
- The barcode to set. Null is allowed. Maximum lengthBioPlateData.MAX_BARCODE_LENGTH
characters.- Throws:
PermissionDeniedException
- If logged in user doesn't havePermission.WRITE
on the plate.InvalidDataException
- If maximum length of barcode is exceeded.
-
getBarcode
Gets the barcode of this bio plate.- Returns:
- A String object or null.
-
isDestroyed
public boolean isDestroyed()Check if the plate has been destroyed. This is currently only a flag. It doesn't limit what can be done with the plate through the API.- Since:
- 2.16
-
setDestroyed
Set the destroyed flag.- Parameters:
destroyed
- TRUE if the plate is destroyed, FALSE otherwise.- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on the item.- Since:
- 2.16
-
getEventDate
Get the date this plate was created.- Returns:
- A
Date
object, or null if not known - Since:
- 3.1
-
setEventDate
Set the date this plate was created.- Parameters:
eventDate
- The date, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission- Since:
- 3.1
-
setFreezer
Sets the freezer where this bio plate is stored- Parameters:
freezer
- The freezer to set. Null is allowed.- Throws:
PermissionDeniedException
- If logged in user doesn't havePermission.WRITE
on this bio plate orPermission.USE
on the freezer.
-
getFreezer
Gets the storage location of this bio plate- Returns:
- A
Hardware
item or null - See Also:
getSection()
-
getSection
Get the section within the "storage location" for this bioplate.- Returns:
- A string or null
- Since:
- 3.2
-
setSection
Set the section within the "storage location" for this bioplate.- Since:
- 3.2
-
getTray
Get the tray within the "storage location" for this bioplate.- Returns:
- A string or null
- Since:
- 3.2
-
setTray
Set the tray within the "storage location" for this bioplate.- Since:
- 3.2
-
getPosition
Get the position within the "storage location" for this bioplate.- Returns:
- A string or null
- Since:
- 3.2
-
setPosition
Set the position within the "storage location" for this bioplate.- Since:
- 3.2
-
getBioWells
Gets a query that returns allBioWell
s on this plate.- Returns:
- an
ItemQuery
object.
-
getRows
public int getRows()Get the number of rows on this plate. This is a shortcut for getPlateGeometry().getRows()- Since:
- 2.17
-
getColumns
public int getColumns()Get the number of rows on this plate. This is a shortcut for getPlateGeometry().getColumns()- Since:
- 2.17
-
getFreeWells
public int getFreeWells()Get the number of free wells on this plate.- Since:
- 2.17
-
getUsedWells
public int getUsedWells()Get the number of used wells on this plate.- Since:
- 2.17
-
getTotalWells
public int getTotalWells()Get the total number of wells on this plate.- Since:
- 2.17
-
getBioWell
Gets bio well for specific location.- Parameters:
row
- Row index where the bio well is located.column
- Column index where the bio well is located- Returns:
- A
BioWell
object or null if no bio well can be found
-
getBioWell
Gets bio well for specific location.- Parameters:
wellC
- The coordinate of the well- Returns:
- A
BioWell
object or null if no bio well can be found - Since:
- 2.16
-
getBioMaterial
Get the biomaterial in the well at the given location. This method is a shortcut for BioPlate.getBioWell().getBioMaterial().- Parameters:
wellC
- The coordinate of the well- Returns:
- A MeasuredBioMaterial or null if the well doesn't exists or is empty
- Since:
- 2.16
-
getEvents
Get a query returning events that this plate has been a part of.
-