Class BioPlateEvent

All Implemented Interfaces:
AccessControlled, Controlled, Identifiable, Nameable, Ownable, Registered, Removable, Shareable, Transactional

public class BioPlateEvent extends CommonItem implements Registered, Transactional
A bioplate event represents something that happened simultaneously to the biomaterial on one or more bioplates. Individual BioMaterialEvent:s may be linked with a bioplate event. The biomaterial events are then locked and most properties are set on the bioplate event. The description field is mapped to the comment field of the biomaterial events but it is possible to overwrite with a specific comment.
Since:
2.17
Author:
Nicklas
Last modified
$Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
  • Field Details

    • TYPE

      public static final Item TYPE
      The type of item represented by this class.
      See Also:
    • needSynchronize

      private boolean needSynchronize
  • Constructor Details

  • Method Details

    • getNew

      public static BioPlateEvent getNew(DbControl dc, BioPlateEventType eventType) throws BaseException
      Create a new BioPlateEvent item.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access
      eventType - The event type of the event (must not be null)
      Returns:
      The new BioPlateEvent item
      Throws:
      BaseException - If there is an error
    • getById

      Get a BioPlateEvent 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 BioPlateEvent 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<BioPlateEvent> getQuery()
      Get a query that returns bioplate event items.
      Returns:
      An ItemQuery object.
    • getData

      Description copied from class: BasicItem
      Get the BasicData object that holds all data for this item.
      Overrides:
      getData in class CommonItem
    • 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
    • getEntryDate

      public Date getEntryDate()
      Description copied from interface: Registered
      Get the date that the item was registered in the database.
      Specified by:
      getEntryDate in interface Registered
      Returns:
      A date or null if this is not known
    • setEntryDate

      public void setEntryDate(Date entryDate)
      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 interface Registered
      Parameters:
      entryDate - A date or null to use today's date
    • setDescription

      public void setDescription(String description) throws PermissionDeniedException, InvalidDataException
      Set the description. This is copied to the comment property on all related biomaterial events that has a null comment (when the transaction is committed)
      Specified by:
      setDescription in interface Nameable
      Overrides:
      setDescription in class CommonItem
      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
    • onBeforeCommit

      void onBeforeCommit(Transactional.Action action) throws NotLoggedInException, BaseException
      Description copied from class: SharedItem
      If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).
      Overrides:
      onBeforeCommit in class SharedItem
      Throws:
      NotLoggedInException - If no user is logged in
      BaseException - If there is another error
      See Also:
    • getProtocol

      public Protocol getProtocol() throws PermissionDeniedException, BaseException
      Get the Protocol describing the procedure used in this event.
      Returns:
      A Protocol item, or null if not known
      Throws:
      PermissionDeniedException - If the logged in user doesn't have read permission to the protocol
      BaseException - If there is another error
    • setProtocol

      public void setProtocol(Protocol protocol) throws PermissionDeniedException
      Set the Protocol that describes the procedure used in this event. The protocol is also updated on all related biomaterial events (when the transaction is committed).
      Parameters:
      protocol - A Protocol 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 protocol
    • getHardware

      public Hardware getHardware() throws PermissionDeniedException, BaseException
      Get the Hardware that was used in this event.
      Returns:
      A Hardware item, or null if not known
      Throws:
      PermissionDeniedException - If the logged in user doesn't have read permission to the hardware
      BaseException - If there is another error
    • setHardware

      public void setHardware(Hardware hardware) throws PermissionDeniedException
      Set the Hardware that was used in this event. The hardware is also updated on all related biomaterial events (when the transaction is committed).
      Parameters:
      hardware - A Hardware 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
    • getKit

      public Kit getKit() throws PermissionDeniedException, BaseException
      Get the Kit that was used in this event.
      Returns:
      A Kit item, or null if not known
      Throws:
      PermissionDeniedException - If the logged in user doesn't have read permission to the kit
      BaseException - If there is another error
      Since:
      3.7
    • setKit

      public void setKit(Kit kit) throws PermissionDeniedException
      Set the Kit that was used in this event. The kit is also updated on all related biomaterial events (when the transaction is committed).
      Parameters:
      kit - A Kit 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 kit
      Since:
      3.7
    • getEventDate

      public Date getEventDate()
      Get the date this event was done in the lab.
      Returns:
      A Date object, or null if not known
    • setEventDate

      public void setEventDate(Date eventDate) throws PermissionDeniedException
      Set the date this event was done in the lab. The date is also updated on all related biomaterial events (when the transaction is committed).
      Parameters:
      eventDate - The date, or null if not known
      Throws:
      PermissionDeniedException - If the logged in user doesn't have write permission on this event
    • getEventType

      public BioPlateEventType getEventType()
      Get the event type of this event.
    • setEventType

      void setEventType(BioPlateEventType eventType)
    • isParticipant

      public boolean isParticipant(BioPlate plate)
      Check if the given bioplate is a participant of this event.
      Parameters:
      plate - A bioplate
      Returns:
      TRUE if the plate is a participant, FALSE otherwise
    • getParticipant

      public BioPlateEventParticipant getParticipant(BioPlate bioPlate)
      Get the participant object representing the given bioplate in this event.
      Parameters:
      bioPlate - The bioplate
      Returns:
      A BioPlateEventParticipant object or null if the bioplate is not a partipant
    • addParticipant

      public BioPlateEventParticipant addParticipant(BioPlate bioPlate, String role, int index)
      Add a bioplate as a participant in this event. If the bioplate has already been registered as a participant the existing information is updated. The participant object is automatically saved to the database if the bioplate event is already saved or has been put in the commit queue.
      Parameters:
      bioPlate - The bioplate to add as a participant (null is not allowed)
      role - The rolw of the plate
      index - The index (if the event requires ordering of the plates)
      Returns:
      A new or existing bioplate event participant object
    • removeParticipant

      public void removeParticipant(BioPlate bioPlate)
      Remove the given bioplate from this event. Removing a participant will automatically unlink related biomaterial events from this event.
      Parameters:
      bioPlate - The bioplate
      Throws:
      PermissionDeniedException - If the logged in user doesn't have write permission
    • getParticipants

      public ItemQuery<BioPlateEventParticipant> getParticipants()
      Get a query returning all participants in the event.
    • getBioMaterialEvents

      public ItemQuery<BioMaterialEvent> getBioMaterialEvents()
      Get a query returning all biomaterial events linked to this event.
    • findParticipant

      private BioPlateEventParticipantData findParticipant(BioPlateData plate)
      Find the participant object for the given bioplate.
      Parameters:
      plate - The bioplate
      Returns:
      The participant object, or null if the plate isn't a participant
    • synchronizeAllBioMaterialEvents

      void synchronizeAllBioMaterialEvents()
      Synchronize all properties on the child biomaterial events that are related to this event.
    • synchronizeProperties

      void synchronizeProperties(BioMaterialEventData event, BioPlateEventParticipantData participant)
      Synchronize all related properties between this event and the biomaterial event. If a participant is given, link the biomaterial event to it.