Package io.goobi.viewer.managedbeans
Class CommentBean
java.lang.Object
io.goobi.viewer.managedbeans.CommentBean
- All Implemented Interfaces:
Serializable
JSF backing bean for user comment display and submission on record detail pages.
- Author:
- Florian Alpers
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateComment(String text, boolean restricted) createComment.voiddeleteComment.voiddeleteComment(Comment annotation) deleteComment.voideditComment.voideditComment(Comment original, String text, boolean restricted) editComment.getComments(int startIndex, int numItems, String filter, User user, String sortField, boolean descending) getComments.getCommentsForCurrentPage.booleanChecks whether the current user may delete comments for the given record identifier, based on their admin status or membership in any user group that has such permission via comment groups.booleanChecks whether the current user may edit comments for the given record identifier, based on their admin status or membership in any user group that has such permission via comment groups.booleanisRestricted.booleanisUserCommentsEnabled.
-
Constructor Details
-
CommentBean
Creates a new CommentBean instance.
-
-
Method Details
-
createComment
createComment.- Parameters:
text- comment body textrestricted- if true, apply restricted license requiring comment privileges- Throws:
AjaxResponseException
-
editComment
editComment.- Throws:
PresentationException
-
editComment
public void editComment(Comment original, String text, boolean restricted) throws DAOException, PresentationException, IndexUnreachableException editComment.- Parameters:
original- existing comment to be updatedtext- new comment body textrestricted- if true, apply restricted license requiring comment privileges- Throws:
DAOExceptionPresentationExceptionIndexUnreachableException
-
deleteComment
deleteComment. -
deleteComment
public void deleteComment(Comment annotation) throws DAOException, PresentationException, IndexUnreachableException deleteComment.- Parameters:
annotation- comment to be deleted- Throws:
DAOExceptionPresentationExceptionIndexUnreachableException
-
getComments
public List<Comment> getComments(int startIndex, int numItems, String filter, User user, String sortField, boolean descending) getComments.- Parameters:
startIndex- zero-based index of the first result to returnnumItems- maximum number of comments to returnfilter- text filter applied to comment contentuser- user whose comments are listedsortField- name of the field to sort results bydescending- if true, sort in descending order- Returns:
- List of comments that match the search criteria
-
getCommentsForCurrentPage
getCommentsForCurrentPage.- Returns:
- List of comments for the current page of the loaded record
- Throws:
IndexUnreachableException
-
isRestricted
isRestricted.- Parameters:
anno- annotation whose access condition is checked- Returns:
- true if given annotation requires special privileges for commenting; false otherwise
-
isUserCommentsEnabled
isUserCommentsEnabled.- Returns:
- true if the user comments feature is globally enabled, false otherwise
- Throws:
DAOException
-
isMayEditCommentsForRecord
public boolean isMayEditCommentsForRecord(String pi) throws DAOException, PresentationException, IndexUnreachableException Checks whether the current user may edit comments for the given record identifier, based on their admin status or membership in any user group that has such permission via comment groups.- Parameters:
pi- Record identifier- Returns:
- true if logged in user may edit comments for record with given PI; false otherwise
- Throws:
DAOExceptionPresentationExceptionIndexUnreachableException
-
isMayDeleteCommentsForRecord
public boolean isMayDeleteCommentsForRecord(String pi) throws DAOException, PresentationException, IndexUnreachableException Checks whether the current user may delete comments for the given record identifier, based on their admin status or membership in any user group that has such permission via comment groups.- Parameters:
pi- Record identifier- Returns:
- true if logged in user may delete comments for record with given PI; false otherwise
- Throws:
DAOExceptionPresentationExceptionIndexUnreachableException
-