Package io.goobi.viewer.model.annotation
Class PersistentAnnotation
java.lang.Object
io.goobi.viewer.model.annotation.PersistentAnnotation
- Direct Known Subclasses:
Comment,CrowdsourcingAnnotation,GeneralAnnotation
- Author:
- Florian Alpers
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor.protectedPersistentAnnotation(de.intranda.api.annotation.AbstractAnnotation source, Long id, String targetPI, Integer targetPage) Creates a new PersistentAnnotation from a WebAnnotation.protected -
Method Summary
Modifier and TypeMethodDescriptionintDeletes exported JSON annotations from a related record's data folder.booleangetBody()Getter for the fieldbody.getContentString.getCreator.Getter for the fieldcreatorId.Getter for the fielddateCreated.Getter for the fielddateModified.getDisplayDate(LocalDateTime date) getGenerator.Getter for the fieldgeneratorId.getId()Getter for the fieldid.Getter for the fieldmotivation.getReviewer.Getter for the fieldreviewerId.Getter for the fieldtarget.getTargetLink.Getter for the fieldtargetPageOrder.Getter for the fieldtargetPI.inthashCode()booleanChecks whether the user with the given ID is allowed to edit this comment (i.e. the annotation belongs to this (proper) user.voidsetAccessCondition(String accessCondition) voidSetter for the fieldbody.voidsetCreator(User creator) setCreator.voidsetCreatorId(Long creatorId) Setter for the fieldcreatorId.voidsetDateCreated(LocalDateTime dateCreated) Setter for the fielddateCreated.voidsetDateModified(LocalDateTime dateModified) Setter for the fielddateModified.voidsetGenerator(Question generator) setGenerator.voidsetGeneratorId(Long generatorId) Setter for the fieldgeneratorId.voidSetter for the fieldid.voidsetMotivation(String motivation) Setter for the fieldmotivation.voidsetPublicationStatus(PublicationStatus publicationStatus) voidsetReviewer(User reviewer) setReviewer.voidsetReviewerId(Long reviewerId) Setter for the fieldreviewerId.voidSetter for the fieldtarget.voidsetTargetPageOrder(Integer targetPageOrder) Setter for the fieldtargetPageOrder.voidsetTargetPI(String targetPI) Setter for the fieldtargetPI.toString()
-
Constructor Details
-
PersistentAnnotation
protected PersistentAnnotation()Empty constructor. -
PersistentAnnotation
- 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- aWebAnnotationobject.id- database ID to assign to this annotationtargetPI- persistent identifier of the target recordtargetPage- physical page order of the target page
-
-
Method Details
-
getId
Getter for the fieldid.- Returns:
- the database primary key of this annotation
-
setId
Setter for the fieldid.- Parameters:
id- the database ID to set
-
getDateCreated
Getter for the fielddateCreated.- Returns:
- the timestamp when this annotation was created
-
setDateCreated
Setter for the fielddateCreated.- Parameters:
dateCreated- the creation timestamp to set
-
getDateModified
Getter for the fielddateModified.- Returns:
- the timestamp when this annotation was last modified
-
setDateModified
Setter for the fielddateModified.- Parameters:
dateModified- the last-modified timestamp to set
-
getCreator
getCreator.- Returns:
- the user who created this annotation, or null if no creator is recorded
- Throws:
DAOException- if any.
-
getCreatorIfPresent
-
setCreator
setCreator.- Parameters:
creator- the user who created this annotation; also updatescreatorId
-
getReviewer
getReviewer.- Returns:
- the user assigned to review this annotation, or null if no reviewer is set
- Throws:
DAOException- if any.
-
setReviewer
setReviewer.- Parameters:
reviewer- the user assigned to review this annotation; also updatesreviewerId
-
getGenerator
getGenerator.- Returns:
- the crowdsourcing question that generated this annotation, or null if none
- Throws:
DAOException- if any.
-
setGenerator
setGenerator.- Parameters:
generator- the crowdsourcing question that generated this annotation; its ID is stored ingeneratorId
-
getCreatorId
Getter for the fieldcreatorId.- Returns:
- the database ID of the user who created this annotation
-
setCreatorId
Setter for the fieldcreatorId.- Parameters:
creatorId- the database ID of the user who created this annotation
-
getReviewerId
Getter for the fieldreviewerId.- Returns:
- the database ID of the user assigned to review this annotation
-
setReviewerId
Setter for the fieldreviewerId.- Parameters:
reviewerId- the database ID of the user assigned to review this annotation
-
getGeneratorId
Getter for the fieldgeneratorId.- Returns:
- the database ID of the crowdsourcing question that generated this annotation
-
setGeneratorId
Setter for the fieldgeneratorId.- Parameters:
generatorId- the database ID of the crowdsourcing question that generated this annotation
-
getBody
Getter for the fieldbody.- Returns:
- the annotation body content (typically a JSON-LD or plain-text value)
-
setBody
Setter for the fieldbody.- Parameters:
body- the annotation body content (typically a JSON-LD or plain-text value)
-
getMotivation
Getter for the fieldmotivation.- Returns:
- the Web Annotation motivation URI (e.g. "commenting", "tagging")
-
setMotivation
Setter for the fieldmotivation.- Parameters:
motivation- the Web Annotation motivation URI (e.g. "commenting", "tagging")
-
getTarget
Getter for the fieldtarget.- Returns:
- the Web Annotation target URI identifying the resource this annotation targets
-
getTargetPI
Getter for the fieldtargetPI.- Returns:
- the persistent identifier of the record this annotation targets
-
getTargetPageOrder
Getter for the fieldtargetPageOrder.- Returns:
- the 1-based page order number within the record this annotation targets
-
setTargetPI
Setter for the fieldtargetPI.- Parameters:
targetPI- the persistent identifier of the record this annotation targets
-
setTargetPageOrder
Setter for the fieldtargetPageOrder.- Parameters:
targetPageOrder- the 1-based page order number within the target record, or null if the annotation targets the whole record
-
setTarget
Setter for the fieldtarget.- Parameters:
target- the serialized target descriptor (URI or JSON-LD specific resource)
-
deleteExportedTextFiles
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
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
getTargetLink.- Returns:
- URL string to the record view
-
getAccessCondition
-
setAccessCondition
-
toString
-
getDisplayDate
-
mayEdit
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- aUserobject.- Returns:
- true if allowed; false otherwise
-
getPublicationStatus
-
setPublicationStatus
-
hashCode
public int hashCode() -
equals
-