Class CommentManager
java.lang.Object
io.goobi.viewer.model.annotation.comments.CommentManager
- All Implemented Interfaces:
AnnotationLister<Comment>
Class to create comments from a text input for a given PI and page order and to save them using a given
AnnotationSaver- Author:
- florian
-
Constructor Summary
ConstructorsConstructorDescriptionCommentManager(AnnotationSaver saver, AnnotationDeleter deleter, AnnotationLister<Comment> lister, ChangeNotificator... notificators) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcheckAndCleanScripts(String text, User editor, String pi, Integer page) voidcreateComment(String text, User creator, String pi, Integer pageOrder, String license, PublicationStatus publicationStatus) voiddeleteComment(Comment comment) voideditComment(Comment comment, String text, User editor, PublicationStatus publicationStatus) getAnnotation(Long id) longgetAnnotationCount(String textQuery, List<String> motivations, List<Long> generators, List<Long> creators, String targetPi, Integer targetPage) getAnnotations(int firstIndex, int items, String textQuery, List<String> motivations, List<Long> generators, List<Long> creators, String targetPi, Integer targetPage, String sortField, boolean sortDescending) static Set<CommentGroup> longstatic booleanChecks whether the given user has access to any comment groups, whether via being admin or owner or member of any linked user group.static booleanqueryCommentGroupIdentifiers(CommentGroup commentGroup)
-
Constructor Details
-
CommentManager
public CommentManager(AnnotationSaver saver, AnnotationDeleter deleter, AnnotationLister<Comment> lister, ChangeNotificator... notificators) - Parameters:
saver-deleter-lister-notificators-
-
-
Method Details
-
createComment
public void createComment(String text, User creator, String pi, Integer pageOrder, String license, PublicationStatus publicationStatus) - Parameters:
text-creator-pi-pageOrder-license-publicationStatus-
-
editComment
public void editComment(Comment comment, String text, User editor, PublicationStatus publicationStatus) - Parameters:
comment-text-editor-publicationStatus-
-
deleteComment
- Parameters:
comment-
-
getAllAnnotations
- Specified by:
getAllAnnotationsin interfaceAnnotationLister<Comment>
-
getTotalAnnotationCount
public long getTotalAnnotationCount()- Specified by:
getTotalAnnotationCountin interfaceAnnotationLister<Comment>
-
getAnnotations
public List<Comment> getAnnotations(int firstIndex, int items, String textQuery, List<String> motivations, List<Long> generators, List<Long> creators, String targetPi, Integer targetPage, String sortField, boolean sortDescending) - Specified by:
getAnnotationsin interfaceAnnotationLister<Comment>
-
getAnnotationCount
public long getAnnotationCount(String textQuery, List<String> motivations, List<Long> generators, List<Long> creators, String targetPi, Integer targetPage) - Specified by:
getAnnotationCountin interfaceAnnotationLister<Comment>
-
checkAndCleanScripts
- Parameters:
text-editor-pi-page-- Returns:
- text stripped of any JS
-
getAnnotation
- Specified by:
getAnnotationin interfaceAnnotationLister<Comment>
-
getRelevantCommentGroupsForRecord
public static Set<CommentGroup> getRelevantCommentGroupsForRecord(String pi) throws DAOException, PresentationException, IndexUnreachableException - Parameters:
pi-- Returns:
- Set
- Throws:
DAOExceptionPresentationExceptionIndexUnreachableException
-
queryCommentGroupIdentifiers
public static boolean queryCommentGroupIdentifiers(CommentGroup commentGroup) throws PresentationException, IndexUnreachableException - Parameters:
commentGroup-- Returns:
- true if commentGroup query has matching identifiers in the index; false otherwise
- Throws:
PresentationExceptionIndexUnreachableException
-
isUserHasAccessToCommentGroups
Checks whether the given user has access to any comment groups, whether via being admin or owner or member of any linked user group.- Parameters:
user-- Returns:
- true if user has access; false otherwise
- Throws:
DAOException
-