Class PlateMapping
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
A mapping is specified by a set of source/destination coordinate pairs. A coordinate is specified by plate number, row and column. With this information it is possible to pick wells from the source plates and link them to wells on the destination plates.
It is not required that the mapping is complete, ie. contains a mapping for each destination coordinate. Such destination wells will be marked as empty. A destination coordinate may only be mapped to one source coordinate, but it is possible that one source coordinate is mapped to several destination coordinates.
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- 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 image name 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 TypeMethodDescriptionApply this mapping to the given list of source plates and generate new plates of the specified type.private void
checkCoordinate
(MappingCoordinate c, int plateCount, PlateGeometryData geometry, boolean destination) Checks that the coordinate is within the bouds given by the mapping and geometry.static PlateMapping
Get aPlateMapping
item when you know the id.(package private) PlateMappingData
getData()
Get theBasicData
object that holds all data for this item.int
Get the number of produced destination plates.Get thePlateGeometry
of the created plates.Get the date that the item was registered in the database.getImage()
Get the name of a small image that is a graphical representation of the mapping.static PlateMapping
getNew
(DbControl dc, PlateGeometry sourceGeometry, int sourceCount, PlateGeometry destinationGeometry, int destinationCount) Create a newPlateMapping
item.static ItemQuery<PlateMapping>
getQuery()
Get a query that returns plate mappings.getSourceCoordinate
(MappingCoordinate destinationCoordinate) Get the source coordinate for a given destination coordinate.int
Get the number of required source plates.Get thePlateGeometry
that is required for source plates.getType()
Get the type of item represented by the object.Get all:Plate
:s created with this mappingboolean
isUsed()
Check if: APlate
has been created from this mappingprivate void
setDestinationCount
(int destinationCount) Set the number of produced destination plates.private void
setDestinationGeometry
(PlateGeometry destinationGeometry) Set the destination geometry.void
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.void
Set the name of a small image that is a graphical representation of the mapping.void
setSourceCoordinate
(MappingCoordinate destinationCoordinate, MappingCoordinate sourceCoordinate) Set the source coordinate for a given destination coordinate.private void
setSourceCount
(int sourceCount) Set the number of source plates.private void
setSourceGeometry
(PlateGeometry sourceGeometry) Set the source geometry.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_IMAGE_LENGTH
public static final int MAX_IMAGE_LENGTHThe maximum length of the image name that can be stored in the database. Check the length against this value before calling thesetImage(String)
method to avoid exceptions.- See Also:
-
-
Constructor Details
-
PlateMapping
PlateMapping(PlateMappingData plateMappingData)
-
-
Method Details
-
getNew
public static PlateMapping getNew(DbControl dc, PlateGeometry sourceGeometry, int sourceCount, PlateGeometry destinationGeometry, int destinationCount) throws PermissionDeniedException, InvalidDataException, BaseException Create a newPlateMapping
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accesssourceGeometry
- The required geometry of the source platessourceCount
- The number of source platesdestinationGeometry
- The geometry of the created destination platesdestinationCount
- The number of created destination plates- Returns:
- The new
PlateMapping
item - Throws:
PermissionDeniedException
- If the loggged in user doesn't have use permission for the geometriesInvalidDataException
- If any of the geometries are null, or any of the count values are less than oneBaseException
- If there is another error
-
getById
public static PlateMapping getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlateMapping
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
PlateMapping
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 plate mappings.- Returns:
- An
ItemQuery
object
-
getData
PlateMappingData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classCommonItem
-
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
-
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:- A
Plate
has been created from this mapping
- 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:
- A
-
getUsingItems
Get all:Plate
:s created with this mapping
- 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:
-
getSourceGeometry
Get thePlateGeometry
that is required for source plates.- Returns:
- A
PlateGeometry
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plate geometryBaseException
- If there is another error
-
setSourceGeometry
private void setSourceGeometry(PlateGeometry sourceGeometry) throws PermissionDeniedException, InvalidDataException Set the source geometry.- Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for the geometryInvalidDataException
- If the geometry is null
-
getSourceCount
public int getSourceCount()Get the number of required source plates. -
setSourceCount
Set the number of source plates.- Throws:
InvalidDataException
- If the source count is less than one
-
getDestinationGeometry
Get thePlateGeometry
of the created plates.- Returns:
- A
PlateGeometry
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plate geometryBaseException
- If there is another error
-
setDestinationGeometry
private void setDestinationGeometry(PlateGeometry destinationGeometry) throws PermissionDeniedException, InvalidDataException Set the destination geometry.- Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for the geometryInvalidDataException
- If the geometry is null
-
getDestinationCount
public int getDestinationCount()Get the number of produced destination plates. -
setDestinationCount
Set the number of produced destination plates.- Throws:
InvalidDataException
- If the destination count is less than one
-
getImage
Get the name of a small image that is a graphical representation of the mapping.- Returns:
- The name of an image or null
-
setImage
Set the name of a small image that is a graphical representation of the mapping. Null is allowed but the value can't be longer than the value specified by theMAX_IMAGE_LENGTH
constant.- Parameters:
image
- The name of the image- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the value is too long
-
getSourceCoordinate
Get the source coordinate for a given destination coordinate.- Parameters:
destinationCoordinate
- The destination coordinate- Returns:
- A
MappingCoordinate
object or null if no source coordinate has been specified
-
setSourceCoordinate
public void setSourceCoordinate(MappingCoordinate destinationCoordinate, MappingCoordinate sourceCoordinate) throws PermissionDeniedException, InvalidDataException Set the source coordinate for a given destination coordinate.- Parameters:
destinationCoordinate
- The destination coordinatesourceCoordinate
- The source coordinate, or null to remove the mapping for the destination coordinate- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission or if the mapping has been saved to the databaseInvalidDataException
- If the destination coordinate is null or any of the coordinates are outside the range of valid coordinates as specified by the geometries
-
checkCoordinate
private void checkCoordinate(MappingCoordinate c, int plateCount, PlateGeometryData geometry, boolean destination) throws InvalidDataException Checks that the coordinate is within the bouds given by the mapping and geometry.- Throws:
InvalidDataException
-
apply
public List<Plate> apply(List<Plate> sourcePlates, PlateType destinationPlateType) throws PermissionDeniedException, InvalidDataException, BaseException Apply this mapping to the given list of source plates and generate new plates of the specified type. The source plates must all be of the geometry specified bygetSourceGeometry()
and the destroyed flag mustn't be set. The list must contain exactly the required number of plates as specified by @link #getSourceCount()}. The destination plate type must be of the required destination geometry,getDestinationGeometry()
.The new plates are not saved to the database and doesn't have any names, descriptions or other information. It is up to the client application to fill in this information and save the new plates.
- Parameters:
sourcePlates
- AList
containingPlate
itemsdestinationPlateType
- ThePlateType
of the destination plates- Returns:
- A
List
containing the new (unsaved)Plate
items - Throws:
PermissionDeniedException
- If the logged in user doesn't have use permission for this plate mapping and to all source platesInvalidDataException
- If any of the parameters are invalidBaseException
- If there is another error
-