Class BioMaterial

All Implemented Interfaces:
AccessControlled, Annotatable, Identifiable, Listable, Nameable, Ownable, Removable, Shareable, Subtypable
Direct Known Subclasses:
BioSource, MeasuredBioMaterial

public abstract class BioMaterial extends AnnotatedItem implements Subtypable, Listable
This is the base class for for the three types of biomaterials: BioSource, Sample and Extract.
Version:
2.0
Author:
Nicklas
Last modified
$Date: 2015-04-17 14:02:22 +0200 (fr, 17 apr 2015) $
  • Field Details

  • Constructor Details

  • Method Details

    • getById

      public static BioMaterial getById(DbControl dc, int id)
      Get a biomaterial item when you know the id. This method can return any of the subclasses of BioMaterial. Eg. BioSource, Sample or Extract.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access.
      id - The id of the item to load
      Returns:
      The Sample 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
      Since:
      2.17
    • getData

      BioMaterialData getData()
      Description copied from class: BasicItem
      Get the BasicData object that holds all data for this item.
      Overrides:
      getData in class AnnotatedItem
    • getItemSubtype

      public ItemSubtype getItemSubtype()
      Description copied from interface: Subtypable
      Get the subtype of the item.
      Specified by:
      getItemSubtype in interface Subtypable
      Returns:
      A subtype of null if not set
      See Also:
    • setItemSubtype

      public void setItemSubtype(ItemSubtype subtype)
      Description copied from interface: Subtypable
      Set the subtype on the item.
      Specified by:
      setItemSubtype in interface Subtypable
      Parameters:
      subtype - A subtype or null
      See Also:
    • getAnnotatableParents

      public Set<Annotatable> getAnnotatableParents() throws BaseException
      Get all child biomaterial items with a subtype that has the ItemSubtype.getPushAnnotations() flag set.
      Specified by:
      getAnnotatableParents in interface Annotatable
      Returns:
      A set containing annotatable items, or null
      Throws:
      BaseException - If there is an error
      Since:
      3.1
    • getExternalId

      public String getExternalId()
      Get the external id of the biomaterial. This value can be used to link with information in external databases. It is not used by the BASE core and it doesn't have to be unique.
      Returns:
      The external id for the biomaterial
    • setExternalId

      public void setExternalId(String externalId) throws PermissionDeniedException, InvalidDataException
      Set the external id of the biomaterial. The value may be null but must not be longer than the value specified by the MAX_EXTERNAL_ID_LENGTH constant.
      Parameters:
      externalId - The new value for the external id
      Throws:
      PermissionDeniedException - If the logged in user doesn't have write permission
      InvalidDataException - If the string is too long
    • countChildren

      public abstract long countChildren(boolean pooled)
      Count the number of already existing children to this biomaterial. The count includes items that the logged in user doesn't have access to.
      Parameters:
      pooled - If TRUE, the count is for biomaterials of the same type, if FALSE the count is for biomaterials of the child type
      Since:
      2.16
    • getChildCreationEvents

      public SpecialQuery<BioMaterialEventSource> getChildCreationEvents()
      Get a query returning all events where this biomaterial has been used as a source item.
      Returns:
      A special query
      Since:
      3.0