Package net.sf.basedb.core
Class BioPlateEvent
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.OwnedItem
net.sf.basedb.core.SharedItem
net.sf.basedb.core.CommonItem
net.sf.basedb.core.BioPlateEvent
- All Implemented Interfaces:
AccessControlled
,Controlled
,Identifiable
,Nameable
,Ownable
,Registered
,Removable
,Shareable
,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: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.basedb.core.Transactional
Transactional.Action
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
static final Item
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
-
Method Summary
Modifier and TypeMethodDescriptionaddParticipant
(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.Get a query returning all biomaterial events linked to this event.static BioPlateEvent
Get aBioPlateEvent
item when you know the id.(package private) BioPlateEventData
getData()
Get theBasicData
object that holds all data for this item.Get the date that the item was registered in the database.Get the date this event was done in the lab.Get the event type of this event.Get theHardware
that was used in this event.getKit()
Get theKit
that was used in this event.static BioPlateEvent
getNew
(DbControl dc, BioPlateEventType eventType) Create a newBioPlateEvent
item.getParticipant
(BioPlate bioPlate) Get the participant object representing the given bioplate in this event.Get a query returning all participants in the event.Get theProtocol
describing the procedure used in this event.static ItemQuery<BioPlateEvent>
getQuery()
Get a query that returns bioplate event items.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
setEntryDate
(Date entryDate) Set the date the entry was registered in the database.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 theHardware
that was used in this event.void
Set theKit
that was used in this event.void
setProtocol
(Protocol protocol) Set theProtocol
that describes the procedure used in this event.(package private) void
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, getRemovedBy, isRemoved, setName, setRemoved
Methods inherited from class net.sf.basedb.core.SharedItem
getItemKey, getProjectKey, initPermissions, isShared, setItemKey, setProjectKey
Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
needSynchronize
private boolean needSynchronize
-
-
Constructor Details
-
BioPlateEvent
BioPlateEvent(BioPlateEventData data)
-
-
Method Details
-
getNew
Create a newBioPlateEvent
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accesseventType
- 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 aBioPlateEvent
item when you know the id.- Parameters:
dc
- TheDbControl
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 foundPermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error
-
getQuery
Get a query that returns bioplate event items.- Returns:
- An
ItemQuery
object.
-
getData
BioPlateEventData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.- Overrides:
getData
in classCommonItem
-
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 theItem
enumeration.- Specified by:
getType
in interfaceIdentifiable
- Returns:
- A value indicating the type of item
-
getEntryDate
Description copied from interface:Registered
Get the date that the item was registered in the database.- Specified by:
getEntryDate
in interfaceRegistered
- Returns:
- A date or null if this is not known
-
setEntryDate
Description copied from interface:Registered
Set the date the entry was registered in the database. Implementations should only allow this property to be set before the item is first stored in the database. The intention of this method is to facilitate export/import of data between server.- Specified by:
setEntryDate
in interfaceRegistered
- Parameters:
entryDate
- A date or null to use today's date
-
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 interfaceNameable
- Overrides:
setDescription
in classCommonItem
- Parameters:
description
- The new description for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the description longer than specified by theNameable.MAX_DESCRIPTION_LENGTH
constant
-
onBeforeCommit
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 classSharedItem
- Throws:
NotLoggedInException
- If no user is logged inBaseException
- If there is another error- See Also:
-
getProtocol
Get theProtocol
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 protocolBaseException
- If there is another error
-
setProtocol
Set theProtocol
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
- AProtocol
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
Get theHardware
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 hardwareBaseException
- If there is another error
-
setHardware
Set theHardware
that was used in this event. The hardware is also updated on all related biomaterial events (when the transaction is committed).- Parameters:
hardware
- AHardware
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
-
getKit
Get theKit
that was used in this event.- Returns:
- A
Kit
item, or null if not known - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the kitBaseException
- If there is another error- Since:
- 3.7
-
setKit
Set theKit
that was used in this event. The kit is also updated on all related biomaterial events (when the transaction is committed).- Parameters:
kit
- AKit
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 kit- Since:
- 3.7
-
getEventDate
Get the date this event was done in the lab.- Returns:
- A
Date
object, or null if not known
-
setEventDate
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
Get the event type of this event. -
setEventType
-
isParticipant
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
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
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 plateindex
- The index (if the event requires ordering of the plates)- Returns:
- A new or existing bioplate event participant object
-
removeParticipant
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
Get a query returning all participants in the event. -
getBioMaterialEvents
Get a query returning all biomaterial events linked to this event. -
findParticipant
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
Synchronize all related properties between this event and the biomaterial event. If a participant is given, link the biomaterial event to it.
-