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, 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_VALIDATED, METADATA_COMMENTS_NOTVALIDATED, METADATA_COMMENTS_VALIDATED, SUB_COMMENTS_DATA_NAME
-
Constructor Summary
ConstructorDescriptionCreates 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
(ModifiableModelLessDataHolder dataHolder) Creates a new commentComment
(ModifiableModelLessDataHolder rootDataHolder, String commentId) Retrieves a comment by its idComment
(ModifiableModelLessDataHolder 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 TypeMethodDescriptionCreate 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.static Comment
getComment
(ModifiableModelLessDataHolder 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
(ModifiableModelLessDataHolder rootDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments) Get the comments in the given root data holdergetComments
(ModifiableModelLessDataHolder rootDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean isRecursive) Get the comments in the given root data holdergetSubComment
(boolean includeNotValidatedComments, boolean includeValidatedComments) Get sub comments of the commentprotected void
update()
Update the comment tag statisticsMethods inherited from class org.ametys.cms.repository.comment.AbstractComment
addReaction, addReport, clearReports, extractMentions, getAuthor, getAuthorEmail, getAuthorName, getAuthorURL, getCommentDataPath, getComments, getComments, getComments, getComments, getContent, getCreationDate, getId, getReactionUsers, getReportsCount, getRepositoryData, hasSubComments, isAccepted, isDeleted, isEdited, isEmailHidden, isSubComment, isValidated, remove, removeReaction, setAccepted, setAuthor, setAuthorEmail, setAuthorName, setAuthorURL, setContent, setDeleted, setEdited, setEmailHiddenStatus, 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
public Comment(ModifiableModelLessDataHolder 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. 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
-
-
Method Details
-
getComment
public static Comment getComment(ModifiableModelLessDataHolder 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(ModifiableModelLessDataHolder 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(ModifiableModelLessDataHolder 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:AbstractComment
Update the comment tag statistics- Specified by:
update
in classAbstractComment
-
getCommentParent
Description copied from class:AbstractComment
Get parent of comment if exists- Specified by:
getCommentParent
in 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:AbstractComment
Get sub comments of the comment- Specified by:
getSubComment
in 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
-
createSubComment
Create sub comment from this comment- Specified by:
createSubComment
in classAbstractComment
- Returns:
- the sub comment
-
createSubComment
Description copied from class:AbstractComment
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. Be careful using this method- Specified by:
createSubComment
in classAbstractComment
- Parameters:
commentId
- the comment's idcreationDate
- the comment's creation date- Returns:
- the new comment
-