Package net.sf.basedb.core
Class PlateEvent
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.ChildItem
net.sf.basedb.core.PlateEvent
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Registered
This class represents an event in the life of a
Plate
.
The possible events for a plate are defined by the
PlateEventType
:s of a the plates PlateType
.- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2017-03-13 09:15:46 +0100 (må, 13 mar 2017) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of the comment about this event.private static final QueryRuntimeFilter
This filter will only return items if the logged in user has generic read permission to plates.static final Item
The type of item represented by this class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PlateEvent
Get aPlateEvent
item when you know the id.Get the comment about this event.(package private) PlateEventData
getData()
Get theBasicData
object that holds all data for this item.Get the date this event was added to the database.Get the date this event was done in the lab.Get theHardware
that was used in this event.static PlateEvent
getNew
(DbControl dc, Plate plate, PlateEventType plateEventType) Create a newPlateEvent
item.getPlate()
Get thePlate
this event belongs to.Get thePlateEventType
of this event.Get theProtocol
that was followed in this event.static ItemQuery<PlateEvent>
Get a query configured to retrieve plate events for the specified plate.(package private) SharedData
Get the shareable parent item of this child item.getType()
Get the type of item represented by the object.getUser()
Get theUser
that is responsible for this event.void
setComment
(String comment) Set the comment about this event.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.void
setHardware
(Hardware hardware) Set theHardware
that was used in this event.private void
Set the plate owning this event.private void
setPlateEventType
(PlateEventType plateEventType) Set the plate event type of this event.void
setProtocol
(Protocol protocol) Set the protocol that was followed in this event.Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForUse, getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, 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
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to plates. -
MAX_COMMENT_LENGTH
public static final int MAX_COMMENT_LENGTHThe maximum length of the comment about this event. Check the length against this value before calling thesetComment(String)
method to avoid exceptions.- See Also:
-
-
Constructor Details
-
PlateEvent
PlateEvent(PlateEventData plateEventData)
-
-
Method Details
-
getNew
public static PlateEvent getNew(DbControl dc, Plate plate, PlateEventType plateEventType) throws InvalidDataException, BaseException Create a newPlateEvent
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessplate
- The plateplateEventType
- The type of the event- Returns:
- The new
PlateEvent
item - Throws:
PermissionDeniedException
- If the loggged in user doesn't have write permission for the plate typeInvalidDataException
- If the plate or event type is null, or if the plate type of the plate and event type are differentBaseException
- If there is an error
-
getById
public static PlateEvent getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlateEvent
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
PlateEvent
item - Throws:
ItemNotFoundException
- If an item with the specified id is not foundPermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission to the itemBaseException
- If there is another error
-
getQuery
Get a query configured to retrieve plate events for the specified plate.- Parameters:
plate
- The plate to retreive event for, null is allowed if the logged in user has generic READ permission for plates in which case all events will be returned- Returns:
- An
ItemQuery
object - See Also:
-
getData
PlateEventData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this 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 theItem
enumeration.- Specified by:
getType
in interfaceIdentifiable
- Returns:
- A value indicating the type of item
-
getPlate
Get thePlate
this event belongs to.- Returns:
- The
Plate
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plateBaseException
- If there is another error
-
setPlate
Set the plate owning this event.- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission for the plateInvalidDataException
- If the plate is null
-
getPlateEventType
Get thePlateEventType
of this event.- Returns:
- The
PlateEventType
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the event typeBaseException
- If there is another error
-
setPlateEventType
private void setPlateEventType(PlateEventType plateEventType) throws PermissionDeniedException, InvalidDataException Set the plate event type of this event.- Throws:
InvalidDataException
- If the event type is null or belongs to a differentPlateType
than the platePermissionDeniedException
-
getProtocol
Get theProtocol
that was followed in this event.- Returns:
- The
Protocol
item, or null if no protocol type has been specified - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the protocolBaseException
- If there is another error
-
setProtocol
Set the protocol that was followed in this event. It is recommended that theItemSubtype
of the protocol matches the protocol type set by thePlateEventType
, but the core doesn't check this.- Parameters:
protocol
- The newProtocol
- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission for this event or use permission for the protocolBaseException
- If there is another error
-
getHardware
Get theHardware
that was used in this event.- Returns:
- A
Hardware
item or null of not known - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the hardware.BaseException
- If there is another error.
-
setHardware
Set theHardware
that was used in this event.- 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.
-
getComment
Get the comment about this event.- Returns:
- The comment
-
setComment
Set the comment about this event. The value may be null, but mustn't be longer than the value specified by theMAX_COMMENT_LENGTH
constant.- Parameters:
comment
- The new comment- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on this eventInvalidDataException
- If the comment is too long
-
getEntryDate
Get the date this event was added to the database.- Specified by:
getEntryDate
in interfaceRegistered
- Returns:
- A
Date
object
-
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
-
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.- Parameters:
eventDate
- The date, or null if not known- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission on this event
-
getUser
Get theUser
that is responsible for this event.- Returns:
- A
User
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the userBaseException
- If there is another error
-