Package net.sf.basedb.core
Class Plate
- All Implemented Interfaces:
AccessControlled
,Annotatable
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
This class is represents physical plates. A plate must have
a
PlateType
, which defines the geometry and possible events
for the plate.
A plate consists of Well
:s which are created at the same
time the plate is created. The wells are organised into rows and
columns as specified by the plate geometry.
A plate is either created directly or as the result of a PlateMapping
operation from other plates. In the first case the
wells must be linked to reporters before the plate is saved. In
the latter case the linking is done automatically from the
source plates.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of the barcode that can be stored in the database.static final Item
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
-
Method Summary
Modifier and TypeMethodDescriptionGet the parent plates, if any.Get the barcode of this plate.static Plate
Get aPlate
item when you know the id.Get a query returning the child plates of this plate.(package private) PlateData
getData()
Get theBasicData
object that holds all data for this item.int
If the plate was created by a plate mapping, this is the index of this plate in the list of created plates.Get the date that the item was registered in the database.getEvent
(PlateEventType eventType) Get the event for the specified event type.Get a query that returns all event types for this plate type.static Plate
Create a newPlate
item.Get a query returning the parent plates of this plate.Get thePlateMapping
used to create this plate.Get thePlateType
of this plate.getQuery()
Get a query that returns plates.Get a query that returns the reporters on this plate.int
getSourceIndex
(Plate parent) If this plate was created by aPlateMapping
and the specified plate is a parent, get the index of the parent plate in the list of source plates used by the plate mapping.getType()
Get the type of item represented by the object.Get all: Child platesArrayDesign
:s using this plategetWell
(int row, int column) Get the well on the specified plate coordinate.getWells()
Get a query returning all wells for this plate.boolean
hasEvent
(PlateEventType eventType) Check if an event for the specified event type has been created for this plate.boolean
Check if the plate has been destroyed.boolean
isUsed()
Check if: anotherPlate
has been created from this one (via aPlateMapping
) anyArrayDesign
:s are using this plate Wells are deleted automatically.void
setBarcode
(String barcode) Set the barcode for the plate.void
setDestroyed
(boolean destroyed) Set the destroyed flag.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.private void
setPlateType
(PlateType plateType) Set the plate type of this plate.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, onBeforeCommit, 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:
-
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:
-
-
Constructor Details
-
Plate
Plate(PlateData plateData)
-
-
Method Details
-
getNew
Create a newPlate
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessplateType
- The type of the new plate- Returns:
- The new
Plate
item - Throws:
PermissionDeniedException
- If the loggged in user doesn't have use permission for the plate typeInvalidDataException
- If the plate type is nullBaseException
- If there is another error
-
getById
public static Plate getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlate
item when you know the id.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.id
- The id of the item to load- Returns:
- The
Plate
item - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission to the itemBaseException
- If there is another error
-
getQuery
Get a query that returns plates.- Returns:
- An
ItemQuery
object
-
getData
PlateData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classAnnotatedItem
-
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
-
getAnnotatableParents
Get the parent plates, if any.- Specified by:
getAnnotatableParents
in interfaceAnnotatable
- Returns:
- A set containing annotatable items, or null
- Throws:
BaseException
- If there is an error
-
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
-
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
Check if:- another
Plate
has been created from this one (via aPlateMapping
) - any
ArrayDesign
:s are using this plate
- Overrides:
isUsed
in classBasicItem
- Returns:
- TRUE if this item is used, FALSE otherwise
- Throws:
BaseException
- If not able to tell if item is used or not.- See Also:
- another
-
getUsingItems
Get all:- Child plates
ArrayDesign
:s using 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
- Since:
- 2.2
- See Also:
-
getPlateType
Get thePlateType
of this plate.- Returns:
- The
PlateType
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plate typeBaseException
- If there is another error
-
setPlateType
private void setPlateType(PlateType plateType) throws PermissionDeniedException, InvalidDataException Set the plate type of this plate.- Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for the plate typeInvalidDataException
- If the plate type is null
-
getPlateMapping
Get thePlateMapping
used to create this plate.- Returns:
- The
PlateMapping
item, or null if this plate was not created using a mapping - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the plate mappingBaseException
- If there is another error
-
getDestinationIndex
public int getDestinationIndex()If the plate was created by a plate mapping, this is the index of this plate in the list of created plates. First plate have index 0. -
getBarcode
Get the barcode of this plate. The barcode is not used by the core and it is not required that it is unique. -
setBarcode
Set the barcode for the plate. Null is allowed but the value can't be longer than the value specified by theMAX_BARCODE_LENGTH
constant. Normally, this should be a unique value among all plates, but the core does not check this.- Parameters:
barcode
- The new barcode for the plate- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the value is too long
-
isDestroyed
public boolean isDestroyed()Check if the plate has been destroyed. A destroyed plate can't be used by aPlateMapping
to create new plates or to createArrayDesign
:s. -
setDestroyed
Set the destroyed flag. A destroyed plate can't be used by aPlateMapping
to create new plates or to createArrayDesign
:s.- 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.
-
getParentPlates
Get a query returning the parent plates of this plate. A plate has parents if it was created by aPlateMapping
.- Returns:
- An
ItemQuery
object
-
getSourceIndex
If this plate was created by aPlateMapping
and the specified plate is a parent, get the index of the parent plate in the list of source plates used by the plate mapping. If the plate is not a parent, -1 is returned.- Parameters:
parent
- The plate to get source index of, if it's a parent. Null is not allowed.- Returns:
- The source index or -1 if the plate is not a parent plate
- Throws:
InvalidDataException
- If the parent is null
-
getChildPlates
Get a query returning the child plates of this plate.- Returns:
- An
ItemQuery
object
-
getEvent
public PlateEvent getEvent(PlateEventType eventType) throws PermissionDeniedException, InvalidDataException, BaseException Get the event for the specified event type. If no event for that type exist a new one is created.- Parameters:
eventType
- The event type to get or create the event for- Returns:
- The
PlateEvent
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission for an existing event or doesn't have write permission if a new event must be createdInvalidDataException
- If the event type is null or doesn't belong to the samePlateType
as the plateBaseException
- If there is another error- See Also:
-
hasEvent
Check if an event for the specified event type has been created for this plate. A plate may only have one event of each type.- Parameters:
eventType
- The event type to check- Returns:
- TRUE if an event of the specified type exists, FALSE otherwise
- See Also:
-
getEvents
Get a query that returns all event types for this plate type.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If there is an error
-
getWell
Get the well on the specified plate coordinate.- Parameters:
row
- The row coordinate of the well. Starting at 0.column
- The column coordinate of the well. Starting at 0.- Returns:
- A
Well
item or null if the coordinates are outside the range specified by the geometry - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission for the wellBaseException
- If there is another error
-
getWells
Get a query returning all wells for this plate.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If there is an error
-
getReporters
Get a query that returns the reporters on this plate. The query is rooted at the wells, which means that:- All filters, sorting, etc. that works for
getWells()
can be used without modifications on this query. - The same reporter may be returned multiple times if it is present on several wells.
- 'Null' values may be returned if there are wells without a reporter
- Returns:
- A
DataQuery
object - Since:
- 2.8
- All filters, sorting, etc. that works for
-