Interface CommentManager
- 
- All Known Implementing Classes:
 AbstractCommentManager,BridgeCommentManager,CommentManagerImpl,PropertyCommentManager,TreeCommentManager
public interface CommentManagerService to deal withComment.We call comment the document model representing a comment.
We call parent/commented document the document model being commented (regular document or comment).
We call top level document the regular document which owns all comments.
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCommentManager.FeatureFeatures of the implementation of the service. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description CommentcreateComment(CoreSession session, Comment comment)Creates a comment.DocumentModelcreateComment(DocumentModel docModel, String comment)Deprecated.CommentManager cannot find the author if invoked remotely so one should usecreateComment(DocumentModel, String, String)DocumentModelcreateComment(DocumentModel docModel, String comment, String author)Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usecreateComment(CoreSession, Comment)instead.DocumentModelcreateComment(DocumentModel docModel, DocumentModel comment)Creates a comment document model, filling its properties with given info and linking it to given document.DocumentModelcreateComment(DocumentModel docModel, DocumentModel parent, DocumentModel child)Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usecreateComment(CoreSession, Comment)instead.DocumentModelcreateLocatedComment(DocumentModel docModel, DocumentModel comment, String path)Creates a comment document model.voiddeleteComment(CoreSession session, String commentId)Deletes a comment.voiddeleteComment(DocumentModel docModel, DocumentModel comment)Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usedeleteComment(CoreSession, String)instead.default voiddeleteExternalComment(CoreSession session, String entityId)Deprecated.since 11.1, usedeleteExternalComment(CoreSession, String, String)insteadvoiddeleteExternalComment(CoreSession session, String documentId, String entityId)Deletes an external comment by its {code entityId} under the document withdocumentId.CommentgetComment(CoreSession session, String commentId)Gets a comment.List<Comment>getComments(CoreSession session, String documentId)Gets all comments for a document.List<Comment>getComments(CoreSession session, String documentId, boolean sortAscending)Gets all comments for a document.PartialList<Comment>getComments(CoreSession session, String documentId, Long pageSize, Long currentPageIndex)Gets all comments for a document.PartialList<Comment>getComments(CoreSession session, String documentId, Long pageSize, Long currentPageIndex, boolean sortAscending)Gets all comments for a document.List<Comment>getComments(CoreSession session, Collection<String> documentIds)Gets all comments for a collection of documents.List<DocumentModel>getComments(CoreSession session, DocumentModel docModel)Gets comments of a document.List<DocumentModel>getComments(DocumentModel docModel)Gets comments of a document.List<DocumentModel>getComments(DocumentModel docModel, DocumentModel parent)Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usegetComments(DocumentModel)instead.List<DocumentModel>getDocumentsForComment(DocumentModel comment)Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, only used with deprecated implementation, no replacement.default CommentgetExternalComment(CoreSession session, String entityId)Deprecated.since 11.1, usegetExternalComment(CoreSession, String, String)insteadCommentgetExternalComment(CoreSession session, String documentId, String entityId)Gets an external comment by itsentityIdunder the document withdocumentId.DocumentModelgetThreadForComment(DocumentModel comment)Deprecated.since 11.1, unusedDocumentRefgetTopLevelDocumentRef(CoreSession session, DocumentRef commentRef)Gets the top level ancestor document ref for the given document model comment ref.booleanhasFeature(CommentManager.Feature feature)Checks if a feature is available.CommentupdateComment(CoreSession session, String commentId, Comment comment)Updates a comment.CommentupdateExternalComment(CoreSession session, String documentId, String entityId, Comment comment)Updates an external comment by itsentityIdunder the document withdocumentId.default CommentupdateExternalComment(CoreSession session, String entityId, Comment comment)Deprecated.since 11.1, useupdateExternalComment(CoreSession, String, String, Comment)instead 
 - 
 
- 
- 
Method Detail
- 
getComments
List<DocumentModel> getComments(DocumentModel docModel)
Gets comments of a document.- Parameters:
 docModel- the document model- Returns:
 - the list of comments
 
 
- 
getComments
List<DocumentModel> getComments(CoreSession session, DocumentModel docModel)
Gets comments of a document.- Parameters:
 session- the core sessiondocModel- the document model- Returns:
 - the list of comments
 - Throws:
 CommentSecurityException- if the current user does not have the right permissions on the commented document- Since:
 - 10.3
 
 
