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 Detail

      • needSynchronize

        private boolean needSynchronize
    • Method Detail

      • 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
      • 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
      • 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
      • 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
      • 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.
      • 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
      • 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.