Last update: 2011-06-23

org.proteios.core
Class BioMaterialEvent<D extends BioMaterialEventData>

java.lang.Object
  extended by org.proteios.core.BasicItem<D>
      extended by org.proteios.core.BioMaterialEvent<D>
All Implemented Interfaces:
AccessControlled, Identifiable
Direct Known Subclasses:
CreationEvent, GelImageAnalysisEvent, GelScanEvent, SeparationEvent, StainingEvent, UpdateEvent

public abstract class BioMaterialEvent<D extends BioMaterialEventData>
extends BasicItem<D>

This class represents an event in the life of a MeasuredBioMaterial. There are two main types of events: creation events, and other events. A creation event is an event that produces a measured biomaterial from other biomaterials. Other events are used to leave a note about something that affected an already existing biomaterial.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Field Summary
static int MAX_COMMENT_LENGTH
          The maximum length of the comment about this event.
static Item TYPE
          The type of item represented by this class.
 
Method Summary
 void addSource(MeasuredBioMaterial bioMaterial, Float usedQuantity)
          Add a source biomaterial to this event or update the used quantity of an existing source.
 MeasuredBioMaterial getBioMaterial()
          Get the single MeasuredBioMaterial that was used for this event.
 String getComment()
          Get the comment about this event.
 Date getEntryDate()
          Get the date this event was added to the database.
 Date getEventDate()
          Get the date this event was done in the lab.
 String getEventType()
          Get the type of event.
 BioMaterialEvent<?> getPreviousBioMaterialEvent()
          This function returns the previous event that is directly linked to this event.
 Protocol getProtocol()
          Get the Protocol describing the procedure used in this event.
static ItemQuery<BioMaterialEvent> getQuery(MeasuredBioMaterial bioMaterial)
          Get a query that returns events for a biomaterial.
 Set<MeasuredBioMaterial> getSourceBioMaterials()
          Get all source biomaterials
 ItemQuery<? extends MeasuredBioMaterial> getSources()
          Get a query that return all biomaterials used as sources for this event.
 Item getType()
          Get the type of item represented by the object.
 Float getUsedQuantityInMicroLiters()
          Get the quantity that was used from the biomaterial by this event.
 Float getUsedQuantityInMicroLiters(MeasuredBioMaterial bioMaterial)
          Get the quantity in microliters that was used by this event for the specified biomaterial.
 User getUser()
          Get the User that is responsible for this event.
 boolean isUsed()
          BioMaterialEvents are not linked to any other items.
 void removeSource(MeasuredBioMaterial bioMaterial)
          Remove a biomaterial used as a source.
protected  void setBioMaterial(MeasuredBioMaterial bioMaterial)
          Set the single biomaterial that was used for this event.
 void setComment(String comment)
          Set the comment about this event.
protected  void setEntryDate(Date entryDate)
          Set the date this event was added to the database.
 void setEventDate(Date eventDate)
          Set the date this event was done in the lab.
 void setPreviousBioMaterialEvent(BioMaterialEvent<?> previousBioMaterialEvent)
          This function sets the previous event that is directly linked to this event.
 void setProtocol(Protocol protocol)
          Set the Protocol that describes the procedure used in this event.
 void setUsedQuantityInMicroLiters(Float usedQuantity)
          Set the used quantity measured in microliters.
protected  void setUser(UserData userData)
          Set the User that is responsible for this event.
 
Methods inherited from class org.proteios.core.BasicItem
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

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

See Also:
Item.BIOMATERIALEVENT, getType()

MAX_COMMENT_LENGTH

public static final int MAX_COMMENT_LENGTH
The maximum length of the comment about this event. Check the length against this value before calling the setComment(String) method to avoid exceptions.

See Also:
Constant Field Values
Method Detail

getQuery

public static ItemQuery<BioMaterialEvent> getQuery(MeasuredBioMaterial bioMaterial)
                                            throws InvalidDataException
Get a query that returns events for a biomaterial. All events where the given biomaterial is either a source or a product are returned.

Parameters:
bioMaterial - The biomaterial to retreive events for, null is not allowed
Returns:
An ItemQuery object
Throws:
InvalidDataException - If the bioMaterial is null
See Also:
MeasuredBioMaterial.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.

Returns:
A value indicating the type of item

isUsed

public boolean isUsed()
               throws BaseException
BioMaterialEvents are not linked to any other items.

Specified by:
isUsed in class BasicItem<D extends BioMaterialEventData>
Returns:
Always false
Throws:
BaseException

getEventType

