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

    Fields
    Modifier and Type
    Field
    Description
    private static final org.apache.commons.logging.Log
     
    private static final Date
     
    private org.alfresco.service.cmr.repository.NodeService
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    private void
    checkIsCommentOfSameNode(org.alfresco.service.cmr.repository.NodeRef replyNodeRef, org.alfresco.service.cmr.repository.NodeRef targetNodeRef)
     
    private Date
    getCreated(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
     
    private org.alfresco.service.cmr.repository.NodeRef
    getParent(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.NodeRef
    getThreadRoot(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
    Returns the root comment of the thread a comment belongs to.
    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.
    private boolean
    isRestricted(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)
     
    void
    restrictReplies(org.alfresco.service.cmr.repository.NodeRef rootCommentNodeRef)
    Restricts every reply of a root comment, whoever wrote them.
    void
    setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
    Setter for the field nodeService.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final org.apache.commons.logging.Log logger
    • NO_DATE

      private static final Date 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:
      getThreadRoot in interface CommentThreadService
      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:
      getReplies in interface CommentThreadService
      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:
      attachToThreadRoot in interface CommentThreadService
      Parameters:
      replyAssocRef - the bcpg:commentReplyTo association 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:
      inheritRestrictedAccess in interface CommentThreadService
      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:
      restrictReplies in interface CommentThreadService
      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

      private Date getCreated(org.alfresco.service.cmr.repository.NodeRef commentNodeRef)