Package net.sf.basedb.core
Class PlateEventType
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.ChildItem
net.sf.basedb.core.PlateEventType
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Removable
public class PlateEventType extends ChildItem implements Nameable, Removable
This class is used together with the
PlateType
class
to define event types for plates. A plate may be associated with one
of each event type.- Version:
- 2.0
- Author:
- Nicklas
- See Also:
Plate
,PlateType
,PlateEvent
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Field Summary
Fields Modifier and Type Field Description private static QueryRuntimeFilter
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to plate types.static Item
TYPE
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
Constructors Constructor Description PlateEventType(PlateEventTypeData plateEventTypeData)
-
Method Summary
Modifier and Type Method Description static PlateEventType
getById(DbControl dc, int id)
Get aPlateEventType
item when you know the id.(package private) PlateEventTypeData
getData()
Get theBasicData
object that holds all data for this item.String
getDescription()
Get the description for the item.String
getName()
Get the name of the item.static PlateEventType
getNew(DbControl dc, PlateType plateType)
Create a newPlateEventType
item.int
getOrdinal()
Get the order of this event among the list of events.PlateType
getPlateType()
Get thePlateType
this event type belongs to.ItemSubtype
getProtocolType()
Get the associated protocol type item.static ItemQuery<PlateEventType>
getQuery(PlateType plateType)
Get a query configured to retrieve event types for the specified plate typeUser
getRemovedBy()
Get the user that flagged this item for removal.(package private) SharedData
getSharedParent()
Get the shareable parent item of this child item.Item
getType()
Get the type of item represented by the object.Set<ItemProxy>
getUsingItems()
Get all:PlateEvent
:s of this typeboolean
isRemoved()
Check if the removed flag is set for this item.boolean
isUsed()
Check if: APlateEvent
of this type existsvoid
setDescription(String description)
Set the description for the item.void
setName(String name)
Set the name of the item.void
setOrdinal(int ordinal)
Set the order of this event in relation to the list of all events.private void
setPlateType(PlateType plateType)
Set the plate type owning this event type.void
setProtocolType(ItemSubtype protocolType)
Set the protocol type of thisPlateTypeEvent
item.void
setRemoved(boolean removed)
Set the removed flag for this item.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, getVersion, hashCode, hasPermission, isDetached, isInDatabase, 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:
Item.PLATEEVENTTYPE
,getType()
-
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to plate types.
-
-
Constructor Details
-
PlateEventType
PlateEventType(PlateEventTypeData plateEventTypeData)
-
-
Method Details
-
getNew
public static PlateEventType getNew(DbControl dc, PlateType plateType) throws InvalidDataException, BaseExceptionCreate a newPlateEventType
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessplateType
- The plate type- Returns:
- The new
PlateEventType
item - Throws:
PermissionDeniedException
- If the loggged in user doesn't have write permission for the plate typeInvalidDataException
- If the plate type is nullBaseException
- If there is an error
-
getById
public static PlateEventType getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseExceptionGet aPlateEventType
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
PlateEventType
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 event types for the specified plate type- Parameters:
plateType
- The plate type to retreive event types for, null is allowed if the logged in user has generic READ permission for plate types in which case all event types will be returned- Returns:
- An
ItemQuery
object - See Also:
PlateType.getEventTypes()
-
getData
PlateEventTypeData 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
-
getName
Description copied from interface:Nameable
Get the name of the item. -
setName
Description copied from interface:Nameable
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by theNameable.MAX_NAME_LENGTH
constant.- Specified by:
setName
in interfaceNameable
- Parameters:
name
- The new name for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the name is null or longer than specified by theNameable.MAX_NAME_LENGTH
constant
-
getDescription
Description copied from interface:Nameable
Get the description for the item.- Specified by:
getDescription
in interfaceNameable
- Returns:
- A
String
with a description of the item
-
setDescription
public void setDescription(String description) throws PermissionDeniedException, InvalidDataExceptionDescription copied from interface:Nameable
Set the description for the item. The description can be null but mustn't be longer than the value specified by theNameable.MAX_DESCRIPTION_LENGTH
constant.- Specified by:
setDescription
in interfaceNameable
- 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
-
isRemoved
public boolean isRemoved()Description copied from interface:Removable
Check if the removed flag is set for this item. -
setRemoved
Description copied from interface:Removable
Set the removed flag for this item.- Specified by:
setRemoved
in interfaceRemovable
- Parameters:
removed
- TRUE if the item should be flagged as removed, FALSE otherwise- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.DELETE
permission for setting the flag to TRUE orPermission.WRITE
permission for setting the flag to FALSE
-
getRemovedBy
Description copied from interface:Removable
Get the user that flagged this item for removal.- Specified by:
getRemovedBy
in interfaceRemovable
- Returns:
- A User object, or null if this item has not been flagged
- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the userItemNotFoundException
- If the user that removed this item can't be found
-
isUsed
Check if:- A
PlateEvent
of this type exists
- Overrides:
isUsed
in classBasicItem
- Returns:
- TRUE if this item is used, FALSE otherwise
- Throws:
BaseException
- If not able to tell if item is used or not.- See Also:
BasicItem.getUsingItems()
- A
-
getUsingItems
Get all:PlateEvent
:s of this type
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- Since:
- 2.2
- See Also:
BasicItem.addUsingItems(Set, Item, org.hibernate.query.Query)
-
getPlateType
Get thePlateType
this event type belongs to.- Returns:
- The
PlateType
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the plate typeBaseException
- If there is another error
-
setPlateType
private void setPlateType(PlateType plateType) throws PermissionDeniedException, InvalidDataExceptionSet the plate type owning this event type.- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission for the plate typeInvalidDataException
- If the plate type is null
-
getProtocolType
Get the associated protocol type item. When creatingPlateEvent
items for aPlate
the protocol for the event must be of this type.- Returns:
- The
ProtocolType
item, or null if no protocol type has been specified - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the protocol typeBaseException
- If there is another error- Since:
- 3.0
-
setProtocolType
public void setProtocolType(ItemSubtype protocolType) throws PermissionDeniedException, BaseExceptionSet the protocol type of thisPlateTypeEvent
item. When creatingPlateEvent
items for aPlate
the protocol for the event must be of this type.- Parameters:
protocolType
- The newProtocolType
- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission for this event or use permission for the protocol typeBaseException
- If there is another error- Since:
- 3.0
-
getOrdinal
public int getOrdinal()Get the order of this event among the list of events. -
setOrdinal
Set the order of this event in relation to the list of all events. The core does not pay any attention to this value, it exists mainly for client application to be able to display the events in the appropriate order.- Parameters:
ordinal
- The new ordinal value- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission to this event typeInvalidDataException
- If the ordinal is less than one
-