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 booleancanUserCreateComment(UserModel user)Evaluates if the given user is allowed to create new comments.booleancanUserDeleteComment(UserModel curentUser, AbstractCommentModel comment)Evaluates if the given user is able to delete given comment from the comment layer component.booleancanUserEditComment(UserModel user, AbstractCommentModel comment)Evaluates if the given user is able to edit given comment from the comment layer component.booleancanUserMoveComment(UserModel user, CommentModel comment)Evaluates if the given user is able to move given comment on the comment layer component.booleancanUserReplyToComment(UserModel user, AbstractCommentModel comment)Evaluates if the given user is able to reply given comment from the comment layer component.booleandeleteComment(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.CommentMetadataModelgetCommentLocationForPreview(CommentModel comment, MediaModel preview)Returns Comment position meta-data of the givenCommentModelinstance 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 CommentTypeModelgetCommentType()protected UserModelgetCurentUser()protected ComponentModelgetCurrentComponent()protected DomainModelgetDomain()CommentModeExecutorgetModeExecutor(java.lang.String mode)ReturnsCommentModeExecutorfor the target mode.voidreplyToComment(java.lang.String text, AbstractCommentModel comment)Replies the given comment instance with the given text value.voidsetCockpitCommentService(CockpitCommentService cockpitCommentService)voidsetCommentsCommands(java.util.Map<java.lang.String,CommentModeExecutor> commentsCommands)voidsetCommentService(CommentService commentService)voidsetUserCanCreateCommentStrategy(CommentPermissionCheckStrategy userCanCreateCommentStrategy)voidsetUserCanDeleteCommentStrategy(CommentPermissionCheckStrategy userCanDeleteCommentStrategy)voidsetUserCanEditCommentStrategy(CommentPermissionCheckStrategy userCanEditCommentStrategy)voidsetUserCanMoveCommentStrategy(CommentPermissionCheckStrategy userCanMoveCommentStrategy)voidsetUserCanReplyCommentStrategy(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:CommentLayerServiceReturn all configured comment-layer modes in a form of 'mode' - 'mode executor' mapping.- Specified by:
getCommentLayerModesin interfaceCommentLayerService
-
canUserEditComment
public boolean canUserEditComment(UserModel user, AbstractCommentModel comment)
Description copied from interface:CommentLayerServiceEvaluates if the given user is able to edit given comment from the comment layer component.- Specified by:
canUserEditCommentin interfaceCommentLayerService- Parameters:
user- - targetUserModelcomment- - targetCommentModel- Returns:
- true or false
-
canUserReplyToComment
public boolean canUserReplyToComment(UserModel user, AbstractCommentModel comment)
Description copied from interface:CommentLayerServiceEvaluates if the given user is able to reply given comment from the comment layer component.- Specified by:
canUserReplyToCommentin interfaceCommentLayerService- Parameters:
user- - targetUserModelcomment- - targetCommentModel- Returns:
- true or false
-
canUserCreateComment
public boolean canUserCreateComment(UserModel user)
Description copied from interface:CommentLayerServiceEvaluates if the given user is allowed to create new comments.- Specified by:
canUserCreateCommentin interfaceCommentLayerService- Returns:
- true or false
-
canUserMoveComment
public boolean canUserMoveComment(UserModel user, CommentModel comment)
Description copied from interface:CommentLayerServiceEvaluates if the given user is able to move given comment on the comment layer component.- Specified by:
canUserMoveCommentin interfaceCommentLayerService- Parameters:
user- - targetUserModelcomment- - targetCommentModel- Returns:
- true or false
-
canUserDeleteComment
public boolean canUserDeleteComment(UserModel curentUser, AbstractCommentModel comment)
Description copied from interface:CommentLayerServiceEvaluates if the given user is able to delete given comment from the comment layer component.- Specified by:
canUserDeleteCommentin interfaceCommentLayerService- Parameters:
curentUser- - targetUserModelcomment- - targetCommentModel- Returns:
- true or false
-
deleteComment
public boolean deleteComment(UserModel user, AbstractCommentModel comment)
Description copied from interface:CommentLayerServiceRemoves the given comment by the user. Checks if the user can remove the comment and if can, removes it.- Specified by:
deleteCommentin 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:CommentLayerServiceReturns all comments for the given page that the target user is eligible to view on the comment layer.- Specified by:
getCommentsForCommentLayerin interfaceCommentLayerService- Parameters:
user- - targetUserModelitem- - target itemItemModel- Returns:
- List of
CommentModels
-
filterCommentsWithoutPositionMetaData
protected java.util.List<CommentModel> filterCommentsWithoutPositionMetaData(java.util.List<CommentModel> input)
-
getModeExecutor
public CommentModeExecutor getModeExecutor(java.lang.String mode)
Description copied from interface:CommentLayerServiceReturnsCommentModeExecutorfor the target mode. Use any custom mode or one of out-of-the-box comment layer modes.- Specified by:
getModeExecutorin interfaceCommentLayerService- Parameters:
mode- target mode
-
getCommentLocationForPreview
public CommentMetadataModel getCommentLocationForPreview(CommentModel comment, MediaModel preview)
Description copied from interface:CommentLayerServiceReturns Comment position meta-data of the givenCommentModelinstance for the given preview media.- Specified by:
getCommentLocationForPreviewin interfaceCommentLayerService- Parameters:
comment- -CommentModelpreview- - 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:CommentLayerServiceReplies the given comment instance with the given text value.- Specified by:
replyToCommentin interfaceCommentLayerService- Parameters:
text- - text of the replycomment- -AbstractCommentModelinstance 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)
-
-