- 
getComments
@Deprecated(since="10.3", forRemoval=true) List<DocumentModel> getComments(DocumentModel docModel, DocumentModel parent)
Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usegetComments(DocumentModel)instead.Get comments of a document.- Parameters:
 docModel- the document modelparent- the parent document model- Returns:
 - the list of comments
 
 
- 
createComment
@Deprecated DocumentModel createComment(DocumentModel docModel, String comment)
Deprecated.CommentManager cannot find the author if invoked remotely so one should usecreateComment(DocumentModel, String, String)Creates a comment.- Parameters:
 docModel- the document to commentcomment- the comment content
 
- 
createComment
@Deprecated(since="10.3", forRemoval=true) DocumentModel createComment(DocumentModel docModel, String comment, String author)
Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usecreateComment(CoreSession, Comment)instead.Creates a comment document model, filling its properties with given info and linking it to given document.- Parameters:
 docModel- the document to commentcomment- the comment contentauthor- the comment author- Returns:
 - the comment document model.
 
 
- 
createComment
DocumentModel createComment(DocumentModel docModel, DocumentModel comment)
Creates a comment document model, filling its properties with given info and linking it to given document.- Parameters:
 docModel- the document to commentcomment- the comment document model- Returns:
 - the created comment document model.
 - Throws:
 CommentSecurityException- if the current user does not have the right permissions on the document to comment.
 
- 
createComment
@Deprecated(since="10.3", forRemoval=true) DocumentModel createComment(DocumentModel docModel, DocumentModel parent, DocumentModel child)
Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usecreateComment(CoreSession, Comment)instead.Creates a comment document model, filling its properties with given info and linking it to given document.- Parameters:
 docModel- the document to commentparent- the comment parent document modelchild- the comment child document model- Returns:
 - the created comment document model.
 
 
- 
deleteComment
@Deprecated(since="10.3", forRemoval=true) void deleteComment(DocumentModel docModel, DocumentModel comment)
Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, usedeleteComment(CoreSession, String)instead.Deletes a comment.- Parameters:
 docModel- the comment document modelcomment- the comment
 
- 
getDocumentsForComment
@Deprecated(since="10.3", forRemoval=true) List<DocumentModel> getDocumentsForComment(DocumentModel comment)
Deprecated, for removal: This API element is subject to removal in a future version.since 10.3, only used with deprecated implementation, no replacement.Gets documents in relation with a particular comment.- Parameters:
 comment- the comment- Returns:
 - the list of documents
 
 
- 
getThreadForComment
@Deprecated(since="11.1") DocumentModel getThreadForComment(DocumentModel comment)
Deprecated.since 11.1, unusedGets thread in relation with a given comment (post or comment).- Parameters:
 comment- the comment- Returns:
 - the thread
 - Throws:
 CommentSecurityException- if the current user does not have the right permissions on the commented document.- Since:
 - 5.5
 
 
- 
createLocatedComment
DocumentModel createLocatedComment(DocumentModel docModel, DocumentModel comment, String path)
Creates a comment document model. It gives opportunity to save the comments in a specified location.- Parameters:
 docModel- the document to commentcomment- the comment contentpath- the location path- Returns:
 - the comment document model.
 - Throws:
 CommentSecurityException- if the current user does not have the right permissions on the document to comment.
 
- 
createComment
Comment createComment(CoreSession session, Comment comment)
Creates a comment.- Parameters:
 session- the core session- Returns:
 - the created comment
 - Throws:
 CommentNotFoundException- if the document to comment, i.e. comment's parent, does not exist.CommentSecurityException- if the current user does not have the right permissions on the document to comment.- Since:
 - 10.3
 
 
- 
getComment
Comment getComment(CoreSession session, String commentId)
Gets a comment.- Parameters:
 session- the core sessioncommentId- the comment id- Returns:
 - the comment
 - Throws:
 CommentNotFoundException- if the comment does not existCommentSecurityException- if the current user does not have the right permissions on the commented document.- Since:
 - 10.3
 
 
- 
getComments
List<Comment> getComments(CoreSession session, String documentId)
Gets all comments for a document.- Parameters:
 session- the core sessiondocumentId- the document id- Returns:
 - the list of comments, ordered ascending by comment's creation date, or an empty list if no comment is found.
 - Since:
 - 10.3
 
 
- 
getComments
List<Comment> getComments(CoreSession session, String documentId, boolean sortAscending)
Gets all comments for a document.- Parameters:
 session- the core sessiondocumentId- the document idsortAscending- 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.
 - Since:
 - 10.3
 
 
