|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.BasicItem<D> net.sf.basedb.core.ChildItem<BioMaterialEventData> net.sf.basedb.core.BioMaterialEvent
public class BioMaterialEvent
This class represents an event in the life of a MeasuredBioMaterial
.
There are three main types of events: creation events,
hybridization events and other events. A creation event is an event that
produces a measured biomaterial from other biomaterials. A hybridization event
is an event that produces a hybridization from labeled extracts. Other events
are used to leave a note about something that affected an already existing biomaterial.
Nested Class Summary | |
---|---|
static class |
BioMaterialEvent.Type
The type of the event. |
Field Summary | |
---|---|
private boolean |
hardwareHasBeenSet
|
static int |
MAX_COMMENT_LENGTH
The maximum length of the comment about this event. |
private boolean |
protocolHasBeenSet
|
static Item |
TYPE
The type of item represented by this class. |
Constructor Summary | |
---|---|
BioMaterialEvent(BioMaterialEventData bioMaterialEventData)
|
Method Summary | |
---|---|
void |
addSource(MeasuredBioMaterial bioMaterial,
Float usedQuantity)
Add a source biomaterial to this event or update the used quantity of an existing source. |
private void |
checkAllowedSource(MeasuredBioMaterial bioMaterial)
Check if the biomaterial is allowed as a source. |
(package private) void |
clearSources()
Clear the sources collection and return the used quantities to the source biomaterials. |
MeasuredBioMaterial |
getBioMaterial()
Get the MeasuredBioMaterial that was affected or created by this event. |
BioPlateEventParticipant |
getBioPlateEventParticipant()
Get the bioplate event participant that is the master of this event. |
static BioMaterialEvent |
getById(DbControl dc,
int id)
Get a BioMaterialEvent item when you know the id. |
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. |
BioMaterialEvent.Type |
getEventType()
Get the type of event. |
Hardware |
getHardware()
Get the Hardware that was used in this event. |
Hybridization |
getHybridization()
Get the Hybridization that was created by this event. |
static BioMaterialEvent |
getNew(DbControl dc,
MeasuredBioMaterial bioMaterial)
Create a new BioMaterialEvent of the BioMaterialEvent.Type.OTHER type. |
static BioMaterialEvent |
getNew(DbControl dc,
MeasuredBioMaterial bioMaterial,
BioPlateEventParticipant master)
Create a new BioMaterialEvent of the BioMaterialEvent.Type.OTHER type
that is linked with a master BioPlateEventParticipant . |
(package private) static BioMaterialEvent |
getNewCreationEvent(DbControl dc,
MeasuredBioMaterial bioMaterial,
BioPlateEventParticipant master)
Create a new BioMaterialEvent of the BioMaterialEvent.Type.CREATION
type (creation event). |
(package private) static BioMaterialEvent |
getNewHybridizationEvent(DbControl dc,
Hybridization hybridization,
BioPlateEventParticipant master)
Create a new BioMaterialEvent of the BioMaterialEvent.Type.HYBRIDIZATION
type. |
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. |
(package private) SharedData |
getSharedParent()
Get the shareable parent item of this child item. |
int |
getSourceGroup(MeasuredBioMaterial bioMaterial)
Get the source group of the biomaterial |
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 |
getUsedQuantity()
Get the quantity that was used from the biomaterial by this event. |
Float |
getUsedQuantity(MeasuredBioMaterial bioMaterial)
Get the quantity that was used by this event for the specified biomaterial. |
User |
getUser()
Get the User that is responsible for this event. |
(package private) void |
initPermissions(int granted,
int denied)
READ permission is granted and DELETE permissions is denied to evereyone for creation events. |
boolean |
isPlateEvent()
Check if this event is related with a bioplate event. |
(package private) void |
onBeforeCommit(Transactional.Action action)
Return used guantity to biomaterials on delete action. |
void |
removeSource(MeasuredBioMaterial bioMaterial)
Remove a biomaterial used as a source. |
private void |
setBioMaterial(MeasuredBioMaterial bioMaterial)
Set the biomaterial that was affected or created by this event. |
void |
setComment(String comment)
Set the comment about this event. |
void |
setEventDate(Date eventDate)
Set the date this event was done in the lab. |
void |
setHardware(Hardware hardware)
Get the Hardware that was used in this event. |
private void |
setHybridization(Hybridization hybridization)
Set the hybidization that was created by this event. |
(package private) void |
setProjectDefaults(Project activeProject)
Set protocol and hardware from project default settings. |
void |
setProtocol(Protocol protocol)
Set the Protocol that describes the procedure used in this event. |
(package private) void |
setSource(MeasuredBioMaterial bioMaterial,
Float usedQuantity)
Set a single source. |
void |
setSourceGroup(MeasuredBioMaterial bioMaterial,
int sourceGroup)
Set the source group for a biomaterial that was used as a source in this event. |
void |
setUsedQuantity(Float usedQuantity)
Set the used quantity. |
Methods inherited from class net.sf.basedb.core.ChildItem |
---|
getPermissionForWriteDeleteAndCreate, getPluginPermissions |
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, 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 |
---|
public static final Item TYPE
Item.BIOMATERIALEVENT
,
getType()
private boolean protocolHasBeenSet
private boolean hardwareHasBeenSet
public static final int MAX_COMMENT_LENGTH
setComment(String)
method to avoid exceptions.
Constructor Detail |
---|
BioMaterialEvent(BioMaterialEventData bioMaterialEventData)
Method Detail |
---|
public static BioMaterialEvent getNew(DbControl dc, MeasuredBioMaterial bioMaterial) throws BaseException
BioMaterialEvent
of the BioMaterialEvent.Type.OTHER
type.
dc
- The DbControl
which will be used for
permission checking and database accessbioMaterial
- The affected biomaterial
BioMaterialEvent
item
BaseException
- If there is an errorpublic static BioMaterialEvent getNew(DbControl dc, MeasuredBioMaterial bioMaterial, BioPlateEventParticipant master) throws BaseException
BioMaterialEvent
of the BioMaterialEvent.Type.OTHER
type
that is linked with a master BioPlateEventParticipant
. If a master
bioplate event is used it must be a new event that has not yet been saved to the
database.
dc
- The DbControl
which will be used for
permission checking and database accessbioMaterial
- The affected biomaterialmaster
- The master bioplate event or null
BioMaterialEvent
item
BaseException
- If there is an errorstatic BioMaterialEvent getNewCreationEvent(DbControl dc, MeasuredBioMaterial bioMaterial, BioPlateEventParticipant master) throws BaseException
BioMaterialEvent
of the BioMaterialEvent.Type.CREATION
type (creation event).
dc
- The DbControl
which will be used for
permission checking and database accessbioMaterial
- The biomaterial that was created.master
- The master bioplate event or null
BioMaterialEvent
item
BaseException
- If there is an errorstatic BioMaterialEvent getNewHybridizationEvent(DbControl dc, Hybridization hybridization, BioPlateEventParticipant master) throws BaseException
BioMaterialEvent
of the BioMaterialEvent.Type.HYBRIDIZATION
type.
dc
- The DbControl
which will be used for
permission checking and database accesshybridization
- The hybridization that was created.master
- The master bioplate event or null
BioMaterialEvent
item
BaseException
- If there is an errorpublic static BioMaterialEvent getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
BioMaterialEvent
item when you know the id.
dc
- The DbControl
which will be used for
permission checking and database access.id
- The id of the item to load
BioMaterialEvent
item
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 errorpublic static ItemQuery<BioMaterialEvent> getQuery(MeasuredBioMaterial bioMaterial) throws InvalidDataException
bioMaterial
- The biomaterial to retreive events for, null is not allowed
ItemQuery
object
InvalidDataException
- If the bioMaterial
is nullMeasuredBioMaterial.getEvents()
public Item getType()
Identifiable
Item
enumeration.
getType
in interface Identifiable
void onBeforeCommit(Transactional.Action action) throws BaseException
onBeforeCommit
in class BasicItem<BioMaterialEventData>
BaseException
- If there is an errorTransactional
,
Core API overview - Transaction handling,
Coding rules and guidelines for item classesvoid initPermissions(int granted, int denied) throws BaseException
initPermissions
in class ChildItem<BioMaterialEventData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
BaseException
- If the permissions couldn't be initialisedvoid setProjectDefaults(Project activeProject) throws BaseException
setProjectDefaults
in class BasicItem<BioMaterialEventData>
activeProject
- The currently active project
BaseException
SharedData getSharedParent()
ChildItem
ChildItem.initPermissions(int, int)
method to calculate
the logged in user's permissions for the child item.
getSharedParent
in class ChildItem<BioMaterialEventData>
public BioMaterialEvent.Type getEventType()
BioMaterialEvent.Type
public MeasuredBioMaterial getBioMaterial() throws PermissionDeniedException, BaseException
MeasuredBioMaterial
that was affected or created by this event.
MeasuredBioMaterial
item or null if this is
hybridization event
PermissionDeniedException
- If the logged in user doesn't have
read permission to the biomaterial
BaseException
- If there is another errorprivate void setBioMaterial(MeasuredBioMaterial bioMaterial) throws PermissionDeniedException, InvalidDataException
PermissionDeniedException
InvalidDataException
public Hybridization getHybridization() throws PermissionDeniedException, BaseException
Hybridization
that was created by this event.
Hybridization
item or null if this isn't a
hybridization event
PermissionDeniedException
- If the logged in user doesn't have
read permission to the hybridization
BaseException
- If there is another errorprivate void setHybridization(Hybridization hybridization) throws PermissionDeniedException, InvalidDataException
PermissionDeniedException
InvalidDataException
public boolean isPlateEvent()
public BioPlateEventParticipant getBioPlateEventParticipant()
public User getUser() throws PermissionDeniedException, BaseException
User
that is responsible for this event.
User
item
PermissionDeniedException
- If the logged in user doesn't have
read permission to the user
BaseException
- If there is another errorpublic Protocol getProtocol() throws PermissionDeniedException, BaseException
Protocol
describing the procedure used in this event.
Protocol
item, or null if not known
PermissionDeniedException
- If the logged in user doesn't have
read permission to the protocol
BaseException
- If there is another errorpublic void setProtocol(Protocol protocol) throws PermissionDeniedException
Protocol
that describes the procedure used in this event.
protocol
- A Protocol
item, or null if not known
PermissionDeniedException
- If the logged in user doesn't have
write permission on this event or use permission for the protocolpublic Hardware getHardware() throws PermissionDeniedException, BaseException
Hardware
that was used in this event.
Hardware
item, or null if not known
PermissionDeniedException
- If the logged in user doesn't have
read permission to the hardware
BaseException
- If there is another errorpublic void setHardware(Hardware hardware) throws PermissionDeniedException
Hardware
that was used in this event.
hardware
- A Hardware
item, or null if not known
PermissionDeniedException
- If the logged in user doesn't have
write permission on this event or use permission for the hardwarepublic Float getUsedQuantity()
public void setUsedQuantity(Float usedQuantity) throws PermissionDeniedException
usedQuantity
- The quantity to set.
PermissionDeniedException
- If logged in user doesn't have write
permission on current item.public Float getUsedQuantity(MeasuredBioMaterial bioMaterial)
bioMaterial
- A biomaterial objectpublic int getSourceGroup(MeasuredBioMaterial bioMaterial)
bioMaterial
- The source biomaterial
setSourceGroup(MeasuredBioMaterial, int)
public void addSource(MeasuredBioMaterial bioMaterial, Float usedQuantity) throws PermissionDeniedException, InvalidDataException, BaseException
bioMaterial
- The biomaterial used as a sourceusedQuantity
- The quantity that was used from the source biomaterial
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 errorpublic void setSourceGroup(MeasuredBioMaterial bioMaterial, int sourceGroup) throws PermissionDeniedException, InvalidDataException, BaseException
Hybridization.getNumArrays()
.
A single labeled extract can only be used in a single group. Experiments using a n-channel platform and a common reference must first split the reference labeled extract into individual labeled extracts. This can be done with the 'pooling' functionality.
If the source biomaterial has not been added with addSource(MeasuredBioMaterial, Float)
this method will automatically add it with usedQuantity = null.
bioMaterial
- The source biomaterialsourceGroup
- The source group
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
public void removeSource(MeasuredBioMaterial bioMaterial) throws PermissionDeniedException, InvalidDataException, BaseException
bioMaterial
- The biomaterial used as a source
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 errorprivate void checkAllowedSource(MeasuredBioMaterial bioMaterial) throws PermissionDeniedException, InvalidDataException, BaseException
PermissionDeniedException
InvalidDataException
BaseException
void setSource(MeasuredBioMaterial bioMaterial, Float usedQuantity) throws PermissionDeniedException, InvalidDataException
PermissionDeniedException
InvalidDataException
Extract.setSample(Sample, Float)
,
LabeledExtract.setExtract(Extract, Float)
void clearSources()
public ItemQuery<? extends MeasuredBioMaterial> getSources()
query = event.getSources(); query.restrict(Expressions.gteq( Hql.property("srcevt", "sourceGroup"), Expressions.integer(2)) ); query.order(Orders.asc(Hql.property("srcevt", "usedQuantity")));
NOTE! The filtering and ordering on the "srcevt" columns is only available in BASE 2.6 and later.
ItemQuery
objectpublic String getComment()
public void setComment(String comment) throws PermissionDeniedException, InvalidDataException
MAX_COMMENT_LENGTH
constant.
comment
- The new comment
PermissionDeniedException
- If the logged in user doesn't have
write permission on this event
InvalidDataException
- If the comment is too longpublic Date getEntryDate()
getEntryDate
in interface Registered
Date
objectpublic Date getEventDate()
Date
object, or null if not knownpublic void setEventDate(Date eventDate) throws PermissionDeniedException
eventDate
- The date, or null if not known
PermissionDeniedException
- If the logged in user doesn't have
write permission on this event
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |