Class PersistentAnnotation

java.lang.Object
io.goobi.viewer.model.annotation.PersistentAnnotation
Direct Known Subclasses:
Comment, CrowdsourcingAnnotation, GeneralAnnotation

@Entity public abstract class PersistentAnnotation extends Object
Author:
Florian Alpers
  • Constructor Details

    • PersistentAnnotation

      protected PersistentAnnotation()
      Empty constructor.
    • PersistentAnnotation

      protected PersistentAnnotation(PersistentAnnotation source)
      Parameters:
      source - annotation to copy all fields from
    • PersistentAnnotation

      protected PersistentAnnotation(de.intranda.api.annotation.AbstractAnnotation source, Long id, String targetPI, Integer targetPage)
      Creates a new PersistentAnnotation from a WebAnnotation.
      Parameters:
      source - a WebAnnotation object.
      id - database ID to assign to this annotation
      targetPI - persistent identifier of the target record
      targetPage - physical page order of the target page
  • Method Details

    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database primary key of this annotation
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - the database ID to set
    • getDateCreated

      public LocalDateTime getDateCreated()
      Getter for the field dateCreated.
      Returns:
      the timestamp when this annotation was created
    • setDateCreated

      public void setDateCreated(LocalDateTime dateCreated)
      Setter for the field dateCreated.
      Parameters:
      dateCreated - the creation timestamp to set
    • getDateModified

      public LocalDateTime getDateModified()
      Getter for the field dateModified.
      Returns:
      the timestamp when this annotation was last modified
    • setDateModified

      public void setDateModified(LocalDateTime dateModified)
      Setter for the field dateModified.
      Parameters:
      dateModified - the last-modified timestamp to set
    • getCreator

      public User getCreator() throws DAOException
      getCreator.
      Returns:
      the user who created this annotation, or null if no creator is recorded
      Throws:
      DAOException - if any.
    • getCreatorIfPresent

      public Optional<User> getCreatorIfPresent()
    • setCreator

      public void setCreator(User creator)
      setCreator.
      Parameters:
      creator - the user who created this annotation; also updates creatorId
    • getReviewer

      public User getReviewer() throws DAOException
      getReviewer.
      Returns:
      the user assigned to review this annotation, or null if no reviewer is set
      Throws:
      DAOException - if any.
    • setReviewer

      public void setReviewer(User reviewer)
      setReviewer.
      Parameters:
      reviewer - the user assigned to review this annotation; also updates reviewerId
    • getGenerator

      public Question getGenerator() throws DAOException
      getGenerator.
      Returns:
      the crowdsourcing question that generated this annotation, or null if none
      Throws:
      DAOException - if any.
    • setGenerator

      public void setGenerator(Question generator)
      setGenerator.
      Parameters:
      generator - the crowdsourcing question that generated this annotation; its ID is stored in generatorId
    • getCreatorId

      public Long getCreatorId()
      Getter for the field creatorId.
      Returns:
      the database ID of the user who created this annotation
    • setCreatorId

      public void setCreatorId(Long creatorId)
      Setter for the field creatorId.
      Parameters:
      creatorId - the database ID of the user who created this annotation
    • getReviewerId

      public Long getReviewerId()
      Getter for the field reviewerId.
      Returns:
      the database ID of the user assigned to review this annotation
    • setReviewerId

      public void setReviewerId(Long reviewerId)
      Setter for the field reviewerId.
      Parameters:
      reviewerId - the database ID of the user assigned to review this annotation
    • getGeneratorId

      public Long getGeneratorId()
      Getter for the field generatorId.
      Returns:
      the database ID of the crowdsourcing question that generated this annotation
    • setGeneratorId

      public void setGeneratorId(Long generatorId)
      Setter for the field generatorId.
      Parameters:
      generatorId - the database ID of the crowdsourcing question that generated this annotation
    • getBody

      public String getBody()
      Getter for the field body.
      Returns:
      the annotation body content (typically a JSON-LD or plain-text value)
    • setBody

      public void setBody(String body)
      Setter for the field body.
      Parameters:
      body - the annotation body content (typically a JSON-LD or plain-text value)
    • getMotivation

      public String getMotivation()
      Getter for the field motivation.
      Returns:
      the Web Annotation motivation URI (e.g. "commenting", "tagging")
    • setMotivation

      public void setMotivation(String motivation)
      Setter for the field motivation.
      Parameters:
      motivation - the Web Annotation motivation URI (e.g. "commenting", "tagging")
    • getTarget

      public String getTarget()
      Getter for the field target.
      Returns:
      the Web Annotation target URI identifying the resource this annotation targets
    • getTargetPI

      public String getTargetPI()
      Getter for the field targetPI.
      Returns:
      the persistent identifier of the record this annotation targets
    • getTargetPageOrder

      public Integer getTargetPageOrder()
      Getter for the field targetPageOrder.
      Returns:
      the 1-based page order number within the record this annotation targets
    • setTargetPI

      public void setTargetPI(String targetPI)
      Setter for the field targetPI.
      Parameters:
      targetPI - the persistent identifier of the record this annotation targets
    • setTargetPageOrder

      public void setTargetPageOrder(Integer targetPageOrder)
      Setter for the field targetPageOrder.
      Parameters:
      targetPageOrder - the 1-based page order number within the target record, or null if the annotation targets the whole record
    • setTarget

      public void setTarget(String target)
      Setter for the field target.
      Parameters:
      target - the serialized target descriptor (URI or JSON-LD specific resource)
    • deleteExportedTextFiles

      public int deleteExportedTextFiles() throws ViewerConfigurationException
      Deletes exported JSON annotations from a related record's data folder. Should be called when deleting this annotation.
      Returns:
      Number of deleted files
      Throws:
      ViewerConfigurationException - if any.
    • getContentString

      public String getContentString()
      getContentString.
      Returns:
      Just the string value of the body document
      Throws:
      com.fasterxml.jackson.core.JsonParseException - if any.
      com.fasterxml.jackson.databind.JsonMappingException - if any.
      IOException - if any.
      DAOException - if any.
    • getTargetLink

      public String getTargetLink()
      getTargetLink.
      Returns:
      URL string to the record view
    • getAccessCondition

      public String getAccessCondition()
    • setAccessCondition

      public void setAccessCondition(String accessCondition)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDisplayDate

      public String getDisplayDate(LocalDateTime date)
    • mayEdit

      public boolean mayEdit(User user)
      Checks whether the user with the given ID is allowed to edit this comment (i.e. the annotation belongs to this (proper) user.
      Parameters:
      user - a User object.
      Returns:
      true if allowed; false otherwise
    • getPublicationStatus

      public PublicationStatus getPublicationStatus()
    • setPublicationStatus

      public void setPublicationStatus(PublicationStatus publicationStatus)
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object