Class DefaultCommentLayerService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.cockpit.services.comments.impl.DefaultCommentLayerService
-
- All Implemented Interfaces:
CommentLayerService
,java.io.Serializable
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
public class DefaultCommentLayerService extends AbstractBusinessService implements CommentLayerService
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultCommentLayerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canUserCreateComment(UserModel user)
Evaluates if the given user is allowed to create new comments.boolean
canUserDeleteComment(UserModel curentUser, 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.protected java.util.List<CommentModel>
filterCommentsWithoutPositionMetaData(java.util.List<CommentModel> input)
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.protected CommentTypeModel
getCommentType()
protected UserModel
getCurentUser()
protected ComponentModel
getCurrentComponent()
protected DomainModel
getDomain()
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.void
setCockpitCommentService(CockpitCommentService cockpitCommentService)
void
setCommentsCommands(java.util.Map<java.lang.String,CommentModeExecutor> commentsCommands)
void
setCommentService(CommentService commentService)
void
setUserCanCreateCommentStrategy(CommentPermissionCheckStrategy userCanCreateCommentStrategy)
void
setUserCanDeleteCommentStrategy(CommentPermissionCheckStrategy userCanDeleteCommentStrategy)
void
setUserCanEditCommentStrategy(CommentPermissionCheckStrategy userCanEditCommentStrategy)
void
setUserCanMoveCommentStrategy(CommentPermissionCheckStrategy userCanMoveCommentStrategy)
void
setUserCanReplyCommentStrategy(CommentPermissionCheckStrategy userCanReplyCommentStrategy)
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
getCommentLayerModes
public java.util.Map<java.lang.String,CommentModeExecutor> getCommentLayerModes()
Description copied from interface:CommentLayerService
Return all configured comment-layer modes in a form of 'mode' - 'mode executor' mapping.- Specified by:
getCommentLayerModes
in interfaceCommentLayerService
-
canUserEditComment
public boolean canUserEditComment(UserModel user, AbstractCommentModel comment)
Description copied from interface:CommentLayerService
Evaluates if the given user is able to edit given comment from the comment layer component.- Specified by:
canUserEditComment
in interfaceCommentLayerService
- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
canUserReplyToComment
public boolean canUserReplyToComment(UserModel user, AbstractCommentModel comment)
Description copied from interface:CommentLayerService
Evaluates if the given user is able to reply given comment from the comment layer component.- Specified by:
canUserReplyToComment
in interfaceCommentLayerService
- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
canUserCreateComment
public boolean canUserCreateComment(UserModel user)
Description copied from interface:CommentLayerService
Evaluates if the given user is allowed to create new comments.- Specified by:
canUserCreateComment
in interfaceCommentLayerService
- Returns:
- true or false
-
canUserMoveComment
public boolean canUserMoveComment(UserModel user, CommentModel comment)
Description copied from interface:CommentLayerService
Evaluates if the given user is able to move given comment on the comment layer component.- Specified by:
canUserMoveComment
in interfaceCommentLayerService
- Parameters:
user
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
canUserDeleteComment
public boolean canUserDeleteComment(UserModel curentUser, AbstractCommentModel comment)
Description copied from interface:CommentLayerService
Evaluates if the given user is able to delete given comment from the comment layer component.- Specified by:
canUserDeleteComment
in interfaceCommentLayerService
- Parameters:
curentUser
- - targetUserModel
comment
- - targetCommentModel
- Returns:
- true or false
-
deleteComment
public boolean deleteComment(UserModel user, AbstractCommentModel comment)
Description copied from interface:CommentLayerService
Removes the given comment by the user. Checks if the user can remove the comment and if can, removes it.- Specified by:
deleteComment
in interfaceCommentLayerService
- Parameters:
user
- - user who tries to remove the commentcomment
- - comment to remove
-
getCommentsForCommentLayer
public java.util.List<CommentModel> getCommentsForCommentLayer(UserModel user, ItemModel item)
Description copied from interface:CommentLayerService
Returns all comments for the given page that the target user is eligible to view on the comment layer.- Specified by:
getCommentsForCommentLayer
in interfaceCommentLayerService
- Parameters:
user
- - targetUserModel
item
- - target itemItemModel
- Returns:
- List of
CommentModel
s
-
filterCommentsWithoutPositionMetaData
protected java.util.List<CommentModel> filterCommentsWithoutPositionMetaData(java.util.List<CommentModel> input)
-
getModeExecutor
public CommentModeExecutor getModeExecutor(java.lang.String mode)
Description copied from interface:CommentLayerService
ReturnsCommentModeExecutor
for the target mode. Use any custom mode or one of out-of-the-box comment layer modes.- Specified by:
getModeExecutor
in interfaceCommentLayerService
- Parameters:
mode
- target mode
-
getCommentLocationForPreview
public CommentMetadataModel getCommentLocationForPreview(CommentModel comment, MediaModel preview)
Description copied from interface:CommentLayerService
Returns Comment position meta-data of the givenCommentModel
instance for the given preview media.- Specified by:
getCommentLocationForPreview
in interfaceCommentLayerService
- Parameters:
comment
- -CommentModel
preview
- - comment layer target :CommentLayerComponentModel.getCommentLayerTarget()
-
getCurentUser
protected UserModel getCurentUser()
-
getDomain
protected DomainModel getDomain()
-
getCurrentComponent
protected ComponentModel getCurrentComponent()
-
getCommentType
protected CommentTypeModel getCommentType()
-
setCommentsCommands
public void setCommentsCommands(java.util.Map<java.lang.String,CommentModeExecutor> commentsCommands)
-
replyToComment
public void replyToComment(java.lang.String text, AbstractCommentModel comment)
Description copied from interface:CommentLayerService
Replies the given comment instance with the given text value.- Specified by:
replyToComment
in interfaceCommentLayerService
- Parameters:
text
- - text of the replycomment
- -AbstractCommentModel
instance to reply.
-
setUserCanDeleteCommentStrategy
public void setUserCanDeleteCommentStrategy(CommentPermissionCheckStrategy userCanDeleteCommentStrategy)
-
setUserCanMoveCommentStrategy
public void setUserCanMoveCommentStrategy(CommentPermissionCheckStrategy userCanMoveCommentStrategy)
-
setUserCanCreateCommentStrategy
public void setUserCanCreateCommentStrategy(CommentPermissionCheckStrategy userCanCreateCommentStrategy)
-
setUserCanEditCommentStrategy
public void setUserCanEditCommentStrategy(CommentPermissionCheckStrategy userCanEditCommentStrategy)
-
setUserCanReplyCommentStrategy
public void setUserCanReplyCommentStrategy(CommentPermissionCheckStrategy userCanReplyCommentStrategy)
-
setCockpitCommentService
public void setCockpitCommentService(CockpitCommentService cockpitCommentService)
-
setCommentService
public void setCommentService(CommentService commentService)
-
-