|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.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 | |
|---|---|
private BioMaterialEventSource |
addCheckedSource(BioMaterial bioMaterial)
|
BioMaterialEventSource |
addSource(BioMaterial bioMaterial)
Add a biomaterial as a source to this event. |
private void |
checkAllowedSource(BioMaterial source,
boolean forAdd)
Check if the biomaterial is allowed as a source. |
void |
clearSources()
Clear the sources collection and return the used quantities to the source biomaterials. |
private void |
clearSourcesExcept(BioMaterial parent)
Clear the sources collection and return the used quantities to the source biomaterials, except for the given biomaterial. |
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. |
BioMaterialEventSource |
getEventSource(BioMaterial bioMaterial)
Get information about a biomaterial used as a source to this event. |
SpecialQuery<BioMaterialEventSource> |
getEventSources()
Create a special query that return BioMaterialEventSource objects. |
List<BioMaterialEventSource> |
getEventSources(DbControl dc,
int position)
Utility method for finding all sources on a given bioassay position. |
BioMaterialEvent.Type |
getEventType()
Get the type of event. |
Hardware |
getHardware()
Get the Hardware that was used in 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 |
getNewBioAssayEvent(DbControl dc,
PhysicalBioAssay physicalBioAssay,
BioPlateEventParticipant master)
Create a new BioMaterialEvent of the BioMaterialEvent.Type.BIOASSAY
type. |
(package private) static BioMaterialEvent |
getNewCreationEvent(DbControl dc,
MeasuredBioMaterial bioMaterial,
BioPlateEventParticipant master)
Create a new BioMaterialEvent of the BioMaterialEvent.Type.CREATION
type (creation event). |
PhysicalBioAssay |
getPhysicalBioAssay()
Get the PhysicalBioAssay that was created by 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. |
(package private) SharedData |
getSharedParent()
Get the shareable parent item of this child item. |
ItemQuery<? extends BioMaterial> |
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. |
boolean |
isSource(BioMaterial bioMaterial)
Check if the given biomaterial has been used as a source in this event. |
(package private) void |
onBeforeCommit(Transactional.Action action)
Return used guantity to biomaterials on delete action. |
void |
removeSource(BioMaterial 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 |
setPhysicalBioAssay(PhysicalBioAssay physicalBioAssay)
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. |
BioMaterialEventSource |
setSource(BioMaterial parent)
Set a single parent item for 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 error
public 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 error
static 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 error
static BioMaterialEvent getNewBioAssayEvent(DbControl dc,
PhysicalBioAssay physicalBioAssay,
BioPlateEventParticipant master)
throws BaseException
BioMaterialEvent of the BioMaterialEvent.Type.BIOASSAY
type.
dc - The DbControl which will be used for
permission checking and database accessphysicalBioAssay - The hybridization that was created.master - The master bioplate event or null
BioMaterialEvent item
BaseException - If there is an error
public 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 error
public 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()
IdentifiableItem enumeration.
getType in interface Identifiable
void onBeforeCommit(Transactional.Action action)
throws BaseException
onBeforeCommit in class BasicItem<BioMaterialEventData>BaseException - If there is an errorTransactional,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classes
void 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 initialised
void setProjectDefaults(Project activeProject)
throws BaseException
setProjectDefaults in class BasicItem<BioMaterialEventData>activeProject - The currently active project
BaseExceptionSharedData getSharedParent()
ChildItemChildItem.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 error
private void setBioMaterial(MeasuredBioMaterial bioMaterial)
throws PermissionDeniedException,
InvalidDataException
PermissionDeniedException
InvalidDataException
public PhysicalBioAssay getPhysicalBioAssay()
throws PermissionDeniedException,
BaseException
PhysicalBioAssay that was created by this event.
PhysicalBioAssay item or null if this isn't a
bioassay event
PermissionDeniedException - If the logged in user doesn't have
read permission to the bioassay
BaseException - If there is another error
private void setPhysicalBioAssay(PhysicalBioAssay physicalBioAssay)
throws PermissionDeniedException,
InvalidDataException
PermissionDeniedException
InvalidDataExceptionpublic 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 error
public 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 error
public 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 protocol
public 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 error
public 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 BioMaterialEventSource getEventSource(BioMaterial bioMaterial)
bioMaterial - The biomaterial
addSource(BioMaterial)public boolean isSource(BioMaterial bioMaterial)
bioMaterial - The biomaterial to checkpublic BioMaterialEventSource setSource(BioMaterial parent)
parent - The parent biomaterial, or null to remove all parentspublic BioMaterialEventSource addSource(BioMaterial bioMaterial)
bioMaterial - The biomaterial (null is not allowed)
private BioMaterialEventSource addCheckedSource(BioMaterial bioMaterial)
public void removeSource(BioMaterial 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 error
private void checkAllowedSource(BioMaterial source,
boolean forAdd)
throws PermissionDeniedException,
InvalidDataException,
BaseException
PermissionDeniedException
InvalidDataException
BaseExceptionpublic void clearSources()
private void clearSourcesExcept(BioMaterial parent)
parent - A biomaterial that should already be a parent biomaterial
or null to clear all sourcespublic ItemQuery<? extends BioMaterial> getSources()
query = event.getSources();
query.restrict(Expressions.gteq(
Hql.property("srcevt", "position"), 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 SpecialQuery<BioMaterialEventSource> getEventSources()
BasicItem:s but can be used to get information
about and modify the source biomaterials used in the event. Note
that the query may return objects that link to biomaterial that the
logged in used doesn't have read access to.
public List<BioMaterialEventSource> getEventSources(DbControl dc,
int position)
position - The position number (between 1 and PhysicalBioAssay.getSize().
public 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 RegisteredDate objectpublic Date getEventDate()
Date object, or null if not known
public 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
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||