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

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.ContentEntityObjectHibernateDao
                      extended by com.atlassian.confluence.pages.persistence.dao.hibernate.HibernatePageDao
All Implemented Interfaces:
ObjectDao, ContentEntityObjectDao, VersionedObjectDao, PageDao, org.springframework.beans.factory.InitializingBean

public class HibernatePageDao
extends ContentEntityObjectHibernateDao
implements PageDao


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.ContentEntityObjectHibernateDao
ONE_DAY
 
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
cacheFactory, confluenceUserDao
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HibernatePageDao()
           
 
Method Summary
 java.util.List<AbstractPage> findBlogsWithHistoricalTitleInPermittedSpace(java.lang.String blogTitle, Space space, int maxResultCount)
          Searches for blogs in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.
 java.util.List findPagesWithHistoricalTitle(java.lang.String pageTitle)
           
 java.util.List<AbstractPage> findPagesWithHistoricalTitleInAllPermittedSpacesExcept(java.lang.String pageTitle, Space space, int maxResultCount)
          Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.
 java.util.List<AbstractPage> findPagesWithHistoricalTitleInPermittedSpace(java.lang.String pageTitle, Space space, int maxResultCount)
          Searches for pages in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.
 PageResponse<AbstractPage> getAbstractPagesByCreationDate(org.joda.time.DateTime date, LimitedRequest pageRequest, com.google.common.base.Predicate<? super AbstractPage> filter)
          Returns the pages and blogposts created on the given date, that also match the given predicate, limited to the page request
 PageResponse<AbstractPage> getAbstractPagesByTitle(java.lang.String title, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super AbstractPage> filter)
          Returns the pages and blogposts that exactly match the given title, limited to the pagination request
 int getAuthoredPagesCountByUser(java.lang.String username)
           
 PageResponse<BlogPost> getBlogPosts(Space space, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super BlogPost> predicate)
          Retrieve a page of the current blog posts in this space
 PageResponse<Page> getChildren(Page page, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate, Depth depth)
           
 int getCommentCountOnPage(long id)
          Count the number of comments on the passed in page.
 java.util.List<java.lang.Long> getDescendentIds(Page page)
           
 java.util.List<Page> getDescendents(Page page)
           
 java.lang.Integer getMaxSiblingPosition(Page page)
          Gets the highest position value of all the page's siblings.
 java.util.Date getOldestPageCreationDate()
          Gets the creation date of the oldest page.
 java.util.List<Page> getOrphanedPages(java.lang.String spaceKey)
           
 Page getPage(Space space, java.lang.String pageTitle)
          Get the page by space and title.
 Page getPage(Space space, java.lang.String pageTitle, boolean eagerLoadComments)
           
 Page getPageById(long id)
          Get the page with the given id.
 Page getPageByIdWithComments(long id)
          Get the page with the given id, and perform an eager load of the comments and their children.
 java.util.Collection<java.lang.Long> getPageIds(Space space)
          Get the ids of all pages (current and historical) in the given space.
 java.util.List<Page> getPageInTrash(java.lang.String spaceKey, java.lang.String title)
           
 PageResponse<Page> getPages(LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate)
          Retrieve a page of all the current content
 java.util.List<Page> getPages(Space space, boolean currentOnly)
           
 PageResponse<Page> getPages(Space space, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate)
          Retrieve a page of the current content in this space
 java.util.List<Page> getPagesByIds(java.lang.Iterable<java.lang.Long> ids)
          Get the pages with the given ids.
 java.util.List<Page> getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
           
 java.util.List<Page> getPagesStartingWith(Space space, java.lang.String s)
           
 Page getPageWithComments(Space space, java.lang.String pageTitle)
          Get the page by space and title, and perform an eager load of the comments and their children.
 java.util.List<Page> getPermissionPages(Space space)
           
 java.lang.Class getPersistentClass()
           
 java.util.List<Page> getRecentlyAddedPages(int maxCount, java.lang.String spaceKey)
           
 java.util.List<Page> getRecentlyAuthoredPagesByUser(java.lang.String username, int maxCount)
           
 java.util.List<Page> getRecentlyUpdatedPages(int maxCount, java.lang.String spaceKey)
           
 java.util.List<Page> getTopLevelPages(Space space)
           
 PageResponse<Page> getTopLevelPages(Space space, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Page> predicate)
           
 java.util.List<Page> getUndefinedPages(java.lang.String spaceKey)
           
 void setGroupManager(com.atlassian.user.GroupManager groupManager)
           
 void setHibernateConfig(com.atlassian.config.db.HibernateConfig hibernateConfig)
           
 void setLinkDao(LinkDao linkDao)
           
 
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.ContentEntityObjectHibernateDao
countContentBySpaceIdAndStatus, findContentBySpaceIdAndStatus, findContentBySpaceIdAndStatus, findHistoricalVersionsAfterVersion, findPreviousVersions, getAllCurrentEntities, getByClassId, getById, getContentAuthoredByUser, getFirstVersionAfter, getFirstVersionBefore, getLastEditedVersionsOf, getLockedContentBySpace, getObjectType, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getTrashedContent, getVersion, getVersionHistorySummary
 
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 com.atlassian.confluence.core.persistence.ContentEntityObjectDao
countContentBySpaceIdAndStatus, findContentBySpaceIdAndStatus, findContentBySpaceIdAndStatus, findHistoricalVersionsAfterVersion, findPreviousVersions, getAllCurrentEntities, getById, getContentAuthoredByUser, getFirstVersionAfter, getFirstVersionBefore, getLastEditedVersionsOf, getLockedContentBySpace, getObjectType, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getTrashedContent, getVersion, getVersionHistorySummary
 
