2.17.2: 2011-06-17

net.sf.basedb.core
Class BioPlate

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.OwnedItem<D>
          extended by net.sf.basedb.core.SharedItem<D>
              extended by net.sf.basedb.core.CommonItem<D>
                  extended by net.sf.basedb.core.AnnotatedItem<BioPlateData>
                      extended by net.sf.basedb.core.BioPlate
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable, Ownable, Removable, Shareable

public class BioPlate
extends AnnotatedItem<BioPlateData>

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: 2011-02-09 14:49:51 +0100 (Wed, 09 Feb 2011) $

Field Summary
static int MAX_BARCODE_LENGTH
          The maximum length of the barcode 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
BioPlate(BioPlateData annotatedData)
           
 
Method Summary
 Set<Annotatable> getAnnotatableParents()
          Gets parent plates, always returns null
 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 the BioPlateType 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 all BioWells on this plate.
static BioPlate getById(DbControl dc, int id)
          Gets a BioPlate when knowing the item's id
 int getColumns()
          Get the number of rows on this plate.
 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 plate
 int getFreeWells()
          Get the number of free wells on this plate.
 Hardware getFreezer()
          Gets the freezer associated with this bio plate
static BioPlate getNew(DbControl dc, PlateGeometry plateGeometry)
          Deprecated. In 2.16, use getNew(DbControl, PlateGeometry, BioPlateType) instead Will try to find a bioplate type that is not locked to a specific biomaterial type. If not found an exception is thrown.
static BioPlate getNew(DbControl dc, PlateGeometry geometry, BioPlateType plateType)
          Creates a new bioplate with a specific plate geometry and type.
 PlateGeometry getPlateGeometry()
          Get the PlateGeometry of this bioplate.
static ItemQuery<BioPlate> getQuery()
          Gets query that selects all available bioplates
 int getRows()
          Get the number of rows on this plate.
 int getTotalWells()
          Get the total number of wells on this plate.
 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 all MeasuredBioMaterial 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 any MeasuredBioMaterial 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 barcode
private  void setBioPlateType(BioPlateType plateType)
           
 void setDestroyed(boolean destroyed)
          Set the destroyed flag.
 void setExternalId(String externalId)
          Sets the external id of this bio plate
 void setFreezer(Hardware freezer)
          Sets the freezer where this bio plate is stored
private  void setPlateGeometry(PlateGeometry plateGeometry)
           
 
Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations, toTransferable
 
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, isRemoved, setDescription, setName, setRemoved, toTransferable
 
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, setItemKey, setProjectKey, toTransferable
 
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership, toTransferable
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.BIOPLATE, getType()

MAX_BARCODE_LENGTH

public static final int MAX_BARCODE_LENGTH
The maximum length of the barcode that can be stored in the database. Check the length against this value before calling the setBarcode(String) method to avoid exceptions.

See Also:
Constant Field Values
Constructor Detail

BioPlate

BioPlate(BioPlateData annotatedData)
Method Detail

getNew

public static BioPlate getNew(DbControl dc,
                              PlateGeometry plateGeometry)
                       throws BaseException,
                              InvalidDataException
Deprecated. In 2.16, use getNew(DbControl, PlateGeometry, BioPlateType) instead Will try to find a bioplate type that is not locked to a specific biomaterial type. If not found an exception is thrown.

Throws:
BaseException
InvalidDataException

getNew

public static BioPlate getNew(DbControl dc,
                              PlateGeometry geometry,
                              BioPlateType plateType)
                       throws BaseException,
                              InvalidDataException
Creates a new bioplate with a specific plate geometry and type.

Parameters:
dc - DbControl used for database access
geometry - The geometry the new plate should have
plateType - 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,
                               BaseException
Gets a BioPlate when knowing the item's id

Parameters:
dc - DbControl used for database access
id - The item's id.
Returns:
BioPlate object
Throws:
ItemNotFoundException - If no item with the given id was found
PermissionDeniedException - If logged in user doesn't have enough permission to the requested item
BaseException - If there is another error.

