Package net.sf.basedb.core
Class BioMaterialEventSource
java.lang.Object
net.sf.basedb.core.BioMaterialEventSource
- All Implemented Interfaces:
AccessControlled
Class for holding information about a parent biomaterial
that was used in an event that created a child biomaterial or
a physical bioassay. Each event may only include the same parent
biomaterial once. Permission-wise the information belongs
to the
BioMaterialEvent
and the user has the same permissions
as for the event.- Since:
- 3.0
- Author:
- Nicklas
- Last modified
- $Date: 2014-11-17 08:41:18 +0100 (må, 17 nov 2014) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final BioMaterialEventSourceData
private final DbControl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkPermission
(Permission permission) Check if the logged in user has the desired permission on the item, otherwise throw an exception.Get the biomaterial that was used as a source in this event.getEvent()
Get the event that this information belongs to.Get the logged in user's permissions on the item.int
Get the position that the source biomaterial was used on in the event.static SpecialQuery<BioMaterialEventSource>
getQuery
(BioMaterial source) Get a query returning event information where a given biomaterial has been used as a source.static SpecialQuery<BioMaterialEventSource>
getQuery
(BioMaterialEvent event) Get a query returning source information for a given (creation) event.Get the quantity that was used from the source biomaterial by the event.boolean
hasPermission
(Permission permission) Check if the logged in user has the desired permission on the item.void
setPosition
(int position) void
setUsedQuantity
(Float usedQuantity) Set the quantity that was used from the source biomaterial by the event.
-
Field Details
-
dc
-
data
-
-
Constructor Details
-
BioMaterialEventSource
BioMaterialEventSource(DbControl dc, BioMaterialEventSourceData data)
-
-
Method Details
-
getQuery
Get a query returning source information for a given (creation) event. The event parameter can be null, but the query will then contain a named parameter (event) that must be set before the query is executed.- Parameters:
event
- An event or null- Since:
- 3.1
-
getQuery
Get a query returning event information where a given biomaterial has been used as a source. The parent parameter can be null, but the query will then contain a named parameter (source) that must be set before the query is executed.- Parameters:
source
- An biomaterial or null- Since:
- 3.1
-
hasPermission
Description copied from interface:AccessControlled
Check if the logged in user has the desired permission on the item.- Specified by:
hasPermission
in interfaceAccessControlled
- Parameters:
permission
- The permission to check if the user has.- Returns:
- TRUE if the user has the permission, FALSE otherwise
-
checkPermission
Description copied from interface:AccessControlled
Check if the logged in user has the desired permission on the item, otherwise throw an exception.- Specified by:
checkPermission
in interfaceAccessControlled
- Parameters:
permission
- Permission the user should have.- Throws:
PermissionDeniedException
- If the user doesn't have the requested permission
-
getPermissions
Description copied from interface:AccessControlled
Get the logged in user's permissions on the item.- Specified by:
getPermissions
in interfaceAccessControlled
-
getEvent
Get the event that this information belongs to. -
getBioMaterial
Get the biomaterial that was used as a source in this event. -
getUsedQuantity
Get the quantity that was used from the source biomaterial by the event.- Returns:
- A float, or null if not known
-
setUsedQuantity
Set the quantity that was used from the source biomaterial by the event. This method call is ignored if the source biomaterial is not aMeasuredBioMaterial
.- Parameters:
usedQuantity
- The used quantity or null if not known
-
getPosition
public int getPosition()Get the position that the source biomaterial was used on in the event. -
setPosition
public void setPosition(int position)
-