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
ConstructorDescriptionCommentManager
(AnnotationSaver saver, AnnotationDeleter deleter, AnnotationLister<Comment> lister, ChangeNotificator... notificators) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
checkAndCleanScripts
(String text, User editor, String pi, Integer page) void
createComment
(String text, User creator, String pi, Integer pageOrder, String license, PublicationStatus publicationStatus) void
deleteComment
(Comment comment) void
editComment
(Comment comment, String text, User editor, PublicationStatus publicationStatus) getAnnotation
(Long id) long
getAnnotationCount
(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>
long
static boolean
Checks whether the given user has access to any comment groups, whether via being admin or owner or member of any linked user group.static boolean
queryCommentGroupIdentifiers
(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:
getAllAnnotations
in interfaceAnnotationLister<Comment>
-
getTotalAnnotationCount
public long getTotalAnnotationCount()- Specified by:
getTotalAnnotationCount
in 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:
getAnnotations
in interfaceAnnotationLister<Comment>
-
getAnnotationCount
public long getAnnotationCount(String textQuery, List<String> motivations, List<Long> generators, List<Long> creators, String targetPi, Integer targetPage) - Specified by:
getAnnotationCount
in interfaceAnnotationLister<Comment>
-
checkAndCleanScripts
- Parameters:
text
-editor
-pi
-page
-- Returns:
- text stripped of any JS
-
getAnnotation
- Specified by:
getAnnotation
in interfaceAnnotationLister<Comment>
-
getRelevantCommentGroupsForRecord
public static Set<CommentGroup> getRelevantCommentGroupsForRecord(String pi) throws DAOException, PresentationException, IndexUnreachableException - Parameters:
pi
-- Returns:
- Set
- Throws:
DAOException
PresentationException
IndexUnreachableException
-
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:
PresentationException
IndexUnreachableException
-
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
-