Interface CommentManager
- All Known Implementing Classes:
AbstractCommentManager
,BridgeCommentManager
,CommentManagerImpl
,PropertyCommentManager
,TreeCommentManager
public interface CommentManager
Service to deal with
Comment
.
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
Modifier and TypeInterfaceDescriptionstatic enum
Features of the implementation of the service. -
Method Summary
Modifier and TypeMethodDescriptioncreateComment
(CoreSession session, Comment comment) Creates a comment.createComment
(DocumentModel docModel, String comment) Deprecated.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.createComment
(DocumentModel docModel, DocumentModel comment) Creates a comment document model, filling its properties with given info and linking it to given document.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.createLocatedComment
(DocumentModel docModel, DocumentModel comment, String path) Creates a comment document model.void
deleteComment
(CoreSession session, String commentId) Deletes a comment.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.default void
deleteExternalComment
(CoreSession session, String entityId) Deprecated.since 11.1, usedeleteExternalComment(CoreSession, String, String)
insteadvoid
deleteExternalComment
(CoreSession session, String documentId, String entityId) Deletes an external comment by its {code entityId} under the document withdocumentId
.getComment
(CoreSession session, String commentId) Gets a comment.getComments
(CoreSession session, String documentId) Gets all comments for a document.getComments
(CoreSession session, String documentId, boolean sortAscending) Gets all comments for a document.getComments
(CoreSession session, String documentId, Long pageSize, Long currentPageIndex) Gets all comments for a document.getComments
(CoreSession session, String documentId, Long pageSize, Long currentPageIndex, boolean sortAscending) Gets all comments for a document.getComments
(CoreSession session, Collection<String> documentIds) Gets all comments for a collection of documents.getComments
(CoreSession session, DocumentModel docModel) Gets comments of a document.getComments
(DocumentModel docModel) Gets comments of a document.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.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 Comment
getExternalComment
(CoreSession session, String entityId) Deprecated.since 11.1, usegetExternalComment(CoreSession, String, String)
insteadgetExternalComment
(CoreSession session, String documentId, String entityId) Gets an external comment by itsentityId
under the document withdocumentId
.getThreadForComment
(DocumentModel comment) Deprecated.since 11.1, unusedgetTopLevelDocumentRef
(CoreSession session, DocumentRef commentRef) Gets the top level ancestor document ref for the given document model comment ref.boolean
hasFeature
(CommentManager.Feature feature) Checks if a feature is available.updateComment
(CoreSession session, String commentId, Comment comment) Updates a comment.updateExternalComment
(CoreSession session, String documentId, String entityId, Comment comment) Updates an external comment by itsentityId
under the document withdocumentId
.default Comment
updateExternalComment
(CoreSession session, String entityId, Comment comment) Deprecated.since 11.1, useupdateExternalComment(CoreSession, String, String, Comment)
instead
-
Method Details
-
getComments
Gets comments of a document.- Parameters:
docModel
- the document model- Returns:
- the list of comments
-
getComments
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.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
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, 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
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
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
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
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
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
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
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
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, usegetExternalComment(CoreSession, String, String)
instead- Since:
- 10.3
-
getExternalComment
Gets an external comment by itsentityId
under the document withdocumentId
.- Returns:
- the comment with given
entityId
under 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 itsentityId
under the document withdocumentId
.- Returns:
- the updated comment with given
entityId
under 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, usedeleteExternalComment(CoreSession, String, String)
instead- Since:
- 10.3
-
deleteExternalComment
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
Checks if a feature is available.- Since:
- 10.3
-
getTopLevelDocumentRef
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
-
createComment(DocumentModel, String, String)