Class CommentLegacy
java.lang.Object
io.goobi.viewer.model.annotation.comments.CommentLegacy
- All Implemented Interfaces:
Comparable<CommentLegacy>
Legacy comment model for migrating user comments from the old persistence format.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Comment instance.CommentLegacy(String pi, int page, User owner, String text, CommentLegacy parent) Creates a new Comment instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves any script tags from the text value.intGetter for the fielddateCreated.Getter for the fielddateUpdated.getDisplayDate(LocalDateTime date) getDisplayDate.getDisplayText.getId()Getter for the fieldid.Getter for the fieldoldText.getOwner()Getter for the fieldowner.getPage()Getter for the fieldpage.getPi()Getter for the fieldpi.getText()Getter for the fieldtext.booleanChecks whether the user with the given ID is allowed to edit this comment (i.e. the annotation belongs to this (proper) user.static booleansendEmailNotifications(CommentLegacy comment, String oldText, Locale locale) Sends an email notification about a new or altered comment to the configured recipient addresses.voidsetDateCreated(LocalDateTime dateCreated) Setter for the fielddateCreated.voidsetDateUpdated(LocalDateTime dateUpdated) Setter for the fielddateUpdated.voidSetter for the fieldid.voidSetter for the fieldowner.voidSetter for the fieldpage.voidSetter for the fieldpi.voidSetter for the fieldtext.
-
Constructor Details
-
CommentLegacy
public CommentLegacy()Creates a new Comment instance. -
CommentLegacy
Creates a new Comment instance.- Parameters:
pi- persistent identifier of the commented recordpage- page number the comment is attached toowner- user who created this commenttext- comment body textparent- unused parent comment (legacy field)
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<CommentLegacy>
-
sendEmailNotifications
Sends an email notification about a new or altered comment to the configured recipient addresses.- Parameters:
comment- comment that was created or modifiedoldText- previous comment text, or empty/null if this is a new commentlocale- Language locale for the email text.- Returns:
- true if the email notification was sent successfully, false otherwise
-
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- user requesting edit access- Returns:
- true if allowed; false otherwise
-
getDisplayDate
getDisplayDate.- Parameters:
date- date and time to format for display- Returns:
- the given date and time formatted as a German date-time string
-
checkAndCleanScripts
public void checkAndCleanScripts()Removes any script tags from the text value. -
getId
Getter for the fieldid.- Returns:
- the database primary key of this comment
-
setId
Setter for the fieldid.- Parameters:
id- the database ID to set
-
getPi
Getter for the fieldpi.- Returns:
- the persistent identifier of the record this comment belongs to
-
setPi
Setter for the fieldpi.- Parameters:
pi- the persistent identifier of the record this comment belongs to
-
getPage
Getter for the fieldpage.- Returns:
- the 1-based page order number within the record this comment targets
-
setPage
Setter for the fieldpage.- Parameters:
page- the 1-based page order number within the record this comment targets
-
getOwner
Getter for the fieldowner.- Returns:
- the user who authored this comment
-
setOwner
Setter for the fieldowner.- Parameters:
owner- the user who authored this comment
-
setText
Setter for the fieldtext.- Parameters:
text- the new comment text; the previous value is preserved inoldText
-
getText
Getter for the fieldtext.- Returns:
- the current comment text
-
getDisplayText
getDisplayText.- Returns:
- the comment text with any JavaScript stripped out
-
getOldText
Getter for the fieldoldText.- Returns:
- the previous comment text before the last update, or null if the text has not been changed
-
getDateCreated
Getter for the fielddateCreated.- Returns:
- the timestamp when this comment was created
-
setDateCreated
Setter for the fielddateCreated.- Parameters:
dateCreated- the creation timestamp to set
-
getDateUpdated
Getter for the fielddateUpdated.- Returns:
- the timestamp when this comment was last updated
-
setDateUpdated
Setter for the fielddateUpdated.- Parameters:
dateUpdated- the last-updated timestamp to set
-
getLinkToRecord
-