2.17.2: 2011-06-17

net.sf.basedb.core
Class PlateEventType

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<PlateEventTypeData>
          extended by net.sf.basedb.core.PlateEventType
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable, Removable

public class PlateEventType
extends ChildItem<PlateEventTypeData>
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: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
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
PlateEventType(PlateEventTypeData plateEventTypeData)
           
 
Method Summary
static PlateEventType getById(DbControl dc, int id)
          Get a PlateEventType item when you know the id.
 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 new PlateEventType item.
 int getOrdinal()
          Get the order of this event among the list of events.
 PlateType getPlateType()
          Get the PlateType this event type belongs to.
 ProtocolType getProtocolType()
          Get the associated ProtocolType item.
static ItemQuery<PlateEventType> getQuery(PlateType plateType)
          Get a query configured to retrieve event types for the specified plate type
(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 type
 boolean isRemoved()
          Check if the removed flag is set for this item.
 boolean isUsed()
          Check if: A PlateEvent of this type exists
 void 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(ProtocolType protocolType)
          Set the protocol type of this PlateTypeEvent item.
 void setRemoved(boolean removed)
          Set the removed flag for this item.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, 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

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.PLATEEVENTTYPE, getType()

RUNTIME_FILTER

private static final QueryRuntimeFilter RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to plate types.

Constructor Detail

PlateEventType

PlateEventType(PlateEventTypeData plateEventTypeData)
Method Detail

getNew

public static PlateEventType getNew(DbControl dc,
                                    PlateType plateType)
                             throws InvalidDataException,
                                    BaseException
Create a new PlateEventType item.

Parameters:
dc - The DbControl which will be used for permission checking and database access
plateType - The plate type
Returns:
The new PlateEventType item
Throws:
PermissionDeniedException - If the loggged in user doesn't have write permission for the plate type
InvalidDataException - If the plate type is null
BaseException - If there is an error

getById

public static PlateEventType getById(DbControl dc,
                                     int id)
                              throws ItemNotFoundException,
                                     PermissionDeniedException,
                                     BaseException
Get a PlateEventType item when you know the id.

Parameters:
dc - The DbControl 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 found
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<PlateEventType> getQuery(PlateType plateType)
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()

getType

public 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 the Item enumeration.

Specified by:
getType in interface Identifiable
Returns:
A value indicating the type of item

getName

public String getName()
Description copied from interface: Nameable
Get the name of the item.

Specified by:
getName in interface Nameable
Returns:
A String with the name of the item

setName

public void setName(String name)
             throws PermissionDeniedException,
                    InvalidDataException
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 the Nameable.MAX_NAME_LENGTH constant.

Specified by:
setName in interface Nameable
Parameters:
name - The new name for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the name is null or longer than specified by the Nameable.MAX_NAME_LENGTH constant

getDescription

public String getDescription()
Description copied from interface: Nameable
Get the description for the item.

Specified by:
getDescription in interface Nameable
Returns:
A String with a description of the item

setDescription

public void setDescription(String description)
                    throws PermissionDeniedException,
                           InvalidDataException
Description 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 the Nameable.MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface Nameable
Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the Nameable.MAX_DESCRIPTION_LENGTH constant

isRemoved

public boolean isRemoved()
Description copied from interface: Removable
Check if the removed flag is set for this item.

Specified by:
isRemoved in interface Removable
Returns:
TRUE if the item is flagged as removed, FALSE otherwise

setRemoved

public void setRemoved(boolean removed)
                throws PermissionDeniedException
Description copied from interface: Removable
Set the removed flag for this item.

Specified by:
setRemoved in interface Removable
Parameters:
removed - TRUE if the item should be flagged as removed, FALSE otherwise
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.DELETE permission for setting the flag to TRUE or Permission.WRITE permission for setting the flag to FALSE

isUsed

public boolean isUsed()
               throws BaseException
Check if:

Overrides:
isUsed in class BasicItem<PlateEventTypeData>
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()

getUsingItems

public Set<ItemProxy> getUsingItems()
Get all:

getSharedParent

SharedData getSharedParent()
Description copied from class: ChildItem
Get the shareable parent item of this child item. This is used by the ChildItem.initPermissions(int, int) method to calculate the logged in user's permissions for the child item.

Specified by:
getSharedParent in class ChildItem<PlateEventTypeData>
Returns:
The parent item

getPlateType

public PlateType getPlateType()
                       throws PermissionDeniedException,
                              BaseException
Get the PlateType this event type belongs to.

Returns:
The PlateType item
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission for the plate type
BaseException - If there is another error

setPlateType

private void setPlateType(PlateType plateType)
                   throws PermissionDeniedException,
                          InvalidDataException
Set the plate type owning this event type.

Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for the plate type
InvalidDataException - If the plate type is null

getProtocolType

public ProtocolType getProtocolType()
                             throws PermissionDeniedException,
                                    BaseException
Get the associated ProtocolType item. When creating PlateEvent items for a Plate 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 type
BaseException - If there is another error

setProtocolType

public void setProtocolType(ProtocolType protocolType)
                     throws PermissionDeniedException,
                            BaseException
Set the protocol type of this PlateTypeEvent item. When creating PlateEvent items for a Plate the protocol for the event must be of this type.

Parameters:
protocolType - The new ProtocolType
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission for this event or use permission for the protocol type
BaseException - If there is another error

getOrdinal

public int getOrdinal()
Get the order of this event among the list of events.


setOrdinal

public void setOrdinal(int ordinal)
                throws PermissionDeniedException,
                       InvalidDataException
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 type
InvalidDataException - If the ordinal is less than one

2.17.2: 2011-06-17