All Implemented Interfaces:
CommentDaoInternal, CommentDao, org.springframework.beans.factory.InitializingBean

public class HibernateCommentDao extends VersionedHibernateObjectDao<Comment> implements CommentDaoInternal
  • Constructor Details

    • HibernateCommentDao

      public HibernateCommentDao()
  • Method Details

    • getPersistentClass

      public Class<Comment> getPersistentClass()
      Specified by:
      getPersistentClass in class HibernateObjectDao<Comment>
    • getById

      public Comment getById(long id)
      Description copied from interface: CommentDao
      Get a comment by its id
      Specified by:
      getById in interface CommentDao
      Parameters:
      id - the comment's id
      Returns:
      the comment object
    • getByClassId

      protected Comment getByClassId(long id)
      Description copied from class: HibernateObjectDao
      Retrieve the object with a particular id from the database. The object must be of the same class as the DAO's getPersistentClass() method returns.
      Overrides:
      getByClassId in class HibernateObjectDao<Comment>
      Parameters:
      id - the id of the object to look up
      Returns:
      the corresponding object, or null if the object does not exist with the appropriate class and id.
    • getRecentlyUpdatedComments

      public Iterator<Comment> getRecentlyUpdatedComments(long spaceId, int maxResults)
      Description copied from interface: CommentDao
      Get all comments that have been updated recently in a space
      Specified by:
      getRecentlyUpdatedComments in interface CommentDao
      Parameters:
      spaceId - the space's id
      maxResults - the maximum number of comments that can be retrieved
      Returns:
      a Iterator object that encapsulates the list of comments found
    • getContainerComments

      public List<Comment> getContainerComments(long containerId, Date since)
      Description copied from interface: CommentDao
      Get the comments that have been added or updated since a specific time
      Specified by:
      getContainerComments in interface CommentDao
      Parameters:
      containerId - the container's id
      since - Date the time after which the comments have been added or updated
      Returns:
      a list of comments created or updated
    • getContainerComments

      public List<Comment> getContainerComments(long containerId, Date since, ConfluenceUser ignoreUser)
      Description copied from interface: CommentDao
      Get the comments that have been added or updated since a specific time but not by a user
      Specified by:
      getContainerComments in interface CommentDao
      Parameters:
      containerId - the container's id
      since - Date the time after which the comments have been added or updated
      ignoreUser - the user to be ignored
      Returns:
      a list of comments created or updated
    • countComments

      public Map<Searchable,Integer> countComments(Collection<? extends Searchable> searchables)
      Description copied from interface: CommentDao
      Count all comments for each content in a collection
      Specified by:
      countComments in interface CommentDao
      Parameters:
      searchables - a collection of Searchable objects representing the contents
      Returns:
      a map of counts for each searchable content
    • countComments

      public int countComments(Searchable searchable)
      Description copied from interface: CommentDao
      Count all comments in a searchable content
      Specified by:
      countComments in interface CommentDao
      Parameters:
      searchable - a Searchable object representing the content
      Returns:
      a number of comments in the searchable content
    • countAllCommentVersions

      public int countAllCommentVersions()
      Description copied from interface: CommentDao
      Count the total number of comments of all types, including previous versions
      Specified by:
      countAllCommentVersions in interface CommentDao
      Returns:
      the total number of comments
    • getContainerComments

      public List<Comment> getContainerComments(long containerId, LimitedRequest pageRequest)
      Specified by:
      getContainerComments in interface CommentDao
    • getChildren

      public List<Comment> getChildren(Comment comment, LimitedRequest pageRequest)
      Specified by:
      getChildren in interface CommentDao
    • countUnresolvedComments

      public Map<Long,Integer> countUnresolvedComments(@NonNull Collection<Long> containerIds)
      Description copied from interface: CommentDao
      Count unresolved comments of comment containers.
      Specified by:
      countUnresolvedComments in interface CommentDao
      Parameters:
      containerIds - the list of comment containers ids
      Returns:
      The map of container id and its unresolved comment count
    • setEventPublisher

      public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
    • publishEvent

      protected void publishEvent(IndexerEventListener.VisitorEvent event)
      Overrides:
      publishEvent in class HibernateObjectDao<Comment>
    • scanFilteredComments

      public List<Comment> scanFilteredComments(List<ContentStatus> statuses, LimitedRequest pageRequest)
      Specified by:
      scanFilteredComments in interface CommentDaoInternal
      Parameters:
      statuses - list of content status
      pageRequest - the pagination requested
      Returns:
      list of comment entities
    • scanFilteredSpaceComments

      public List<Comment> scanFilteredSpaceComments(Space space, List<ContentStatus> statuses, LimitedRequest pageRequest)
      Specified by:
      scanFilteredSpaceComments in interface CommentDaoInternal
      Parameters:
      space - the space to locate comments in
      statuses - list of content status
      pageRequest - the pagination requested
      Returns:
      list of comment entities in a given space
    • countSpaceCommentByStatuses

      public long countSpaceCommentByStatuses(Space space, List<ContentStatus> contentStatuses)
      Description copied from interface: CommentDaoInternal
      Retrieve the latest content count of specific content type for a given space with a particular status.
      Specified by:
      countSpaceCommentByStatuses in interface CommentDaoInternal
      Parameters:
      space - the space
      contentStatuses - the statuses of the content being retrieved (e.g. ContentEntityObject.DELETED
      Returns:
      the number of content objects with that status in that space
    • countCommentByStatuses

      public long countCommentByStatuses(List<ContentStatus> contentStatuses)
      Description copied from interface: CommentDaoInternal
      Retrieve the latest content count of specific content type for a given space with a particular status.
      Specified by:
      countCommentByStatuses in interface CommentDaoInternal
      Parameters:
      contentStatuses - the statuses of the content being retrieved (e.g. ContentEntityObject.DELETED
      Returns:
      the number of content objects with that status in that space