- 
getComments
PartialList<Comment> getComments(CoreSession session, String documentId, Long pageSize, Long currentPageIndex)
Gets all comments for a document.- Parameters:
 session- the core sessiondocumentId- the document idpageSize- the page size to query, give null or 0 to disable paginationcurrentPageIndex- 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.
 - Since:
 - 10.3
 
 
- 
getComments
PartialList<Comment> getComments(CoreSession session, String documentId, Long pageSize, Long currentPageIndex, boolean sortAscending)
Gets all comments for a document.- Parameters:
 session- the core sessiondocumentId- the document idpageSize- the page size to query, give null or 0 to disable paginationcurrentPageIndex- the page index to query, give null or 0 to disable paginationsortAscending- 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.
 - Throws:
 CommentSecurityException- if the current user does not have the right permissions on the commented document.- Since:
 - 10.3
 
 
- 
getComments
List<Comment> getComments(CoreSession session, Collection<String> documentIds)
Gets all comments for a collection of documents.- Parameters:
 session- the core sessiondocumentIds- the document ids- Returns:
 - the list of comments
 - Since:
 - 11.3
 
 
- 
updateComment
Comment updateComment(CoreSession session, String commentId, Comment comment)
Updates a comment.- Parameters:
 session- the core sessioncommentId- the comment idcomment- the updated comment- Returns:
 - the updated comment
 - Throws:
 CommentNotFoundException- if no comment was found with the given id.CommentSecurityException- if the current user does not have the right permissions on the commented document.- Since:
 - 10.3
 
 
- 
deleteComment
void deleteComment(CoreSession session, String commentId)
Deletes a comment.- Parameters:
 session- the core sessioncommentId- the comment id- Throws:
 CommentNotFoundException- if no comment was found with the given id.CommentSecurityException- if the current user does not have the right permissions on the commented document.- Since:
 - 10.3
 
 
- 
getExternalComment
@Deprecated(since="11.1") default Comment getExternalComment(CoreSession session, String entityId)
Deprecated.since 11.1, usegetExternalComment(CoreSession, String, String)instead- Since:
 - 10.3
 
 
- 
getExternalComment
Comment getExternalComment(CoreSession session, String documentId, String entityId)
Gets an external comment by itsentityIdunder the document withdocumentId.- Returns:
 - the comment with given 
entityIdunder the document with givendocumentId - Throws:
 CommentNotFoundException- if no comment was found with the given external entity idCommentSecurityException- if the current user does have the right permissions on the commented document.- Since:
 - 11.1
 
 
- 
updateExternalComment
@Deprecated(since="11.1") default Comment updateExternalComment(CoreSession session, String entityId, Comment comment)
Deprecated.since 11.1, useupdateExternalComment(CoreSession, String, String, Comment)instead- Since:
 - 10.3
 
 
- 
updateExternalComment
Comment updateExternalComment(CoreSession session, String documentId, String entityId, Comment comment)
Updates an external comment by itsentityIdunder the document withdocumentId.- Returns:
 - the updated comment with given 
entityIdunder the document with givendocumentId - Throws:
 CommentNotFoundException- if no comment was found with the given external entity idCommentSecurityException- if the current user does have the right permissions on the commented document.- Since:
 - 11.1
 
 
- 
deleteExternalComment
@Deprecated(since="11.1") default void deleteExternalComment(CoreSession session, String entityId)
Deprecated.since 11.1, usedeleteExternalComment(CoreSession, String, String)instead- Since:
 - 10.3
 
 
- 
deleteExternalComment
void deleteExternalComment(CoreSession session, String documentId, String entityId)
Deletes an external comment by its {code entityId} under the document withdocumentId.- Throws:
 CommentNotFoundException- if no comment was found with the given external entity idCommentSecurityException- if the current user does have the right permissions on the commented document.- Since:
 - 11.1
 
 
- 
hasFeature
boolean hasFeature(CommentManager.Feature feature)
Checks if a feature is available.- Since:
 - 10.3
 
 
- 
getTopLevelDocumentRef
DocumentRef getTopLevelDocumentRef(CoreSession session, DocumentRef commentRef)
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
 
- Parameters:
 session- the CoreSessioncommentRef- the comment document model ref- Returns:
 - the top level ancestor document ref
 - Since:
 - 11.1
 
 
 - 
 
 -