Class SimpleBioEntry

All Implemented Interfaces:
Comparable, Annotatable, Changeable, BioEntry, RankedCrossRefable, RichAnnotatable
Direct Known Subclasses:
ThinRichSequence

public class SimpleBioEntry extends AbstractChangeable implements BioEntry
Reference implementation of a BioEntry object which has no features or sequence. Equality is the combination of namespace, name, accession and version.
Since:
1.5
Author:
Richard Holland, Mark Schreiber, George Waldon
  • Constructor Details

    • SimpleBioEntry

      public SimpleBioEntry(Namespace ns, String name, String accession, int version)
      Creates a new bioentry representing the sequence in the given namespace with the given name, accession and version. These properties are all immutable and non-nullable.
      Parameters:
      ns - The namespace for this new bioentry (not null).
      name - The name for this new bioentry (not null).
      accession - The accession for this new bioentry (not null).
      version - The version for this new bioentry.
    • SimpleBioEntry

      protected SimpleBioEntry()
  • Method Details

    • getRankedCrossRefs

      Returns the set of all ranked cross references associated with an object. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
      Specified by:
      getRankedCrossRefs in interface RankedCrossRefable
      Returns:
      a set of RankedCrossRef objects.
    • setTaxon

      public void setTaxon(NCBITaxon taxon) throws ChangeVetoException
      Sets the taxon for this bioentry. It may be null, in which case the taxon is unset.
      Specified by:
      setTaxon in interface BioEntry
      Parameters:
      taxon - New value of property taxon.
      Throws:
      ChangeVetoException - in case of objections.
    • getAnnotation

      Should return the associated annotation object.
      Specified by:
      getAnnotation in interface Annotatable
      Returns:
      an Annotation object, never null
    • getRichAnnotation

      Return the associated annotation object.
      Specified by:
      getRichAnnotation in interface RichAnnotatable
      Returns:
      a RichAnnotation object, never null
    • getNoteSet

      public Set<Note> getNoteSet()
      Returns the set of notes associated with this object. Would normally delegate call to internal RichAnnotation instance. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
      Specified by:
      getNoteSet in interface RichAnnotatable
      Returns:
      set a set of Note objects.
      See Also:
    • setNoteSet

      public void setNoteSet(Set<Note> notes) throws ChangeVetoException
      Clears the notes associated with this object and replaces them with the contents of this set. Would normally delegate call to internal RichAnnotation instance. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
      Specified by:
      setNoteSet in interface RichAnnotatable
      Parameters:
      notes - the set of Note objects to replace the existing ones with.
      Throws:
      ChangeVetoException - if the set is null or contains any objects that are not Note objects.
      See Also:
    • getComments

      public Set<Comment> getComments()
      Returns a set of all comments associated with this bioentry. This set is not mutable. If no comments are associated, you will get back an empty set. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
      Specified by:
      getComments in interface BioEntry
      Returns:
      a set of Comment objects.
      See Also:
    • getRankedDocRefs

      Returns a set of all bioentrydocrefs associated with this bioentry. This set is not mutable. If no docrefs are associated, you will get back an empty set. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
      Specified by:
      getRankedDocRefs in interface BioEntry
      Returns:
      a set of RankedDocRef objects.
      See Also:
    • getRelationships

      Returns a set of all relationships associated with this bioentry. This set is not mutable. If no relationships are associated, you will get back an empty set. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
      Specified by:
      getRelationships in interface BioEntry
      Returns:
      a set of BioEntryRelationship objects.
      See Also:
    • setIdentifier

      public void setIdentifier(String identifier) throws ChangeVetoException
      Sets the identifier of this bioentry. Null is allowable.
      Specified by:
      setIdentifier in interface BioEntry
      Parameters:
      identifier - New value of property identifier.
      Throws:
      ChangeVetoException - in case of objections.
    • setDivision

      public void setDivision(String division) throws ChangeVetoException
      Sets the division of this bioentry. Null is allowable.
      Specified by:
      setDivision in interface BioEntry
      Parameters:
      division - New value of property division.
      Throws:
      ChangeVetoException - in case of objections.
    • setDescription

      public void setDescription(String description) throws ChangeVetoException
      Sets the description for this bioentry.
      Specified by:
      setDescription in interface BioEntry
      Parameters:
      description - New value of property description.
      Throws:
      ChangeVetoException - in case of objections.
    • getAccession

      public String getAccession()
      Returns the accession of this bioentry. The accession is supposed to be an immutable property set by the constructor.
      Specified by:
      getAccession in interface BioEntry
      Returns:
      Value of property accession.
    • getDescription

      Returns a description of this sequence.
      Specified by:
      getDescription in interface BioEntry
      Returns:
      Value of property description.
    • getDivision

      public String getDivision()
      Returns the division of this bioentry. Division relates to a division of the parent namespace.
      Specified by:
      getDivision in interface BioEntry
      Returns:
      Value of property division.
    • getIdentifier

      Returns the identifier of this bioentry.
      Specified by:
      getIdentifier in interface BioEntry
      Returns:
      Value of property identifier.
    • getName

      public String getName()
      Returns the name of this bioentry. The name is supposed to be an immutable property set by the constructor.
      Specified by:
      getName in interface BioEntry
      Returns:
      Value of property name.
    • getNamespace

      Returns the namespace of this bioentry. The namespace is supposed to be an immutable property set by the constructor.
      Specified by:
      getNamespace in interface BioEntry
      Returns:
      the namespace of this bioentry.
    • getTaxon

      public NCBITaxon getTaxon()
      Gets the taxon associated with this bioentry. It may be null.
      Specified by:
      getTaxon in interface BioEntry
      Returns:
      Value of property taxon.
    • getVersion

      public int getVersion()
      Gets the version of this bioentry. Bioentries with no versions return 0. The version is supposed to be immutable and set only by the constructor.
      Specified by:
      getVersion in interface BioEntry
      Returns:
      Value of property version.
    • equals

      public boolean equals(Object obj)
      Two bioentries are equal if they share the same namespace, name, accession and version.
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Object o)
      Bioentries are ordered first by namespace, then name, accession, and finally version.
      Specified by:
      compareTo in interface Comparable
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Form: namespace:name/accession.version
      Overrides:
      toString in class Object
    • addRankedCrossRef

      public void addRankedCrossRef(RankedCrossRef crossref) throws ChangeVetoException
      Adds a ranked cross reference to the existing set. If already present, this call is ignored. Null values are not acceptable.
      Specified by:
      addRankedCrossRef in interface RankedCrossRefable
      Parameters:
      crossref - the ranked cross reference to add.
      Throws:
      ChangeVetoException - if the parameter is null.
    • removeRankedCrossRef

      Removes a ranked cross reference from the existing set. If not present, this call is ignored. Null values are not acceptable.
      Specified by:
      removeRankedCrossRef in interface RankedCrossRefable
      Parameters:
      crossref - the ranked cross reference to remove.
      Throws:
      ChangeVetoException - if the parameter is null.
    • addRankedDocRef

      public void addRankedDocRef(RankedDocRef docref) throws ChangeVetoException
      Adds a ranked docref instance to this bioentry. Must not be null.
      Specified by:
      addRankedDocRef in interface BioEntry
      Parameters:
      docref - the item to add.
      Throws:
      ChangeVetoException - if it doesn't want to add it.
    • removeRankedDocRef

      Removes a ranked docref instance from this bioentry. If it was not found, nothing happens.
      Specified by:
      removeRankedDocRef in interface BioEntry
      Parameters:
      docref - the item to remove.
      Throws:
      ChangeVetoException - if it doesn't want to remove it.
    • addComment

      public void addComment(Comment comment) throws ChangeVetoException
      Adds a comment instance to this bioentry. Must not be null.
      Specified by:
      addComment in interface BioEntry
      Parameters:
      comment - the item to add.
      Throws:
      ChangeVetoException - if it doesn't want to add it.
    • removeComment

      public void removeComment(Comment comment) throws ChangeVetoException
      Removes a comment instance from this bioentry. If it wasn't present, it nothing will happen.
      Specified by:
      removeComment in interface BioEntry
      Parameters:
      comment - the item to remove.
      Throws:
      ChangeVetoException - if it doesn't want to remove it.
    • addRelationship

      Adds a relation instance to this bioentry. It must not be null.
      Specified by:
      addRelationship in interface BioEntry
      Parameters:
      relation - the item to add.
      Throws:
      ChangeVetoException - if it doesn't want to add it.
    • removeRelationship

      Removes a relation instance from this bioentry. If it wasn't present, nothing will happen.
      Specified by:
      removeRelationship in interface BioEntry
      Parameters:
      relation - the item to remove.
      Throws:
      ChangeVetoException - if it doesn't want to remove it.
    • setRankedCrossRefs

      public void setRankedCrossRefs(Set<RankedCrossRef> rankedcrossrefs)
      Description copied from interface: RankedCrossRefable
      Sets the ranked cross references associated with an object. Null will throw an exception but the empty set is fine.
      Specified by:
      setRankedCrossRefs in interface RankedCrossRefable
      Parameters:
      rankedcrossrefs - a set of RankedCrossRef objects.
    • getId

      public Integer getId()
      Gets the Hibernate ID. Should be used with caution.
      Returns:
      the Hibernate ID, if using Hibernate.
    • setId

      public void setId(Integer id)
      Sets the Hibernate ID. Should be used with caution.
      Parameters:
      id - the Hibernate ID, if using Hibernate.