3.0.4: 2012-03-05

net.sf.basedb.core
Class PhysicalBioAssay

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<PhysicalBioAssayData>
                      extended by net.sf.basedb.core.PhysicalBioAssay
All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Nameable, Ownable, Registered, Removable, Shareable, Subtypable

public class PhysicalBioAssay
extends AnnotatedItem<PhysicalBioAssayData>
implements Registered, Subtypable

A physical bioassay is a representation of the process of performing an experiment one or more Extract:s.

Since:
3.0
Author:
Nicklas
Last modified
$Date$

Field Summary
private  BioPlateEventParticipant bioPlateEventParticipant
           
static String CLONAL_AMPLIFICATION
          The id for the PhysicalBioAssayType item representing a flow cell.
private  BioMaterialEvent creationEvent
           
static String HYBRIDIZATION
          The id for the PhysicalBioAssayType item representing a hybridization.
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
PhysicalBioAssay(PhysicalBioAssayData physicalBioAssayData)
           
 
Method Summary
 long countRootDerivedBioAssays()
          Counts all root derived bioassays that have been created from this physical bioassay.
 Set<Annotatable> getAnnotatableParents()
          Get the extracts and array slide.
 Set<Annotatable> getAnnotatableParents(int position, Extract extract)
          Get the extracts, possible on a specific assay position or only a specific extract, and the array slide.
 ArraySlide getArraySlide()
          Get the ArraySlide this hyridization is using.
static PhysicalBioAssay getById(DbControl dc, int id)
          Get a Hybridization item when you know the id.
 BioMaterialEvent getCreationEvent()
          Get the event that represents the creation of this hybridization.
 ItemQuery<DerivedBioAssay> getDerivedBioAssays()
          Get a query that returns all derived bioassay created from this physical bioassay.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 ItemQuery<Extract> getExtracts(int position)
          Get a query that returns extracts connected to this bioassay.
 ItemSubtype getItemSubtype()
          Get the subtype of the item.
static PhysicalBioAssay getNew(DbControl dc)
          Create a new PhysicalBioAssay item.
static PhysicalBioAssay getNew(DbControl dc, BioPlateEventParticipant master)
          Create a new PhysicalBioAssay item as part of a master bioplate event.
 Protocol getProtocol()
          Get the protocol from the creation event.
static ItemQuery<PhysicalBioAssay> getQuery()
          Get a query that returns physical bioassays.
 ItemQuery<DerivedBioAssay> getRootDerivedBioAssays()
          Get a query that returns all root derived bioassay created from this physical bioassay.
 int getSize()
          Get the size of the bioassay.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get all: (root) DerivedBioAssay:s created from this physical bioassay
 boolean isUsed()
          Check that: No DerivedBioAssay:s use the physical bioassay
(package private)  void onBeforeCommit(Transactional.Action action)
          Make sure the creation event is created at the same time this item is created and that source biomaterials get their used quantities back if this item is deleted.
 void setArraySlide(ArraySlide arraySlide)
          Set the ArraySlide this hybridization is using.
(package private)  void setBioPlateEventParticipant(BioPlateEventParticipant bioPlateEventParticipant)
           
 void setItemSubtype(ItemSubtype subtype)
          Set the subtype on the item.
 void setSize(int size)
          Set the size of the bioassay.
 
Methods inherited from class net.sf.basedb.core.AnnotatedItem
getAnnotationSet, 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.PHYSICALBIOASSAY, getType()

HYBRIDIZATION

public static final String HYBRIDIZATION
The id for the PhysicalBioAssayType item representing a hybridization.

See Also:
Constant Field Values

CLONAL_AMPLIFICATION

public static final String CLONAL_AMPLIFICATION
The id for the PhysicalBioAssayType item representing a flow cell.

See Also:
Constant Field Values

creationEvent

private BioMaterialEvent creationEvent

bioPlateEventParticipant

private BioPlateEventParticipant bioPlateEventParticipant
Constructor Detail

PhysicalBioAssay

PhysicalBioAssay(PhysicalBioAssayData physicalBioAssayData)
Method Detail

getNew

public static PhysicalBioAssay getNew(DbControl dc)
                               throws BaseException
Create a new PhysicalBioAssay item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
Returns:
The new PhysicalBioAssay item
Throws:
BaseException - If there is an error

getNew

public static PhysicalBioAssay getNew(DbControl dc,
                                      BioPlateEventParticipant master)
                               throws BaseException
Create a new PhysicalBioAssay item as part of a master bioplate event.

Parameters:
dc - The DbControl which will be used for permission checking and database access
master - The master bioplate event participant or null
Returns:
The new PhysicalBioAssay item
Throws:
BaseException - If there is an error
Since:
2.17

getById

public static PhysicalBioAssay getById(DbControl dc,
                                       int id)
                                throws ItemNotFoundException,
                                       PermissionDeniedException,
                                       BaseException
