Class RichTextComment

java.lang.Object
org.ametys.cms.repository.comment.AbstractComment
org.ametys.cms.repository.comment.RichTextComment
All Implemented Interfaces:
ReactionableObject, ReportableObject

public class RichTextComment extends AbstractComment
A comment on a CommentableAmetysObject with rich text content
  • Field Details

  • 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 comment
      commentId - The id of the comment to retrieve
      Throws:
      AmetysRepositoryException - if an error occurred
    • RichTextComment

      public RichTextComment(ModifiableModelLessDataHolder contentUnversionedDataHolder)
      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 comment
      commentId - the comment's id
      creationDate - the comment's creation date
    • RichTextComment

      Creates a new sub comment of the comment
      Parameters:
      comment - The parent comment
    • RichTextComment

      public RichTextComment(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. Be careful using this method
      Parameters:
      comment - The parent comment
      commentId - the sub comment's id
      creationDate - 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 holder
      commentId - 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 comment
      includeNotValidatedComments - True to include the comments that are not validated
      includeValidatedComments - 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 comment
      includeNotValidatedComments - True to include the comments that are not validated
      includeValidatedComments - True to include the comments that are validated
      withSubComment - 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 holder
      includeNotValidatedComments - True to include the comments that are not validated
      includeValidatedComments - 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 holder
      includeNotValidatedComments - True to include the comments that are not validated
      includeValidatedComments - True to include the comments that are validated
      isRecursive - true if we want to have sub comments
      Returns:
      the list of comments
      Throws:
      AmetysRepositoryException - If an error occurred
    • update

      protected void update()
      Description copied from class: AbstractComment
      Update the comment tag statistics
      Specified by:
      update in class AbstractComment
    • getCommentParent

      Description copied from class: AbstractComment
      Get parent of comment if exists
      Specified by:
      getCommentParent in class AbstractComment
      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 class AbstractComment
      Parameters:
      includeNotValidatedComments - True to include the comments that are not validated
      includeValidatedComments - True to include the comments that are validated
      Returns:
      the list of comments
    • createSubComment

      public <T extends AbstractComment> T createSubComment()
      Create sub comment from this comment
      Specified by:
      createSubComment in class AbstractComment
      Type Parameters:
      T - type of the value to retrieve
      Returns:
      the sub comment
    • createSubComment

      public <T extends AbstractComment> T createSubComment(String commentId, ZonedDateTime creationDate)
      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 class AbstractComment
      Type Parameters:
      T - type of the value to retrieve
      Parameters:
      commentId - the comment's id
      creationDate - the comment's creation date
      Returns:
      the new comment
    • setRichTextContent

      public void setRichTextContent(RichText richText)
      Set rich text comment
      Parameters:
      richText - the content of the comment
    • getRichTextContent

      Get the rich text content
      Returns:
      rich text content
    • hasRichTextContent

      public boolean hasRichTextContent()
      Check if there is a rich text content
      Returns:
      true if there is a rich text content