com.atlassian.confluence.pages.persistence.dao.hibernate
Class HibernateCommentDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.hibernate.HibernateObjectDao
              extended by com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
                  extended by com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao
                      extended by com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateCommentDao
All Implemented Interfaces:
ObjectDao, VersionedObjectDao, CommentDao, org.springframework.beans.factory.InitializingBean

public class HibernateCommentDao
extends ConfluenceHibernateObjectDao
implements CommentDao


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
cacheFactory, confluenceUserDao
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface bucket.core.persistence.ObjectDao
NON_CACHEABLE
 
Constructor Summary
HibernateCommentDao()
           
 
Method Summary
 Map<com.atlassian.bonnie.Searchable,Integer> countComments(Collection<? extends com.atlassian.bonnie.Searchable> searchables)
          Count all comments for each content in a collection
 int countComments(com.atlassian.bonnie.Searchable searchable)
          Count all comments in a searchable content
 Map<Long,Integer> countUnresolvedComments(Collection<Long> containerIds)
          Count unresolved comments of comment containers.
protected  Comment getByClassId(long id)
          Retrieve the object with a particular id from the database.
 Comment getById(long id)
          Get a comment by its id
 PageResponse<Comment> getChildren(Comment comment, LimitedRequest pageRequest, Depth depth, com.google.common.base.Predicate<? super Comment>... predicates)
          Get the children of a comment
 List<Comment> getPageComments(long pageId, Date since)
          Get the comments that have been added or updated since a specific time
 List<Comment> getPageComments(long pageId, Date since, String ignoreUsername)
          Get the comments that have been added or updated since a specific time but not by a user
 PageResponse<Comment> getPageComments(long pageId, LimitedRequest pageRequest, Depth depth, com.google.common.base.Predicate<? super Comment>... predicates)
          Get the comments belonging to a page
 Class getPersistentClass()
           
 Iterator getRecentlyUpdatedComments(long spaceId, int maxResults)
          Get all comments that have been updated recently in a space
 
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, findNamedQueryStringParams, save, setCacheFactory, setConfluenceUserDao, updateModificationData
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getCountResult, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex, uniqueResult
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

HibernateCommentDao

public HibernateCommentDao()
Method Detail

getPersistentClass

public Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao

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
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 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

getPageComments

public List<Comment> getPageComments(long pageId,
                                     Date since)
Description copied from interface: CommentDao
Get the comments that have been added or updated since a specific time

Specified by:
getPageComments in interface CommentDao
Parameters:
pageId - the page's id
since - Date the time after which the comments have been added or updated
Returns:
a list of comments created or updated

getPageComments

public List<Comment> getPageComments(long pageId,
                                     Date since,
                                     String ignoreUsername)
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:
getPageComments in interface CommentDao
Parameters:
pageId - the page's id
since - Date the time after which the comments have been added or updated
ignoreUsername - the user to be ignored
Returns:
a list of comments created or updated

countComments

public Map<com.atlassian.bonnie.Searchable,Integer> countComments(Collection<? extends com.atlassian.bonnie.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(com.atlassian.bonnie.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

getPageComments

public PageResponse<Comment> getPageComments(long pageId,
                                             LimitedRequest pageRequest,
                                             Depth depth,
                                             com.google.common.base.Predicate<? super Comment>... predicates)
Description copied from interface: CommentDao
Get the comments belonging to a page

Specified by:
getPageComments in interface CommentDao
Parameters:
pageId - the page's id
pageRequest - the pagination info
depth - the search depth
predicates - the predicates used to filter the children
Returns:
a PageResponse object that encapsulates the comments

getChildren

public PageResponse<Comment> getChildren(Comment comment,
                                         LimitedRequest pageRequest,
                                         Depth depth,
                                         com.google.common.base.Predicate<? super Comment>... predicates)
Description copied from interface: CommentDao
Get the children of a comment

Specified by:
getChildren in interface CommentDao
Parameters:
comment - the parent comment
pageRequest - the pagination info
depth - the search depth
predicates - the predicates used to filter the children
Returns:
the PageResponse object that encapsulates the children comments

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


Copyright © 2003–2015 Atlassian. All rights reserved.