2.17.2: 2011-06-17

net.sf.basedb.core
Class BioPlateEvent

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<BioPlateEventData>
                  extended by net.sf.basedb.core.BioPlateEvent
All Implemented Interfaces:
AccessControlled, Controlled, Identifiable, Nameable, Ownable, Registered, Removable, Shareable, Transactional

public class BioPlateEvent
extends CommonItem<BioPlateEventData>
implements Registered, Transactional

A bioplate event represents something that happened simultaneously to the biomaterial on one or more bioplates. Individual BioMaterialEvent:s may be linked with a bioplate event. The biomaterial events are then locked and most properties are set on the bioplate event. The description field is mapped to the comment field of the biomaterial events but it is possible to overwrite with a specific comment.

Since:
2.17
Author:
Nicklas
Last modified
$Date: 2010-12-06 13:09:29 +0100 (Mon, 06 Dec 2010) $

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.basedb.core.Transactional
Transactional.Action
 
Field Summary
private  boolean needSynchronize
           
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
BioPlateEvent(BioPlateEventData data)
           
 
Method Summary
 BioPlateEventParticipant addParticipant(BioPlate bioPlate, String role, int index)
          Add a bioplate as a participant in this event.
private  BioPlateEventParticipantData findParticipant(BioPlateData plate)
          Find the participant object for the given bioplate.
 ItemQuery<BioMaterialEvent> getBioMaterialEvents()
          Get a query returning all biomaterial events linked to this event.
static BioPlateEvent getById(DbControl dc, int id)
          Get a BioPlateEvent item when you know the id.
 Date getEntryDate()
          Get the date that the item was registered in the database.
 Date getEventDate()
          Get the date this event was done in the lab.
 BioPlateEventType getEventType()
          Get the event type of this event.
 Hardware getHardware()
          Get the Hardware that was used in this event.
static BioPlateEvent getNew(DbControl dc, BioPlateEventType eventType)
          Create a new BioPlateEvent item.
 BioPlateEventParticipant getParticipant(BioPlate bioPlate)
          Get the participant object representing the given bioplate in this event.
 ItemQuery<BioPlateEventParticipant> getParticipants()
          Get a query returning all participants in the event.
 Protocol getProtocol()
          Get the Protocol describing the procedure used in this event.
static ItemQuery<BioPlateEvent> getQuery()
          Get a query that returns bioplate event items.
 Item getType()
          Get the type of item represented by the object.
 boolean isParticipant(BioPlate plate)
          Check if the given bioplate is a participant of this event.
