2.17.2: 2011-06-17

net.sf.basedb.core
Class Well

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<WellData>
          extended by net.sf.basedb.core.Well
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable

public class Well
extends ChildItem<WellData>
implements Annotatable

A well is located on a Plate and contains a ReporterData. If the plate the well is located on was created from some other plates via a PlateMapping the well also contains a reference back to the parent well on one of the source plates.

Once the well has been saved to the database it cannot be modified, except for annotations.

Version:
2.0
Author:
Nicklas
See Also:
Plate
Last modified
$Date: 2010-04-20 10:02:16 +0200 (Tue, 20 Apr 2010) $

Field Summary
static Item TYPE
          The type of item represented by this class.
 
Constructor Summary
Well(WellData wellData)
           
 
Method Summary
 Set<Annotatable> getAnnotatableParents()
          Get the parent well, if any.
 AnnotationSet getAnnotationSet()
          Get the annotation set containing the annotations for this item.
static Well getById(DbControl dc, int id)
          Get a Well item when you know the id.
 int getColumn()
          Get the column coordinate of this well on the plate.
 Well getParent()
          Get the parent well.
 Plate getPlate()
          Get the Plate this event belongs to.
 Protocol getProtocol()
          A protcol used in the creation of an item that is used to attach annotations for the protocol parameters.
static ItemQuery<Well> getQuery(Plate plate)
          Get a query configured to retrieve wells for a plate.
 ReporterData getReporter()
          Get the reporter in this well.
 ReporterData getReporter(boolean forceInitialization)
          Get the reporter in this well.
 int getRow()
          Get the row coordinate of this well on the plate.
(package private)  SharedData getSharedParent()
          Get the shareable parent item of this child item.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: Child wells Features derived from this well
 boolean isAnnotated()
          Check if this item has an annotation set.
 boolean isUsed()
          Check if: a Feature is linked to this well another Well has this well as it's parent well
 void removeAnnotations()
          Remove all annotations from this item, by deleting the annotation set.
(package private)  void setParent(Well parent)
          Set the parent well.
 void setReporter(ReporterData reporter)
          Set the reporter of this well.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, 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
 

Field Detail

TYPE

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

See Also:
Item.WELL, getType()
Constructor Detail

Well

Well(WellData wellData)
Method Detail

getById

public static Well getById(DbControl dc,
                           int id)
                    throws ItemNotFoundException,
                           PermissionDeniedException,
                           BaseException
Get a Well item when you know the id.

Parameters:
dc - The DbControl which will be used for permission checking and database access.
id - The id of the item to load
Returns:
The Well item
Throws:
ItemNotFoundException - If an item with the specified id is not found
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<Well> getQuery(Plate plate)
                                throws InvalidDataException
Get a query configured to retrieve wells for a plate.

Parameters:
plate - The plate to retreive wells for, null is not allowed
Returns:
An ItemQuery object
Throws:
InvalidDataException - If required parameter is null.
See Also:
Plate.getEvents()

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.

Specified by:
getType in interface Identifiable
Returns:
A value indicating the type of item

getAnnotationSet

public AnnotationSet getAnnotationSet()
                               throws PermissionDeniedException,
                                      BaseException
Description copied from interface: Annotatable
Get the annotation set containing the annotations for this item. If the item doesn't have any annotations a new annotation set is created and automatically saved to the database when DbControl.commit() is called. To check if an item has annotations without creating a new annotation set use the Annotatable.isAnnotated() method.

Specified by:
getAnnotationSet in interface Annotatable
Returns:
An AnnotationSet
Throws:
PermissionDeniedException - If the logged in user doesn't have enough permissions
BaseException - If there is another error

isAnnotated

public boolean isAnnotated()
Description copied from interface: Annotatable
Check if this item has an annotation set. The annotation set may be empty.

Specified by:
isAnnotated in interface Annotatable
Returns:
TRUE if an annotation set exists, FALSE otherwise

removeAnnotations

public void removeAnnotations()
                       throws PermissionDeniedException,
                              BaseException
Description copied from interface: Annotatable
Remove all annotations from this item, by deleting the annotation set.

Specified by:
removeAnnotations in interface Annotatable
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
BaseException - If there is another error

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the parent well, if any.

Specified by:
getAnnotatableParents in interface Annotatable
Returns:
A set containing annotatable items, or null
Throws:
BaseException - If there is an error

getProtocol

public Protocol getProtocol()
Description copied from interface: Annotatable
A protcol used in the creation of an item that is used to attach annotations for the protocol parameters.

Specified by:
getProtocol in interface Annotatable
Returns:
Always null
Since:
2.2

isUsed

public boolean isUsed()
               throws BaseException
Check if:

Overrides:
isUsed in class BasicItem<WellData>
Returns:
TRUE if this item is used, FALSE otherwise
Throws:
BaseException - If not able to tell if item is used or not.
See Also:
BasicItem.getUsingItems()

getUsingItems

public Set<ItemProxy> getUsingItems()
Get all:

getSharedParent

SharedData getSharedParent()
Description copied from class: ChildItem
Get the shareable parent item of this child item. This is used by the ChildItem.initPermissions(int, int) method to calculate the logged in user's permissions for the child item.

Specified by:
getSharedParent in class ChildItem<WellData>
Returns:
The parent item

getPlate

public Plate getPlate()
               throws PermissionDeniedException,
                      BaseException
Get the Plate this event belongs to.

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

getRow

public int getRow()
Get the row coordinate of this well on the plate.


getColumn

public int getColumn()
Get the column coordinate of this well on the plate.


getParent

public Well getParent()
               throws PermissionDeniedException,
                      BaseException
Get the parent well. The parent well is one of the wells on one of the parent plates if the plate this well is on was created by a PlateMapping.

Returns:
A Well item or null if this plate has no parents
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the parent well
BaseException - If there is another error

setParent

void setParent(Well parent)
Set the parent well. Used by PlateMapping when creating new plates from a mapping. This method also sets the reporter to the same reporter as the parent well.


getReporter

public ReporterData getReporter()
                         throws PermissionDeniedException,
                                BaseException
Get the reporter in this well.

Returns:
A ReporterData object or null if no reporter has been specified
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to reporters
BaseException - If there is another error

getReporter

public ReporterData getReporter(boolean forceInitialization)
Get the reporter in this well. The initialization of the reporter can be forced.

Parameters:
forceInitialization - TRUE if the initialization of the reporter should be forced, FALSE otherwise.
Returns:
A ReporterData object or null if no reporter has been specified.
Since:
2.13

setReporter

public void setReporter(ReporterData reporter)
                 throws PermissionDeniedException
Set the reporter of this well.

Parameters:
reporter - The new reporter or null if the reporter is unknown
Throws:
PermissionDeniedException - If this well has been saved to the database or a parent well has been set (in which case the reporter must always be the same as for the parent) or the logged in user doesn't have write permission for the well or use permission for reporters

2.17.2: 2011-06-17