Interface CommentLayerService
-
- All Known Implementing Classes:
DefaultCommentLayerService
public interface CommentLayerService
Service focused on comment layer - component that should be transparent over the preview content. It contains comments and markups related to the currently displayed preview.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canUserCreateComment(UserModel user)
Evaluates if the given user is allowed to create new comments.boolean
canUserDeleteComment(UserModel user, AbstractCommentModel comment)
Evaluates if the given user is able to delete given comment from the comment layer component.boolean
canUserEditComment(UserModel user, AbstractCommentModel comment)
Evaluates if the given user is able to edit given comment from the comment layer component.boolean
canUserMoveComment(UserModel user, CommentModel comment)
Evaluates if the given user is able to move given comment on the comment layer component.boolean
canUserReplyToComment(UserModel user, AbstractCommentModel comment)
Evaluates if the given user is able to reply given comment from the comment layer component.boolean
deleteComment(UserModel user, AbstractCommentModel comment)
Removes the given comment by the user.java.util.Map<java.lang.String,CommentModeExecutor>
getCommentLayerModes()
Return all configured comment-layer modes in a form of 'mode' - 'mode executor' mapping.CommentMetadataModel
getCommentLocationForPreview(CommentModel comment, MediaModel preview)
Returns Comment position meta-data of the givenCommentModel
instance for the given preview media.java.util.List<CommentModel>
getCommentsForCommentLayer(UserModel user, ItemModel item)
Returns all comments for the given page that the target user is eligible to view on the comment layer.CommentModeExecutor
getModeExecutor(java.lang.String mode)
ReturnsCommentModeExecutor
for the target mode.void
replyToComment(java.lang.String text, AbstractCommentModel comment)
Replies the given comment instance with the given text value.
-
-
-
Method Detail
-
getCommentLayerModes
java.util.Map<java.lang.String,CommentModeExecutor> getCommentLayerModes()
Return all configured comment-layer modes in a form of 'mode' - 'mode executor' mapping.
-
getModeExecutor
CommentModeExecutor getModeExecutor(java.lang.String mode)
ReturnsCommentModeExecutor
for the target mode. Use any custom mode or one of out-of-the-box comment layer modes.- Parameters:
mode
- target mode- Throws:
UnknownIdentifierException
- if no executor found for the given mode
-
deleteComment
boolean deleteComment(UserModel user, AbstractCommentModel comment)
Removes the given comment by the user. Checks if the user can remove the comment and if can, removes it.- Parameters:
user
- - user who tries to remove the commentcomment
- - comment to remove
-
getCommentsForCommentLayer
java.util.List<CommentModel> getCommentsForCommentLayer(UserModel user, ItemModel item)
Returns all comments for the given page that the target user is eligible to view on the comment layer.- Parameters:
user
- - targetUserModel
item
- - target itemItemModel
- Returns:
- List of
CommentModel
s - Throws:
java.lang.IllegalArgumentException
- is either user or page is null
-
getCommentLocationForPreview
CommentMetadataModel getCommentLocationForPreview(CommentModel comment, MediaModel preview)
Returns Comment position meta-data of the givenCommentModel
instance for the given preview media.- Parameters:
comment
- -CommentModel
preview
- - comment layer target :CommentLayerComponentModel.getCommentLayerTarget()
-
canUserEditComment
boolean canUserEditComment(UserModel user, AbstractCommentModel comment)
Evaluates if the given user is able to edit given comment from the comment layer component.- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
canUserReplyToComment
boolean canUserReplyToComment(UserModel user, AbstractCommentModel comment)
Evaluates if the given user is able to reply given comment from the comment layer component.- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
canUserDeleteComment
boolean canUserDeleteComment(UserModel user, AbstractCommentModel comment)
Evaluates if the given user is able to delete given comment from the comment layer component.- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
replyToComment
void replyToComment(java.lang.String text, AbstractCommentModel comment)
Replies the given comment instance with the given text value.- Parameters:
text
- - text of the replycomment
- -AbstractCommentModel
instance to reply.
-
canUserMoveComment
boolean canUserMoveComment(UserModel user, CommentModel comment)
Evaluates if the given user is able to move given comment on the comment layer component.- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
canUserCreateComment
boolean canUserCreateComment(UserModel user)
Evaluates if the given user is allowed to create new comments.- Parameters:
user
-- Returns:
- true or false
-
-