Class AbstractCommentManager

java.lang.Object
org.nuxeo.ecm.platform.comment.impl.AbstractCommentManager
All Implemented Interfaces:
CommentManager
Direct Known Subclasses:
BridgeCommentManager, CommentManagerImpl, PropertyCommentManager, TreeCommentManager

public abstract class AbstractCommentManager extends Object implements CommentManager
Since:
10.3
  • Field Details

  • Constructor Details

    • AbstractCommentManager

      public AbstractCommentManager()
  • Method Details

    • getComments

      public List<DocumentModel> getComments(DocumentModel docModel)
      Description copied from interface: CommentManager
      Gets comments of a document.
      Specified by:
      getComments in interface CommentManager
      Parameters:
      docModel - the document model
      Returns:
      the list of comments
    • getComments

      public List<DocumentModel> getComments(DocumentModel docModel, DocumentModel parent)
      Description copied from interface: CommentManager
      Get comments of a document.
      Specified by:
      getComments in interface CommentManager
      Parameters:
      docModel - the document model
      parent - the parent document model
      Returns:
      the list of comments
    • getComments

      public List<Comment> getComments(CoreSession session, String documentId)
      Description copied from interface: CommentManager
      Gets all comments for a document.
      Specified by:
      getComments in interface CommentManager
      Parameters:
      session - the core session
      documentId - the document id
      Returns:
      the list of comments, ordered ascending by comment's creation date, or an empty list if no comment is found.
    • getComments

      public List<Comment> getComments(CoreSession session, String documentId, boolean sortAscending)
      Description copied from interface: CommentManager
      Gets all comments for a document.
      Specified by:
      getComments in interface CommentManager
      Parameters:
      session - the core session
      documentId - the document id
      sortAscending - whether to sort ascending or descending
      Returns:
      the list of comments, ordered by comment's creation date and according to sortAscending parameter, or an empty list if no comment is found.
    • getComments

      public PartialList<Comment> getComments(CoreSession session, String documentId, Long pageSize, Long currentPageIndex)
      Description copied from interface: CommentManager
      Gets all comments for a document.
      Specified by:
      getComments in interface CommentManager
      Parameters:
      session - the core session
      documentId - the document id
      pageSize - the page size to query, give null or 0 to disable pagination
      currentPageIndex - the page index to query, give null or 0 to disable pagination
      Returns:
      the list of comments, ordered ascending by comment's creation date, or an empty list if no comment is found.
    • getTopLevelDocumentRef

      public DocumentRef getTopLevelDocumentRef(CoreSession session, DocumentRef commentRef)
      Description copied from interface: CommentManager
      Gets the top level ancestor document ref for the given document model comment ref. No matter how many levels of comments there is.

      Given a document fileOne, that we comment with commentOne which we reply on with replyOne

      This method will return:

      • CommentManager#getAncestorRef(session, commentOne) = fileOne
      • CommentManager#getAncestorRef(session, replyOne) = fileOne
      Specified by:
      getTopLevelDocumentRef in interface CommentManager
      Parameters:
      session - the CoreSession
      commentRef - the comment document model ref
      Returns:
      the top level ancestor document ref
    • notifyEvent

      protected void notifyEvent(CoreSession session, String eventType, DocumentModel commentDoc)
      Notifies the event of type eventType on the given commentDoc.
      Parameters:
      session - the session
      eventType - the event type to fire
      commentDoc - the document model of the comment
      Since:
      11.1
      Implementation Requirements:
      This method uses internally notifyEvent(CoreSession, String, DocumentModel, DocumentModel)
    • notifyEvent

      protected void notifyEvent(CoreSession session, String eventType, DocumentModel commentedDoc, DocumentModel commentDoc)
    • notifyEvent

      protected void notifyEvent(CoreSession session, String eventType, DocumentModel topLevelDoc, DocumentModel commentedDoc, DocumentModel commentDoc)
      Since:
      11.1
    • getTopLevelDocument

      protected abstract DocumentModel getTopLevelDocument(CoreSession session, DocumentModel commentDoc)
    • getCommentedDocument

      protected abstract DocumentModel getCommentedDocument(CoreSession session, DocumentModel commentDoc)
    • getAuthor

      protected NuxeoPrincipal getAuthor(DocumentModel docModel)
    • setFolderPermissions

      protected void setFolderPermissions(CoreSession session, DocumentModel documentModel)
    • setCommentPermissions

      @Deprecated(since="11.1") protected void setCommentPermissions(CoreSession session, DocumentModel documentModel)
      Deprecated.
      since 11.1. Not used anymore
    • fillCommentForCreation

      protected void fillCommentForCreation(CoreSession session, Comment comment)
    • computeAncestorIds

      protected <S extends Set<String> & Serializable> S computeAncestorIds(CoreSession session, String parentId)
      Parameters:
      session - the session allowing to get parent documents, depending on implementation it should be privileged