public class PlateMapping extends CommonItem implements Registered
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.
Plate
,
PlateGeometry
Modifier and Type | Field and Description |
---|---|
static int |
MAX_IMAGE_LENGTH
The maximum length of the image name that can be stored in the
database.
|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
PlateMapping(PlateMappingData plateMappingData) |
Modifier and Type | Method and Description |
---|---|
List<Plate> |
apply(List<Plate> sourcePlates,
PlateType destinationPlateType)
Apply 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 |
getById(DbControl dc,
int id)
Get a
PlateMapping item when you know the id. |
(package private) PlateMappingData |
getData()
Get the
BasicData object that holds all data for this item. |
int |
getDestinationCount()
Get the number of produced destination plates.
|
PlateGeometry |
getDestinationGeometry()
Get the
PlateGeometry of the created plates. |
Date |
getEntryDate()
Get the date that the item was registered in the database.
|
String |
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 new
PlateMapping item. |
static ItemQuery<PlateMapping> |
getQuery()
Get a query that returns plate mappings.
|
MappingCoordinate |
getSourceCoordinate(MappingCoordinate destinationCoordinate)
Get the source coordinate for a given destination coordinate.
|
int |
getSourceCount()
Get the number of required source plates.
|
PlateGeometry |
getSourceGeometry()
Get the
PlateGeometry that is required for source plates. |
Item |
getType()
Get the type of item represented by the object.
|
Set<ItemProxy> |
getUsingItems()
Get all:
Plate :s created with this mapping
|
boolean |
isUsed()
Check if:
A
Plate has been created from this mapping
|
private void |
setDestinationCount(int destinationCount)
Set the number of produced destination plates.
|
private void |
setDestinationGeometry(PlateGeometry destinationGeometry)
Set the destination geometry.
|
void |
setImage(String image)
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.
|
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey
getOwner, isOwner, setOwner, takeOwnership
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
getOwner, isOwner, setOwner, takeOwnership
public static final Item TYPE
Item.PLATEMAPPING
,
getType()
public static final int MAX_IMAGE_LENGTH
setImage(String)
method to avoid exceptions.PlateMapping(PlateMappingData plateMappingData)
public static PlateMapping getNew(DbControl dc, PlateGeometry sourceGeometry, int sourceCount, PlateGeometry destinationGeometry, int destinationCount) throws PermissionDeniedException, InvalidDataException, BaseException
PlateMapping
item.dc
- The DbControl
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 platesPlateMapping
itemPermissionDeniedException
- 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 errorpublic static PlateMapping getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
PlateMapping
item when you know the id.dc
- The DbControl
which will be used for
permission checking and database access.id
- The id of the item to loadPlateMapping
itemItemNotFoundException
- If an item with the specified
id is not foundPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permission to the itemBaseException
- If there is another errorpublic static ItemQuery<PlateMapping> getQuery()
ItemQuery
objectPlateMappingData getData()
BasicItem
BasicData
object that holds all data for this item.getData
in class CommonItem
public Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
public Date getEntryDate()
Registered
getEntryDate
in interface Registered
public boolean isUsed() throws BaseException
Plate
has been created from this mapping
isUsed
in class BasicItem
BaseException
- If not able to tell if item is used or not.BasicItem.getUsingItems()
public Set<ItemProxy> getUsingItems()
Plate
:s created with this mapping
getUsingItems
in class BasicItem
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)
public PlateGeometry getSourceGeometry() throws PermissionDeniedException, BaseException
PlateGeometry
that is required for source plates.PlateGeometry
itemPermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission for the plate geometryBaseException
- If there is another errorprivate void setSourceGeometry(PlateGeometry sourceGeometry) throws PermissionDeniedException, InvalidDataException
PermissionDeniedException
- If the logged in user doesn't have
use permission for the geometryInvalidDataException
- If the geometry is nullpublic int getSourceCount()
private void setSourceCount(int sourceCount) throws InvalidDataException
InvalidDataException
- If the source count is less than onepublic PlateGeometry getDestinationGeometry() throws PermissionDeniedException, BaseException
PlateGeometry
of the created plates.PlateGeometry
itemPermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission for the plate geometryBaseException
- If there is another errorprivate void setDestinationGeometry(PlateGeometry destinationGeometry) throws PermissionDeniedException, InvalidDataException
PermissionDeniedException
- If the logged in user doesn't have
use permission for the geometryInvalidDataException
- If the geometry is nullpublic int getDestinationCount()
private void setDestinationCount(int destinationCount) throws InvalidDataException
InvalidDataException
- If the destination count is less than onepublic String getImage()
public void setImage(String image) throws PermissionDeniedException, InvalidDataException
MAX_IMAGE_LENGTH
constant.image
- The name of the imagePermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the value is too longpublic MappingCoordinate getSourceCoordinate(MappingCoordinate destinationCoordinate)
destinationCoordinate
- The destination coordinateMappingCoordinate
object or null if
no source coordinate has been specifiedpublic void setSourceCoordinate(MappingCoordinate destinationCoordinate, MappingCoordinate sourceCoordinate) throws PermissionDeniedException, InvalidDataException
destinationCoordinate
- The destination coordinatesourceCoordinate
- The source coordinate, or null to remove the mapping
for the destination coordinatePermissionDeniedException
- 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 geometriesprivate void checkCoordinate(MappingCoordinate c, int plateCount, PlateGeometryData geometry, boolean destination) throws InvalidDataException
InvalidDataException
public List<Plate> apply(List<Plate> sourcePlates, PlateType destinationPlateType) throws PermissionDeniedException, InvalidDataException, BaseException
getSourceGeometry()
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.
sourcePlates
- A List
containing Plate
itemsdestinationPlateType
- The PlateType
of the
destination platesList
containing the new (unsaved) Plate
itemsPermissionDeniedException
- 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