Class InheritSpecification

java.lang.Object
net.sf.basedb.util.annotations.InheritSpecification
All Implemented Interfaces:
Filter<AnnotationSnapshot>

public class InheritSpecification extends Object implements Filter<AnnotationSnapshot>
Class for holding rules for how annotations should be inherited from parent items. If getRemove() is set, it override all other settings and all inherited annotation for the specified annotation type are removed.
Since:
3.5
Author:
nicklas
  • Field Details

    • annotationTypeId

      private final int annotationTypeId
    • annotationType

      private final AnnotationType annotationType
    • remove

      private boolean remove
    • clone

      private boolean clone
    • resync

      private boolean resync
    • subtype

      private ItemSubtype subtype
    • noDuplicates

      private boolean noDuplicates
    • replaceExisting

      private boolean replaceExisting
  • Constructor Details

    • InheritSpecification

      public InheritSpecification(AnnotationType annotationType)
      Creates a new specification for the given annotation type.
  • Method Details

    • getAnnotationType

      public AnnotationType getAnnotationType()
    • setRemove

      public void setRemove(boolean remove)
      Set a flag to remove all inherited annotations of the specified annotation type. Note that if this setting is enabled, it override all other settings.
    • getRemove

      public boolean getRemove()
    • setClone

      public void setClone(boolean clone)
      Set a flag to inherit annotations by cloning the original values. Use this if you do not want changes to the original annotation to be reflected in the inherited (=cloned) annotations.
      Since:
      3.6
    • getClone

      public boolean getClone()
    • setResyncCloned

      public void setResyncCloned(boolean resync)
    • getResync

      public boolean getResync()
    • setItemSubtype

      public void setItemSubtype(ItemSubtype subtype)
      Set the subtype a parent item must have if annotations should be inherited from it. Set to null to inherit from any parent.
    • getItemSubtype

      public ItemSubtype getItemSubtype()
    • setNoDuplicates

      public void setNoDuplicates(boolean noDuplicates)
      If this flag is set (default=true), only one annotation of the specified annotation type can be inherited.
    • getNoDuplicates

      public boolean getNoDuplicates()
    • setReplaceExisting

      public void setReplaceExisting(boolean replaceExisting)
      If this flag is set (default=false), existing inherited annotations of the specified annotation type are removed before inheriting new ones. Note that existing annotations are only replaced if a new annotation is found.
    • getReplaceExisting

      public boolean getReplaceExisting()
    • isAcceptableParent

      boolean isAcceptableParent(Annotatable parent)
      Checks if the parent item has a subtype matching the subtype (if any) in this specification. If the parent item is a BioPlate we check the subtype of bioplate type (BioPlateType.getItemSubtype())
      Returns:
      TRUE if the subtype matches or if this specification doesn't set any subtype
    • evaluate

      public boolean evaluate(AnnotationSnapshot snapshot)
      Description copied from interface: Filter
      Evaluate if the given object should pass the filter or not.
      Specified by:
      evaluate in interface Filter<AnnotationSnapshot>
      Parameters:
      snapshot - The object to evaluate
      Returns:
      TRUE if the object passes the filter, FALSE otherwise