public String getEventType()
Get the type of event.

See Also:
Type

getBioMaterial

public MeasuredBioMaterial getBioMaterial()
                                   throws PermissionDeniedException,
                                          BaseException
Get the single MeasuredBioMaterial that was used for this event. If multiple biomaterials, getSources is used instead.

Returns:
A MeasuredBioMaterial item or null if this is hybridization event
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the biomaterial
BaseException - If there is another error

setBioMaterial

protected void setBioMaterial(MeasuredBioMaterial bioMaterial)
                       throws PermissionDeniedException,
                              InvalidDataException
Set the single biomaterial that was used for this event. If multiple biomaterials setSources is used instead.

Throws:
PermissionDeniedException
InvalidDataException

setEntryDate

protected void setEntryDate(Date entryDate)
                     throws InvalidDataException
Set the date this event was added to the database.

Throws:
InvalidDataException

getUser

public User getUser()
             throws PermissionDeniedException,
                    BaseException
Get the User that is responsible for this event.

Returns:
A User item
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the user
BaseException - If there is another error

setUser

protected void setUser(UserData userData)
                throws PermissionDeniedException,
                       BaseException
Set the User that is responsible for this event.

Parameters:
userData - A UserData item
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the user
BaseException - If there is another error

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.

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

getUsedQuantityInMicroLiters

public Float getUsedQuantityInMicroLiters()
Get the quantity that was used from the biomaterial by this event. If this is a creation event this value is the negative value of the original quantity of the created biomaterial.


setUsedQuantityInMicroLiters

public void setUsedQuantityInMicroLiters(Float usedQuantity)
                                  throws PermissionDeniedException
Set the used quantity measured in microliters.

Throws:
PermissionDeniedException

getUsedQuantityInMicroLiters

public Float getUsedQuantityInMicroLiters(MeasuredBioMaterial bioMaterial)
Get the quantity in microliters that was used by this event for the specified biomaterial.

Parameters:
bioMaterial - A biomaterial object

addSource

public void addSource(MeasuredBioMaterial bioMaterial,
                      Float usedQuantity)
               throws PermissionDeniedException,
                      InvalidDataException,
                      BaseException
Add a source biomaterial to this event or update the used quantity of an existing source. Sources can only be specified if the produced biomaterial is a pooled biomaterial and this is a creation event.

Parameters:
bioMaterial - The biomaterial used as a source
usedQuantity - The quantity that was used from the source biomaterial, measured in microliters
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for this event of use permission for the source
InvalidDataException - If this is not a creation event or if the produced biomaterial is not pooled or if the source biomaterial is of another type
BaseException - If there is another error

removeSource

public void removeSource(MeasuredBioMaterial bioMaterial)
                  throws PermissionDeniedException,
                         InvalidDataException,
                         BaseException
Remove a biomaterial used as a source. Sources can only be specified if the produced biomaterial is a pooled biomaterial and this is a creation event.

Parameters:
bioMaterial - The biomaterial used as a source
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for this event of use permission for the source
InvalidDataException - If this is not a creation event or if the produced biomaterial is not pooled or if the source biomaterial is of another type
BaseException - If there is another error

getSources

public ItemQuery<? extends MeasuredBioMaterial> getSources()
Get a query that return all biomaterials used as sources for this event.

Returns:
An ItemQuery object

getSourceBioMaterials

public Set<MeasuredBioMaterial> getSourceBioMaterials()
Get all source biomaterials


getComment

public String getComment()
Get the comment about this event.

Returns:
The comment

setComment

public void setComment(String comment)
                throws PermissionDeniedException,
                       InvalidDataException
Set the comment about this event. The value may be null, but mustn't be longer than the value specified by the MAX_COMMENT_LENGTH constant.

Parameters:
comment - The new comment
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission on this event
InvalidDataException - If the comment is too long

getEntryDate

public Date getEntryDate()
Get the date this event was added to the database.

Returns:
A Date object

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.

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

getPreviousBioMaterialEvent

public BioMaterialEvent<?> getPreviousBioMaterialEvent()
This function returns the previous event that is directly linked to this event. It can be used for linking series of separation events and possibly more

Returns:
Returns the previousBioMaterialEvent.

setPreviousBioMaterialEvent

public void setPreviousBioMaterialEvent(BioMaterialEvent<?> previousBioMaterialEvent)
This function sets the previous event that is directly linked to this event. It can be used for linking series of separation events and possibly more

Parameters:
previousBioMaterialEvent - The previousBioMaterialEvent to set.

Last update: 2011-06-23