(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 removeParticipant(BioPlate bioPlate)
          Remove the given bioplate from this event.
 void setDescription(String description)
          Set the description.
 void setEventDate(Date eventDate)
          Set the date this event was done in the lab.
(package private)  void setEventType(BioPlateEventType eventType)
           
 void setHardware(Hardware hardware)
          Set the Hardware that was used in this event.
 void setProtocol(Protocol protocol)
          Set the Protocol that describes the procedure used in this event.
(package private)  void synchronizeAllBioMaterialEvents()
          Synchronize all properties on the child biomaterial events that are related to this event.
(package private)  void synchronizeProperties(BioMaterialEventData event, BioPlateEventParticipantData participant)
          Synchronize all related properties between this event and the biomaterial event.
 
Methods inherited from class net.sf.basedb.core.CommonItem
getDescription, getName, isRemoved, 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, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, 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.BIOPLATEEVENT, getType()

needSynchronize

private boolean needSynchronize
Constructor Detail

BioPlateEvent

BioPlateEvent(BioPlateEventData data)
Method Detail

getNew

public static BioPlateEvent getNew(DbControl dc,
                                   BioPlateEventType eventType)
                            throws BaseException
Create a new BioPlateEvent item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
eventType - The event type of the event (must not be null)
Returns:
The new BioPlateEvent item
Throws:
BaseException - If there is an error

getById

public static BioPlateEvent getById(DbControl dc,
                                    int id)
                             throws ItemNotFoundException,
                                    PermissionDeniedException,
                                    BaseException
Get a BioPlateEvent 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 BioPlateEvent 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<BioPlateEvent> getQuery()
Get a query that returns bioplate event items.

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

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

setDescription

public void setDescription(String description)
                    throws PermissionDeniedException,
                           InvalidDataException
Set the description. This is copied to the comment property on all related biomaterial events that has a null comment (when the transaction is committed)

Specified by:
setDescription in interface Nameable
Overrides:
setDescription in class CommonItem<BioPlateEventData>
Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the Nameable.MAX_DESCRIPTION_LENGTH constant

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<BioPlateEventData>
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

getProtocol

public Protocol getProtocol()
                     throws PermissionDeniedException,
                            BaseException
Get the Protocol describing the procedure used in this event.

Returns:
A Protocol item, or null if not known
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the protocol
BaseException - If there is another error

setProtocol

public void setProtocol(Protocol protocol)
                 throws PermissionDeniedException
Set the Protocol that describes the procedure used in this event. The protocol is also updated on all related biomaterial events (when the transaction is committed).

Parameters:
protocol - A Protocol item, or null if not known
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission on this event or use permission for the protocol

getHardware

public Hardware getHardware()
                     throws PermissionDeniedException,
                            BaseException
Get the Hardware that was used in this event.

Returns:
A Hardware item, or null if not known
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the hardware
BaseException - If there is another error

setHardware

public void setHardware(Hardware hardware)
                 throws PermissionDeniedException
Set the Hardware that was used in this event. The hardware is also updated on all related biomaterial events (when the transaction is committed).

Parameters:
hardware - A Hardware item, or null if not known
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission on this event or use permission for the hardware

getEventDate

public Date getEventDate()
Get the date this event was done in the lab.

Returns:
A Date object, or null if not known

setEventDate

public void setEventDate(Date eventDate)
                  throws PermissionDeniedException
Set the date this event was done in the lab. The date is also updated on all related biomaterial events (when the transaction is committed).

Parameters:
eventDate - The date, or null if not known
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission on this event

getEventType

public BioPlateEventType getEventType()
Get the event type of this event.


setEventType

void setEventType(BioPlateEventType eventType)

isParticipant

public boolean isParticipant(BioPlate plate)
Check if the given bioplate is a participant of this event.

Parameters:
plate - A bioplate
Returns:
TRUE if the plate is a participant, FALSE otherwise

getParticipant

public BioPlateEventParticipant getParticipant(BioPlate bioPlate)
Get the participant object representing the given bioplate in this event.

Parameters:
bioPlate - The bioplate
Returns:
A BioPlateEventParticipant object or null if the bioplate is not a partipant

addParticipant

public BioPlateEventParticipant addParticipant(BioPlate bioPlate,
                                               String role,
                                               int index)
Add a bioplate as a participant in this event. If the bioplate has already been registered as a participant the existing information is updated. The participant object is automatically saved to the database if the bioplate event is already saved or has been put in the commit queue.

Parameters:
bioPlate - The bioplate to add as a participant (null is not allowed)
role - The rolw of the plate
index - The index (if the event requires ordering of the plates)
Returns:
A new or existing bioplate event participant object

removeParticipant

public void removeParticipant(BioPlate bioPlate)
Remove the given bioplate from this event. Removing a participant will automatically unlink related biomaterial events from this event.

Parameters:
bioPlate - The bioplate
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission

getParticipants

public ItemQuery<BioPlateEventParticipant> getParticipants()
Get a query returning all participants in the event.


getBioMaterialEvents

public ItemQuery<BioMaterialEvent> getBioMaterialEvents()
Get a query returning all biomaterial events linked to this event.


findParticipant

private BioPlateEventParticipantData findParticipant(BioPlateData plate)
Find the participant object for the given bioplate.

Parameters:
plate - The bioplate
Returns:
The participant object, or null if the plate isn't a participant

synchronizeAllBioMaterialEvents

void synchronizeAllBioMaterialEvents()
Synchronize all properties on the child biomaterial events that are related to this event.


synchronizeProperties

void synchronizeProperties(BioMaterialEventData event,
                           BioPlateEventParticipantData participant)
Synchronize all related properties between this event and the biomaterial event. If a participant is given, link the biomaterial event to it.


2.17.2: 2011-06-17