Methods inherited from interface com.atlassian.confluence.core.persistence.VersionedObjectDao
findLatestVersionsCount, findLatestVersionsIterator, save
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

HibernatePageDao

public HibernatePageDao()
Method Detail

setHibernateConfig

public void setHibernateConfig(com.atlassian.config.db.HibernateConfig hibernateConfig)

setLinkDao

public void setLinkDao(LinkDao linkDao)

getPageById

public Page getPageById(long id)
Description copied from interface: PageDao
Get the page with the given id.

Specified by:
getPageById in interface PageDao
Parameters:
id - of the page to load
Returns:
the page with the given id, or null if no such page exists

getPagesByIds

public java.util.List<Page> getPagesByIds(java.lang.Iterable<java.lang.Long> ids)
Description copied from interface: PageDao
Get the pages with the given ids.

Specified by:
getPagesByIds in interface PageDao

getCommentCountOnPage

public int getCommentCountOnPage(long id)
Description copied from interface: PageDao
Count the number of comments on the passed in page.

Specified by:
getCommentCountOnPage in interface PageDao

getPageByIdWithComments

public Page getPageByIdWithComments(long id)
Description copied from interface: PageDao
Get the page with the given id, and perform an eager load of the comments and their children. This can be used as a performance optimisation when it is known that all comments will be displayed.

Specified by:
getPageByIdWithComments in interface PageDao
Parameters:
id - of the page to load
Returns:
the page with the given id, or null if no such page exists

getPage

public Page getPage(Space space,
                    java.lang.String pageTitle,
                    boolean eagerLoadComments)

getPageWithComments

public Page getPageWithComments(Space space,
                                java.lang.String pageTitle)
Description copied from interface: PageDao
Get the page by space and title, and perform an eager load of the comments and their children. This can be used as a performance optimisation when it is known that all comments will be displayed.

Specified by:
getPageWithComments in interface PageDao
Parameters:
space - The space the page belongs to
pageTitle - The title of the page
Returns:
the page with the given title in the given space, or null if no such page exists

getPage

public Page getPage(Space space,
                    java.lang.String pageTitle)
Description copied from interface: PageDao
Get the page by space and title.

Specified by:
getPage in interface PageDao
Parameters:
space - The space the page belongs to
pageTitle - The title of the page
Returns:
the page with the given title in the given space, or null if no such page exists

getPages

public java.util.List<Page> getPages(Space space,
                                     boolean currentOnly)
Specified by:
getPages in interface PageDao

getPages

public PageResponse<Page> getPages(Space space,
                                   LimitedRequest limitedRequest,
                                   com.google.common.base.Predicate<? super Page> predicate)
Description copied from interface: PageDao
Retrieve a page of the current content in this space

