Class RichTextComment
java.lang.Object
org.ametys.cms.repository.comment.AbstractComment
org.ametys.cms.repository.comment.RichTextComment
- All Implemented Interfaces:
ReactionableObject
,ReportableObject
A comment on a
CommentableAmetysObject
with rich text content-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.cms.repository.ReactionableObject
ReactionableObject.ReactionType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute Description abstractstatic final String
Attribute Description for editingstatic final String
Attribute Description for editingstatic final String
Constants for the content MetadataFields 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
ConstructorDescriptionRichTextComment
(RichTextComment comment) Creates a new sub comment of the commentRichTextComment
(RichTextComment 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.RichTextComment
(ModifiableModelLessDataHolder contentUnversionedDataHolder) Creates a new comment on the contentRichTextComment
(ModifiableModelLessDataHolder contentUnversionedDataHolder, String commentId) Retrieves a comment by its idRichTextComment
(ModifiableModelLessDataHolder contentUnversionedDataHolder, String commentId, ZonedDateTime creationDate) Creates a new comment on the content, with the given id and creation date This method allow 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 TypeMethodDescription<T extends AbstractComment>
TCreate sub comment from this comment<T extends AbstractComment>
TcreateSubComment
(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 RichTextComment
getComment
(ModifiableModelLessDataHolder contentUnversionedDataHolder, String commentId) Get a commentGet parent of comment if existsstatic <T extends AbstractComment>
List<T>getComments
(RichTextComment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments) Get the comments of a contentstatic <T extends AbstractComment>
List<T>getComments
(RichTextComment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean withSubComment) Get the comments of a contentstatic <T extends AbstractComment>
List<T>getComments
(ModifiableModelLessDataHolder contentUnversionedDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments) Get the comments of a contentstatic <T extends AbstractComment>
List<T>getComments
(ModifiableModelLessDataHolder contentUnversionedDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean isRecursive) Get the comments of a contentGet the rich text contentgetSubComment
(boolean includeNotValidatedComments, boolean includeValidatedComments) Get sub comments of the commentboolean
Check if there is a rich text contentvoid
setRichTextContent
(RichText richText) Set rich text 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
-
Field Details
-
METADATA_RICHTEXT_COMMENT_CONTENT
Constants for the content Metadata- See Also:
-
ATTRIBUTE_CONTENT_FOR_EDITING
Attribute Description for editing- See Also:
-
ATTRIBUTE_CONTENT_FOR_RENDERING
Attribute Description for editing- See Also:
-
ATTRIBUTE_CONTENT_ABSTRACT
Attribute Description abstract- See Also:
-
-
Constructor Details
-
RichTextComment
public RichTextComment(ModifiableModelLessDataHolder contentUnversionedDataHolder, String commentId) Retrieves a comment by its id- Parameters:
contentUnversionedDataHolder
- The unversioned data holder of the content hosting the commentcommentId
- The id of the comment to retrieve- Throws:
AmetysRepositoryException
- if an error occurred
-
RichTextComment
Creates a new comment on the content- Parameters:
contentUnversionedDataHolder
- The unversioned data holder of the content where to add the new comment
-
RichTextComment
public RichTextComment(ModifiableModelLessDataHolder contentUnversionedDataHolder, String commentId, ZonedDateTime creationDate) Creates a new comment on the content, with the given id and creation date This method allow 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:
contentUnversionedDataHolder
- The unversioned data holder of the content where to add the new commentcommentId
- the comment's idcreationDate
- the comment's creation date
-
RichTextComment
Creates a new sub comment of the comment- Parameters:
comment
- The parent comment
-
RichTextComment
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 RichTextComment getComment(ModifiableModelLessDataHolder contentUnversionedDataHolder, String commentId) throws AmetysRepositoryException Get a comment- Parameters:
contentUnversionedDataHolder
- the content data holdercommentId
- The comment identifier- Returns:
- The comment
- Throws:
AmetysRepositoryException
- if the comment does not exist
-
getComments
public static <T extends AbstractComment> List<T> getComments(RichTextComment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException Get the comments of a content- Type Parameters:
T
- type of the value to retrieve- 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 comments
- Throws:
AmetysRepositoryException
- If an error occurred
-
getComments
public static <T extends AbstractComment> List<T> getComments(RichTextComment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean withSubComment) throws AmetysRepositoryException Get the comments of a content- Type Parameters:
T
- type of the value to retrieve- 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 <T extends AbstractComment> List<T> getComments(ModifiableModelLessDataHolder contentUnversionedDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException Get the comments of a content- Type Parameters:
T
- type of the value to retrieve- Parameters:
contentUnversionedDataHolder
- The content unversioned 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 <T extends AbstractComment> List<T> getComments(ModifiableModelLessDataHolder contentUnversionedDataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean isRecursive) throws AmetysRepositoryException Get the comments of a content- Type Parameters:
T
- type of the value to retrieve- Parameters:
contentUnversionedDataHolder
- The content unversioned metadata 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<RichTextComment> 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
- Type Parameters:
T
- type of the value to retrieve- 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
- Type Parameters:
T
- type of the value to retrieve- Parameters:
commentId
- the comment's idcreationDate
- the comment's creation date- Returns:
- the new comment
-
setRichTextContent
Set rich text comment- Parameters:
richText
- the content of the comment
-
getRichTextContent
Get the rich text content- Returns:
- rich text content
-
hasRichTextContent
Check if there is a rich text content- Returns:
- true if there is a rich text content
-