getQuery

public static ItemQuery<BioPlate> getQuery()
Gets query that selects all available bioplates

Returns:
ItemQuery object

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Gets parent plates, always returns null

Returns:
A set containing annotatable items, or null
Throws:
BaseException - If there is an error

getType

public Item 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 the Item enumeration.

Returns:
A value indicating the type of item

isUsed

public boolean isUsed()
Check if there are any MeasuredBioMaterial on this plate.

Overrides:
isUsed in class BasicItem<BioPlateData>
Returns:
TRUE if this item is used, FALSE otherwise
See Also:
BasicItem.getUsingItems()

getUsingItems

public Set<ItemProxy> getUsingItems()
Gets all MeasuredBioMaterial located on this plate and all child plates created from this plate.

Overrides:
getUsingItems in class BasicItem<BioPlateData>
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)

onBeforeCommit

void onBeforeCommit(Transactional.Action action)
              throws NotLoggedInException,
                     BaseException
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 class SharedItem<BioPlateData>
Throws:
NotLoggedInException - If no user is logged in
BaseException - If there is another error
See Also:
Transactional, Core API overview - Transaction handling, Coding rules and guidelines for item classes

getPlateGeometry

public PlateGeometry getPlateGeometry()
                               throws PermissionDeniedException,
                                      BaseException
Get the PlateGeometry of this bioplate.

Returns:
The PlateGeometry item
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission for the plate geometry
BaseException - If there is another error

setPlateGeometry

private void setPlateGeometry(PlateGeometry plateGeometry)
                       throws PermissionDeniedException,
                              InvalidDataException
Throws:
PermissionDeniedException
InvalidDataException

getBioPlateType

public BioPlateType getBioPlateType()
                             throws PermissionDeniedException,
                                    BaseException
Get the BioPlateType of this bioplate.

Returns:
The BioPlateType item
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission for the plate type
BaseException - If there is another error
Since:
2.16

setBioPlateType

private void setBioPlateType(BioPlateType plateType)
                      throws PermissionDeniedException,
                             InvalidDataException
Throws:
PermissionDeniedException
InvalidDataException

setExternalId

public void setExternalId(String externalId)
                   throws PermissionDeniedException,
                          InvalidDataException
Sets the external id of this bio plate

Parameters:
externalId - The external id to set. Null is allowed. Maximum length BioPlateData.MAX_EXTERNAL_ID_LENGTH characters.
Throws:
PermissionDeniedException - If logged in user doesn't have Permission.WRITE on the plate
InvalidDataException - If maximum length of externalId is exceeded.

getExternalId

public String getExternalId()
Gets the external id of this bio plate

Returns:
A String object or null

setBarcode

public void setBarcode(String barcode)
                throws PermissionDeniedException,
                       InvalidDataException
Sets the bio plates barcode

Parameters:
barcode - The barcode to set. Null is allowed. Maximum length BioPlateData.MAX_BARCODE_LENGTH characters.
Throws:
PermissionDeniedException - If logged in user doesn't have Permission.WRITE on the plate.
InvalidDataException - If maximum length of barcode is exceeded.

getBarcode

public String 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

public void setDestroyed(boolean destroyed)
                  throws PermissionDeniedException
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

setFreezer

public void setFreezer(Hardware freezer)
                throws PermissionDeniedException
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 have Permission.WRITE on this bio plate or Permission.USE on the freezer.

getFreezer

public Hardware getFreezer()
Gets the freezer associated with this bio plate

Returns:
A Hardware item or null.

getBioWells

public ItemQuery<BioWell> getBioWells()
Gets a query that returns all BioWells 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

public BioWell getBioWell(int row,
                          int column)
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

public BioWell getBioWell(PlateCoordinate wellC)
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

public MeasuredBioMaterial getBioMaterial(PlateCoordinate wellC)
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

public ItemQuery<BioPlateEvent> getEvents()
Get a query returning events that this plate has been a part of.


2.17.2: 2011-06-17