Class Comment

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

public class Comment extends AbstractComment
  • Constructor Details

    • Comment

      public Comment(ModifiableModelLessDataHolder rootDataHolder, String commentId)
      Retrieves a comment by its id
      Parameters:
      rootDataHolder - The root data holder hosting the first level of comments
      commentId - 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 comment
      commentId - the comment's id
      creationDate - the comment's creation date
    • Comment

      public Comment(Comment comment)
      Creates a new sub comment of the comment
      Parameters:
      comment - The parent comment
    • Comment

      public Comment(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. 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 Comment getComment(ModifiableModelLessDataHolder rootDataHolder, String commentId) throws AmetysRepositoryException
      Get a comment
      Parameters:
      rootDataHolder - The root data holder of the first level of comments
      commentId - 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 comment
      includeNotValidatedComments - True to include the comments that are not validated
      includeValidatedComments - 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 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 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 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 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 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<Comment> 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

      Create sub comment from this comment
      Specified by:
      createSubComment in class AbstractComment
      Returns:
      the sub comment
    • createSubComment

      public Comment 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
      Parameters:
      commentId - the comment's id
      creationDate - the comment's creation date
      Returns:
      the new comment