Package fr.becpg.repo.comment.impl
Class CommentThreadServiceImpl
java.lang.Object
fr.becpg.repo.comment.impl.CommentThreadServiceImpl
- All Implemented Interfaces:
CommentThreadService
@Service("commentThreadService")
public class CommentThreadServiceImpl
extends Object
implements CommentThreadService
Keeps comment threads one level deep and their restricted access consistent.
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.commons.logging.Logprivate static final Dateprivate org.alfresco.service.cmr.repository.NodeService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.alfresco.service.cmr.repository.NodeRefattachToThreadRoot(org.alfresco.service.cmr.repository.AssociationRef replyAssocRef) Validates a newly created reply link and moves it onto the thread root when it targets a reply.private voidcheckIsCommentOfSameNode(org.alfresco.service.cmr.repository.NodeRef replyNodeRef, org.alfresco.service.cmr.repository.NodeRef targetNodeRef) private DategetCreated(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) private org.alfresco.service.cmr.repository.NodeRefgetParent(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) List<org.alfresco.service.cmr.repository.NodeRef> getReplies(org.alfresco.service.cmr.repository.NodeRef rootCommentNodeRef) Returns the replies of a root comment, oldest first.org.alfresco.service.cmr.repository.NodeRefgetThreadRoot(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) Returns the root comment of the thread a comment belongs to.voidinheritRestrictedAccess(org.alfresco.service.cmr.repository.NodeRef replyNodeRef) Restricts the reply when the root comment of its thread is restricted, so that an external user never sees a reply to a comment hidden from them.private booleanisRestricted(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) voidrestrictReplies(org.alfresco.service.cmr.repository.NodeRef rootCommentNodeRef) Restricts every reply of a root comment, whoever wrote them.voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) Setter for the fieldnodeService.
-
Field Details
-
logger
private static final org.apache.commons.logging.Log logger -
NO_DATE
-
nodeService
@Autowired private org.alfresco.service.cmr.repository.NodeService nodeService
-
-
Constructor Details
-
CommentThreadServiceImpl
public CommentThreadServiceImpl()
-
-
Method Details
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) Setter for the field
nodeService.- Parameters:
nodeService- the node service
-
getThreadRoot
public org.alfresco.service.cmr.repository.NodeRef getThreadRoot(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) Returns the root comment of the thread a comment belongs to.- Specified by:
getThreadRootin interfaceCommentThreadService- Parameters:
commentNodeRef- a root comment or a reply- Returns:
- the replied comment for a reply, the comment itself otherwise
-
getReplies
public List<org.alfresco.service.cmr.repository.NodeRef> getReplies(org.alfresco.service.cmr.repository.NodeRef rootCommentNodeRef) Returns the replies of a root comment, oldest first.- Specified by:
getRepliesin interfaceCommentThreadService- Parameters:
rootCommentNodeRef- the root comment- Returns:
- the replies, empty when the comment has none
-
attachToThreadRoot
public org.alfresco.service.cmr.repository.NodeRef attachToThreadRoot(org.alfresco.service.cmr.repository.AssociationRef replyAssocRef) Validates a newly created reply link and moves it onto the thread root when it targets a reply.- Specified by:
attachToThreadRootin interfaceCommentThreadService- Parameters:
replyAssocRef- thebcpg:commentReplyToassociation just created- Returns:
- the root comment the reply is now linked to
-
inheritRestrictedAccess
public void inheritRestrictedAccess(org.alfresco.service.cmr.repository.NodeRef replyNodeRef) Restricts the reply when the root comment of its thread is restricted, so that an external user never sees a reply to a comment hidden from them.- Specified by:
inheritRestrictedAccessin interfaceCommentThreadService- Parameters:
replyNodeRef- the reply
-
restrictReplies
public void restrictReplies(org.alfresco.service.cmr.repository.NodeRef rootCommentNodeRef) Restricts every reply of a root comment, whoever wrote them.- Specified by:
restrictRepliesin interfaceCommentThreadService- Parameters:
rootCommentNodeRef- the root comment that has just been restricted
-
checkIsCommentOfSameNode
private void checkIsCommentOfSameNode(org.alfresco.service.cmr.repository.NodeRef replyNodeRef, org.alfresco.service.cmr.repository.NodeRef targetNodeRef) -
getParent
private org.alfresco.service.cmr.repository.NodeRef getParent(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) -
isRestricted
private boolean isRestricted(org.alfresco.service.cmr.repository.NodeRef commentNodeRef) -
getCreated
-