Specified by:
getPages in interface PageDao
Parameters:
space - - the space to retreive the content for
limitedRequest - - the start and offset of the pages to retrieve
predicate - - the predicate to apply
Returns:

getPages

public PageResponse<Page> getPages(LimitedRequest limitedRequest,
                                   com.google.common.base.Predicate<? super Page> predicate)
Description copied from interface: PageDao
Retrieve a page of all the current content

Specified by:
getPages in interface PageDao
Parameters:
limitedRequest - - the start and offset of the pages to retrieve
predicate - - the predicate to apply
Returns:

getBlogPosts

public PageResponse<BlogPost> getBlogPosts(Space space,
                                           LimitedRequest limitedRequest,
                                           com.google.common.base.Predicate<? super BlogPost> predicate)
Description copied from interface: PageDao
Retrieve a page of the current blog posts in this space

Specified by:
getBlogPosts in interface PageDao
predicate - - the predicate to filter the returned results by, may be null.
Returns:

getPageIds

public java.util.Collection<java.lang.Long> getPageIds(Space space)
Description copied from interface: PageDao
Get the ids of all pages (current and historical) in the given space.

Specified by:
getPageIds in interface PageDao
Parameters:
space - space to retrieve page ids from, can not be null.
Returns:
a Collection of ids for pages.

getAbstractPagesByTitle

public PageResponse<AbstractPage> getAbstractPagesByTitle(java.lang.String title,
                                                          LimitedRequest limitedRequest,
                                                          com.google.common.base.Predicate<? super AbstractPage> filter)
Description copied from interface: PageDao
Returns the pages and blogposts that exactly match the given title, limited to the pagination request

Specified by:
getAbstractPagesByTitle in interface PageDao
Parameters:
title - the title of the page to match
limitedRequest - the pagination requested
filter - a Predicate to apply to the results before returning
Returns:
the paginated list of AbstractPages by title

getAbstractPagesByCreationDate

public PageResponse<AbstractPage> getAbstractPagesByCreationDate(org.joda.time.DateTime date,
                                                                 LimitedRequest pageRequest,
                                                                 com.google.common.base.Predicate<? super AbstractPage> filter)
Description copied from interface: PageDao
Returns the pages and blogposts created on the given date, that also match the given predicate, limited to the page request

Specified by:
getAbstractPagesByCreationDate in interface PageDao
Parameters:
date - - the creation date to match
pageRequest - the pagination request
filter - a Predicate to apply to the results before returning
Returns:
the paginated list of AbstractPages created on the given date

getPagesStartingWith

public java.util.List<Page> getPagesStartingWith(Space space,
                                                 java.lang.String s)
Specified by:
getPagesStartingWith in interface PageDao

getRecentlyAddedPages

public java.util.List<Page> getRecentlyAddedPages(int maxCount,
                                                  java.lang.String spaceKey)
Specified by:
getRecentlyAddedPages in interface PageDao

getRecentlyUpdatedPages

public java.util.List<Page> getRecentlyUpdatedPages(int maxCount,
                                                    java.lang.String spaceKey)
Specified by:
getRecentlyUpdatedPages in interface PageDao

getOrphanedPages

public java.util.List<Page> getOrphanedPages(java.lang.String spaceKey)
Specified by:
getOrphanedPages in interface PageDao

getUndefinedPages

public java.util.List<Page> getUndefinedPages(java.lang.String spaceKey)
Specified by:
getUndefinedPages in interface PageDao

getPermissionPages

public java.util.List<Page> getPermissionPages(Space space)
Specified by:
getPermissionPages in interface PageDao

getAuthoredPagesCountByUser

public int getAuthoredPagesCountByUser(java.lang.String username)
Specified by:
getAuthoredPagesCountByUser in interface PageDao

getRecentlyAuthoredPagesByUser

public java.util.List<Page> getRecentlyAuthoredPagesByUser(java.lang.String username,
                                                           int maxCount)
Specified by:
getRecentlyAuthoredPagesByUser in interface PageDao

getPagesCreatedOrUpdatedSinceDate

public java.util.List<Page> getPagesCreatedOrUpdatedSinceDate(java.util.Date previousLoginDate)
Specified by:
getPagesCreatedOrUpdatedSinceDate in interface PageDao

getPersistentClass

public java.lang.Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao
Overrides:
getPersistentClass in class ContentEntityObjectHibernateDao