Get a Hybridization 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 Hybridization item
Throws:
ItemNotFoundException - If an item with the specified id is not found
PermissionDeniedException - If the logged in user doesn't have read permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<PhysicalBioAssay> getQuery()
Get a query that returns physical bioassays.

Returns:
An ItemQuery object

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

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents()
                                       throws BaseException
Get the extracts and array slide. Note that this method will include all extracts, even on bioassays with multiple positions.

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

getProtocol

public Protocol getProtocol()
Get the protocol from the creation event.

Specified by:
getProtocol in interface Annotatable
Overrides:
getProtocol in class AnnotatedItem<PhysicalBioAssayData>
Returns:
Always null
Since:
2.2

getEntryDate

public Date getEntryDate()
Description copied from interface: Registered
Get the date that the item was registered in the database.

Specified by:
getEntryDate in interface Registered
Returns:
A date or null if this is not known

getItemSubtype

@SubtypableRelatedItems(value={HARDWARE,PROTOCOL,EXTRACT})
public ItemSubtype getItemSubtype()
Description copied from interface: Subtypable
Get the subtype of the item.

Specified by:
getItemSubtype in interface Subtypable
Returns:
A subtype of null if not set
See Also:
SubtypableRelatedItems

setItemSubtype

public void setItemSubtype(ItemSubtype subtype)
Description copied from interface: Subtypable
Set the subtype on the item.

Specified by:
setItemSubtype in interface Subtypable
Parameters:
subtype - A subtype or null
See Also:
ItemSubtype.setOnItem(Subtypable)

isUsed

public boolean isUsed()
               throws BaseException
Check that:

Overrides:
isUsed in class BasicItem<PhysicalBioAssayData>
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:

onBeforeCommit

void onBeforeCommit(Transactional.Action action)
              throws BaseException
Make sure the creation event is created at the same time this item is created and that source biomaterials get their used quantities back if this item is deleted. All events are deleted by cascade mapping in Hibernate.

Overrides:
onBeforeCommit in class SharedItem<PhysicalBioAssayData>
Throws:
BaseException - If there is another error
See Also:
Transactional, Developer documentation: Transactions, Developer documentation: Coding rules and guidelines for item classes

getAnnotatableParents

public Set<Annotatable> getAnnotatableParents(int position,
                                              Extract extract)
                                       throws BaseException
Get the extracts, possible on a specific assay position or only a specific extract, and the array slide.

Parameters:
position - If > 0 only include the extracts on that position in the bioassay (see BioMaterialEventSource.getPosition(). If <= 0 include all extracts.
extract - If not null, only include that extract (if present on the bioassay)
Throws:
BaseException
Since:
3.0

getCreationEvent

public BioMaterialEvent getCreationEvent()
                                  throws PermissionDeniedException,
                                         BaseException
Get the event that represents the creation of this hybridization. Use this event to add source labeled extracts, a protocol, etc.

Returns:
A BioMaterialEvent data.
Throws:
PermissionDeniedException - If the logged in user don't have read permissions
BaseException - If there is another error.

setBioPlateEventParticipant

void setBioPlateEventParticipant(BioPlateEventParticipant bioPlateEventParticipant)

getArraySlide

public ArraySlide getArraySlide()
                         throws PermissionDeniedException,
                                BaseException
Get the ArraySlide this hyridization is using. A single slide can only be used on one hybridization.

Returns:
The ArraySlide item
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the array slide
BaseException - If there is another error.

setArraySlide

public void setArraySlide(ArraySlide arraySlide)
                   throws PermissionDeniedException
Set the ArraySlide this hybridization is using.

Parameters:
arraySlide - The array slide, or null
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for the hybridization or use permission for the array slide
BaseException - If there is another error.

getSize

public int getSize()
Get the size of the bioassay. The size is the number of independent positions for biomaterial. The default value is 1.


setSize

public void setSize(int size)
Set the size of the bioassay.

Parameters:
size - A value > 0
Throws:
NumberOutOfRangeException - If the value is <=0

getExtracts

public ItemQuery<Extract> getExtracts(int position)
Get a query that returns extracts connected to this bioassay.

Parameters:
position - If > 0 only extracts on the specific position are returned by the query, if <= 0, all extracts are returned
Returns:
An ItemQuery object

getDerivedBioAssays

public ItemQuery<DerivedBioAssay> getDerivedBioAssays()
Get a query that returns all derived bioassay created from this physical bioassay.

Returns:
An ItemQuery object

getRootDerivedBioAssays

public ItemQuery<DerivedBioAssay> getRootDerivedBioAssays()
Get a query that returns all root derived bioassay created from this physical bioassay.

Returns:
An ItemQuery object

countRootDerivedBioAssays

public long countRootDerivedBioAssays()
                               throws BaseException
Counts all root derived bioassays that have been created from this physical bioassay. The count includes bioassays that the logged in user doesn't have access to.

Returns:
The number of root bioassay
Throws:
BaseException - If the bioassay could not be counted.

3.0.4: 2012-03-05