Class Comment
java.lang.Object
org.ametys.cms.repository.comment.AbstractComment
org.ametys.cms.repository.comment.Comment
- All Implemented Interfaces:
ReactionableObject,ReportableObject
A comment on a
CommentableAmetysObject-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.cms.repository.ReactionableObject
ReactionableObject.ReactionType -
Field Summary
Fields inherited from class org.ametys.cms.repository.comment.AbstractComment
_commentComposite, _id, _rootDataHolder, COMMENT_NAME_PREFIX, ID_SEPARATOR, METADATA_COMMENT_AUTHOR, METADATA_COMMENT_AUTHOREMAIL, METADATA_COMMENT_AUTHOREMAIL_HIDDEN, METADATA_COMMENT_AUTHORNAME, METADATA_COMMENT_AUTHORURL, METADATA_COMMENT_CONTENT, METADATA_COMMENT_CREATIONDATE, METADATA_COMMENT_IS_ACCEPTED, METADATA_COMMENT_IS_DELETED, METADATA_COMMENT_IS_EDITED, METADATA_COMMENT_LAST_MODIFICATION_DATE, METADATA_COMMENT_VALIDATED, METADATA_COMMENTS_NOTVALIDATED, METADATA_COMMENTS_VALIDATED, REFERENCED_COMMENT_DATA_NAME, SUB_COMMENTS_DATA_NAME -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new sub comment of the commentComment(Comment comment, String commentId, ZonedDateTime creationDate) Creates a new sub comment of the comment, with the given id and creation date This method allow to create a sub comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted.Comment(Comment parentComment, AbstractComment refComment) Creates a reference comment of the comment, with the given commentComment(ModifiableDataHolder dataHolder) Creates a new commentComment(ModifiableDataHolder rootDataHolder, String commentId) Retrieves a comment by its idComment(ModifiableDataHolder dataHolder, String commentId, ZonedDateTime creationDate) Creates a new comment, with the given id and creation date This method allows to create a comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted. -
Method Summary
Modifier and TypeMethodDescriptioncreateReferencedComment(AbstractComment comment) Creates a referenced comment from this comment, with the given commentCreate sub comment from this commentcreateSubComment(String commentId, ZonedDateTime creationDate) Creates a sub comment from this comment, with the given id and creation date This method allow to create a sub comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted.Extract users mentioned in the commentstatic CommentgetComment(ModifiableDataHolder rootDataHolder, String commentId) Get a commentGet parent of comment if existsgetComments(Comment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments) Get the sub comments of the given commentgetComments(Comment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean withSubComment) Get the sub comments of the given commentgetComments(ModifiableDataHolder rootDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments) Get the comments in the given root data holdergetComments(ModifiableDataHolder rootDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean isRecursive) Get the comments in the given root data holderGet the referenced comment of the commentgetSubComment(boolean includeNotValidatedComments, boolean includeValidatedComments) Get sub comments of the commentprotected voidupdate()Update the comment tag statisticsMethods inherited from class org.ametys.cms.repository.comment.AbstractComment
addReaction, addReport, clearReports, getAuthor, getAuthorEmail, getAuthorName, getAuthorURL, getCommentDataPath, getComments, getComments, getComments, getComments, getContent, getCreationDate, getId, getLastModificationDate, getReactionUsers, getReferencedComment, getReportsCount, getRepositoryData, hasSubComments, isAccepted, isDeleted, isEdited, isEmailHidden, isSubComment, isValidated, remove, removeReaction, setAccepted, setAuthor, setAuthorEmail, setAuthorName, setAuthorURL, setContent, setDeleted, setEdited, setEmailHiddenStatus, setLastModificationDate, setReportsCount, setValidated
-
Constructor Details
-
Comment
Retrieves a comment by its id- Parameters:
rootDataHolder- The root data holder hosting the first level of commentscommentId- The id of the comment to retrieve- Throws:
AmetysRepositoryException- if an error occurred
-
Comment
Creates a new comment- Parameters:
dataHolder- The data holder where to add the new comment
-
Comment
Creates a new comment, with the given id and creation date This method allows to create a comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted. Be careful using this method- Parameters:
dataHolder- The data holder where to add the new commentcommentId- the comment's idcreationDate- the comment's creation date
-
Comment
Creates a new sub comment of the comment- Parameters:
comment- The parent comment
-
Comment
Creates a new sub comment of the comment, with the given id and creation date This method allow to create a sub comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted. Be careful using this method- Parameters:
comment- The parent commentcommentId- the sub comment's idcreationDate- the sub comment's creation date
-
Comment
Creates a reference comment of the comment, with the given comment- Parameters:
parentComment- The parent commentrefComment- the referenced comment
-
-
Method Details
-
getComment
public static Comment getComment(ModifiableDataHolder rootDataHolder, String commentId) throws AmetysRepositoryException Get a comment- Parameters:
rootDataHolder- The root data holder of the first level of commentscommentId- The comment identifier- Returns:
- The comment
- Throws:
AmetysRepositoryException- if the comment does not exist
-
getComments
public static List<Comment> getComments(Comment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException Get the sub comments of the given comment- Parameters:
parentComment- The parent commentincludeNotValidatedComments- True to include the comments that are not validatedincludeValidatedComments- True to include the comments that are validated- Returns:
- the list of sub comments
- Throws:
AmetysRepositoryException- If an error occurred
-
getComments
public static List<Comment> getComments(Comment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean withSubComment) throws AmetysRepositoryException Get the sub comments of the given comment- Parameters:
parentComment- The parent commentincludeNotValidatedComments- True to include the comments that are not validatedincludeValidatedComments- True to include the comments that are validatedwithSubComment- true if we want to get all child comments- Returns:
- the list of comments
- Throws:
AmetysRepositoryException- If an error occurred
-
getComments
public static List<Comment> getComments(ModifiableDataHolder rootDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException Get the comments in the given root data holder- Parameters:
rootDataHolder- The root data holderincludeNotValidatedComments- True to include the comments that are not validatedincludeValidatedComments- True to include the comments that are validated- Returns:
- the list of comments
- Throws:
AmetysRepositoryException- If an error occurred
-
getComments
public static List<Comment> getComments(ModifiableDataHolder rootDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean isRecursive) throws AmetysRepositoryException Get the comments in the given root data holder- Parameters:
rootDataHolder- The root data holderincludeNotValidatedComments- True to include the comments that are not validatedincludeValidatedComments- True to include the comments that are validatedisRecursive- true if we want to have sub comments- Returns:
- the list of comments
- Throws:
AmetysRepositoryException- If an error occurred
-
update
Description copied from class:AbstractCommentUpdate the comment tag statistics- Specified by:
updatein classAbstractComment
-
getCommentParent
Description copied from class:AbstractCommentGet parent of comment if exists- Specified by:
getCommentParentin classAbstractComment- Returns:
- the comment parent. null if the comment is not a sub comment
-
getSubComment
public List<Comment> getSubComment(boolean includeNotValidatedComments, boolean includeValidatedComments) Description copied from class:AbstractCommentGet sub comments of the comment- Specified by:
getSubCommentin classAbstractComment- Parameters:
includeNotValidatedComments- True to include the comments that are not validatedincludeValidatedComments- True to include the comments that are validated- Returns:
- the list of comments
-
getReferencedComment
Description copied from class:AbstractCommentGet the referenced comment of the comment- Specified by:
getReferencedCommentin classAbstractComment- Returns:
- the referenced comment
-
createSubComment
Create sub comment from this comment- Specified by:
createSubCommentin classAbstractComment- Returns:
- the sub comment
-
createSubComment
Description copied from class:AbstractCommentCreates a sub comment from this comment, with the given id and creation date This method allow to create a sub comment from existing data (ex: data import from archive) The id is not generated here, the source is trusted. Be careful using this method- Specified by:
createSubCommentin classAbstractComment- Parameters:
commentId- the comment's idcreationDate- the comment's creation date- Returns:
- the new comment
-
createReferencedComment
Description copied from class:AbstractCommentCreates a referenced comment from this comment, with the given comment- Specified by:
createReferencedCommentin classAbstractComment- Parameters:
comment- the comment to reference- Returns:
- the referenced comment
-
extractMentions
Extract users mentioned in the comment- Returns:
- the mentioned users
-