findPagesWithHistoricalTitle

public java.util.List findPagesWithHistoricalTitle(java.lang.String pageTitle)
Specified by:
findPagesWithHistoricalTitle in interface PageDao

findPagesWithHistoricalTitleInPermittedSpace

public java.util.List<AbstractPage> findPagesWithHistoricalTitleInPermittedSpace(java.lang.String pageTitle,
                                                                                 Space space,
                                                                                 int maxResultCount)
Description copied from interface: PageDao
Searches for pages in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.

Only pages in spaces the remote user is able to view will be returned.

Specified by:
findPagesWithHistoricalTitleInPermittedSpace in interface PageDao
Parameters:
pageTitle - title of a page in a previous version.
space - Space to search. Must not be null.
maxResultCount - maximum pages to return

findBlogsWithHistoricalTitleInPermittedSpace

public java.util.List<AbstractPage> findBlogsWithHistoricalTitleInPermittedSpace(java.lang.String blogTitle,
                                                                                 Space space,
                                                                                 int maxResultCount)
Description copied from interface: PageDao
Searches for blogs in the space specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.

Only blogs in spaces the remote user is able to view will be returned.

Specified by:
findBlogsWithHistoricalTitleInPermittedSpace in interface PageDao
Parameters:
blogTitle - title of a page in a previous version.
space - Space to search. Must not be null.
maxResultCount - maximum pages to return
Returns:
a list of pages that have the given title in a previous version

findPagesWithHistoricalTitleInAllPermittedSpacesExcept

public java.util.List<AbstractPage> findPagesWithHistoricalTitleInAllPermittedSpacesExcept(java.lang.String pageTitle,
                                                                                           Space space,
                                                                                           int maxResultCount)
Description copied from interface: PageDao
Searches for pages in all spaces except the one specified, looking for those that have the given title in a previous version, and returns the first maxResultCount results.

Only pages in spaces the remote user is able to view will be returned.

Specified by:
findPagesWithHistoricalTitleInAllPermittedSpacesExcept in interface PageDao
Parameters:
pageTitle - title of a page in a previous version.
space - Space to exclude from search. If null, all spaces are searched.
maxResultCount - maximum pages to return

getPageInTrash

public java.util.List<Page> getPageInTrash(java.lang.String spaceKey,
                                           java.lang.String title)
Specified by:
getPageInTrash in interface PageDao

getDescendents

public java.util.List<Page> getDescendents(Page page)
Specified by:
getDescendents in interface PageDao

getDescendentIds

public java.util.List<java.lang.Long> getDescendentIds(Page page)
Specified by:
getDescendentIds in interface PageDao

getTopLevelPages

public java.util.List<Page> getTopLevelPages(Space space)
Specified by:
getTopLevelPages in interface PageDao

getTopLevelPages

public PageResponse<Page> getTopLevelPages(Space space,
                                           LimitedRequest limitedRequest,
                                           com.google.common.base.Predicate<? super Page> predicate)
Specified by:
getTopLevelPages in interface PageDao

getChildren

public PageResponse<Page> getChildren(Page page,
                                      LimitedRequest limitedRequest,
                                      com.google.common.base.Predicate<? super Page> predicate,
                                      Depth depth)
Specified by:
getChildren in interface PageDao

getMaxSiblingPosition

public java.lang.Integer getMaxSiblingPosition(Page page)
Description copied from interface: PageDao
Gets the highest position value of all the page's siblings. This is useful when we need to find what position to assign to a new page that should go to the bottom.

Specified by:
getMaxSiblingPosition in interface PageDao
Parameters:
page - The page whose siblings from which to get the max position
Returns:
The highest position value of all the page's siblings

setGroupManager

public void setGroupManager(com.atlassian.user.GroupManager groupManager)

getOldestPageCreationDate

public java.util.Date getOldestPageCreationDate()
Description copied from interface: ContentEntityObjectDao
Gets the creation date of the oldest page.

Specified by:
getOldestPageCreationDate in interface ContentEntityObjectDao
Overrides:
getOldestPageCreationDate in class ContentEntityObjectHibernateDao
Returns:
creation date of the oldest page in Confluence


Copyright © 2003-2014 Atlassian. All Rights Reserved.