2.17.2: 2011-06-17

net.sf.basedb.core
Class BioPlateEventParticipant

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<BioPlateEventParticipantData>
          extended by net.sf.basedb.core.BioPlateEventParticipant
All Implemented Interfaces:
AccessControlled, Identifiable

public class BioPlateEventParticipant
extends ChildItem<BioPlateEventParticipantData>

Holds information about a bioplate that is participating in a bioplate event. The bioplate may have a specific 'role' and an 'index' (if the ordering among multiple plates is important). The BASE core itself doesn't requires or makes any use of those attributes. It is also possible to link individual biomaterial events to a participant.

A bioplate participant object is formally a child item to the bioplate event, but users that has read permission to the bioplate also get read permission to the participant object.

Since:
2.17
Author:
Nicklas
Last modified
$Date: 2010-12-02 14:35:04 +0100 (Thu, 02 Dec 2010) $

Field Summary
static int MAX_ROLE_LENGTH
          The maximum length of the role string that can be stored in the database.
static Item TYPE
          The type of item represented by this class.
 
Constructor Summary
BioPlateEventParticipant(BioPlateEventParticipantData data)
           
 
Method Summary
 BioPlate getBioPlate()
          Get the BioPlate.
static BioPlateEventParticipant getById(DbControl dc, int id)
          Get a BioPlateEventParticipant item when you know the id.
 BioPlateEvent getEvent()
          Get the BioPlateEvent.
 int getIndex()
          Get the index of the plate in this event.
(package private) static BioPlateEventParticipant getNew(DbControl dc, BioPlateEvent event, BioPlate plate)
          Creates a new participant for the given event and bioplate.
static ItemQuery<BioPlateEventParticipant> getQuery(BioPlate bioPlate)
          Get a query configured to return all event participants for a bioplate.
static ItemQuery<BioPlateEventParticipant> getQuery(BioPlateEvent event)
          Get a query configured to return all participants for a bioplate event.
 String getRole()
          Get the role that the plate has in this event.
(package private)  SharedData getSharedParent()
          Get the shareable parent item of this child item.
 Item getType()
          Get the type of item represented by the object.
(package private)  void initPermissions(int granted, int denied)
          If the logged in user has read permission for the parent, read permission is granted.
(package private)  void onBeforeCommit(Transactional.Action action)
          This method is called on each Transactional item and on all items if the action is Transactional.Action.CREATE or Transactional.Action.DELETE before a commit is issued to the database.
 void setIndex(int index)
          Set the index of the plate in this event.
 void setRole(String role)
          Set the role that the plate has in this event.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

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

See Also:
Item.BIOPLATEEVENTPARTICIPANT, getType()

MAX_ROLE_LENGTH

public static final int MAX_ROLE_LENGTH
The maximum length of the role string that can be stored in the database.

See Also:
setRole(String), Constant Field Values
Constructor Detail

BioPlateEventParticipant

BioPlateEventParticipant(BioPlateEventParticipantData data)
Method Detail

getNew

static BioPlateEventParticipant getNew(DbControl dc,
                                       BioPlateEvent event,
                                       BioPlate plate)
Creates a new participant for the given event and bioplate.

See Also:
BioPlateEvent.addParticipant(BioPlate, String, int)

getById

public static BioPlateEventParticipant getById(DbControl dc,
                                               int id)
                                        throws ItemNotFoundException,
                                               PermissionDeniedException,
                                               BaseException
Get a BioPlateEventParticipant 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 BioPlateEventParticipant item
Throws:
ItemNotFoundException - If an item with the specified id is not found
PermissionDeniedException - If the logged in user doesn't have read permission to the item
BaseException - If there is another error

getQuery

public static ItemQuery<BioPlateEventParticipant> getQuery(BioPlateEvent event)
                                                    throws InvalidDataException
Get a query configured to return all participants for a bioplate event.

Parameters:
event - The event to get participants for (null is not allowed)
Returns:
An ItemQuery object
Throws:
InvalidUseOfNullException - If the event parameter is null
InvalidDataException

getQuery

public static ItemQuery<BioPlateEventParticipant> getQuery(BioPlate bioPlate)
                                                    throws InvalidDataException
Get a query configured to return all event participants for a bioplate.

Parameters:
bioPlate - The bioplate to get participants for (null is not allowed)
Returns:
An ItemQuery object
Throws:
InvalidUseOfNullException - If the bioplate parameter is null
InvalidDataException

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.

Returns:
A value indicating the type of item

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<BioPlateEventParticipantData>
Returns:
The parent item

initPermissions

void initPermissions(int granted,
                     int denied)
               throws BaseException
Description copied from class: ChildItem
If the logged in user has read permission for the parent, read permission is granted. If the logged in user has the permission returned by the ChildItem.getPermissionForWriteDeleteAndCreate() method for the parent, WRITE, DELETE and CREATE permission is granted.

Overrides:
initPermissions in class ChildItem<BioPlateEventParticipantData>
Parameters:
granted - Permissions that have been granted by the subclass
denied - Permissions that have been denied by the subclass
Throws:
BaseException - If the permissions couldn't be initialised

onBeforeCommit

void onBeforeCommit(Transactional.Action action)
              throws BaseException
Description copied from class: BasicItem
This method is called on each Transactional item and on all items if the action is Transactional.Action.CREATE or Transactional.Action.DELETE before a commit is issued to the database. If the subclass overrides this method it must also propagate the call to the superclass, ie. super.onBeforeCommit(action).

Overrides:
onBeforeCommit in class BasicItem<BioPlateEventParticipantData>
Throws:
BaseException - If there is an error
See Also:
Transactional, Core API overview - Transaction handling, Coding rules and guidelines for item classes

getBioPlate

public BioPlate getBioPlate()
                     throws PermissionDeniedException,
                            BaseException
Get the BioPlate.

Throws:
PermissionDeniedException - If the logged in user doesn't have read permission for the bioplate
BaseException - If there is another error

getEvent

public BioPlateEvent getEvent()
                       throws PermissionDeniedException,
                              BaseException
Get the BioPlateEvent.

Throws:
PermissionDeniedException - If the logged in user doesn't have read permission for the event
BaseException - If there is another error

getRole

public String getRole()
Get the role that the plate has in this event. The role is a string defined by the client application.


setRole

public void setRole(String role)
Set the role that the plate has in this event. The role is a string defined by the client application.


getIndex

public int getIndex()
Get the index of the plate in this event. This has no meaning unless the event require that the plates are ordered.


setIndex

public void setIndex(int index)
Set the index of the plate in this event. This has no meaning unless the event require that the plates are ordered.


2.17.2: 2011-06-17