Class HibernatePageDao
java.lang.Object
org.springframework.dao.support.DaoSupport
com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao<T>
com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao<T>
com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao<Page>
com.atlassian.confluence.pages.persistence.dao.hibernate.HibernatePageDao
- All Implemented Interfaces:
PageDaoInternal,PageDao,org.springframework.beans.factory.InitializingBean
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability -
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintconvertToBlogPost(ContentId id, Date currentDate) Convert the page with given id into a blogpostintCounts the total number of all page entities across all spaces, including non-current pageslongcountContentByTypedAndStatuses(List<ContentType> contentTypes, List<ContentStatus> contentStatuses) Retrieve the latest content count of specific content type for a given space with a particular status.intCounts the total number of current pages across all spacesintCounts the number of pages that are drafts.intcountPagesInSubtree(@NonNull Page page) Return total descendant page including input pageintCounts the number of published pages that have unpublished changes.longcountSpaceContentByTypedAndStatuses(Space space, List<ContentType> contentTypes, List<ContentStatus> contentStatuses) Retrieve the latest content count of specific content type for a given space with a particular status.findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept(SpacePermissionQueryBuilder permissionQueryBuilder, String blogTitle, Space space, int maxResultCount) Searches for blog posts in all spaces except the one specified, looking for those that have the given title in a current or previous version, and returns the first maxResultCount results.findBlogsWithCurrentOrHistoricalTitleInPermittedSpace(SpacePermissionQueryBuilder permissionQueryBuilder, 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.Get Content creator for bulk permission checkingfindPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept(SpacePermissionQueryBuilder permissionQueryBuilder, 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.findPagesWithCurrentOrHistoricalTitleInPermittedSpace(SpacePermissionQueryBuilder permissionQueryBuilder, 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.getAbstractPages(Space space, String title, List<ContentStatus> statuses, LimitedRequest pageRequest) getAbstractPages(Space space, List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) getAbstractPages(com.atlassian.core.util.DateUtils.DateRange range, List<ContentStatus> statuses, LimitedRequest pageRequest) getAbstractPages(String title, List<ContentStatus> statuses, LimitedRequest pageRequest) getAbstractPages(List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) getAbstractPagesByCreationDate(com.atlassian.core.util.DateUtils.DateRange range, LimitedRequest pageRequest) getAbstractPagesByTitle(String title, LimitedRequest limitedRequest) getAllChildren(Page page, LimitedRequest pageRequest) Returns all children of a page (including drafts), limited to the pagination requested.getAncestorsFor(Collection<Long> ids) Get the list page ids of the ancestors of the given page ids.intgetBlogPosts(Space space, LimitedRequest limitedRequest) getById(long id) getChildren(Page page, LimitedRequest pageRequest) intgetCommentCountOnPage(long id) Count the number of comments on the passed in page.getDescendantIds(Page page) Finds the ids of all descendant pages of the given pagegetDescendantIds(Page page, ContentStatus... contentStatus) Finds the ids of all descendant pages of the given pagegetDescendants(Page page) Finds all descendant pages (recursive) of the given pagegetDescendantTitles(Page page) Finds all descendant titles of the given pagegetDraftChildren(Page page, LimitedRequest pageRequest) Returns the children of a page which have a status of DRAFT, limited to the pagination requested.getMaxSiblingPosition(Page page) Gets the highest position value of all the page's siblings.getOrphanedPages(@Nullable String spaceKey) Get the page by space and title.getPageById(long id) Get the page with the given id.getPageByIdWithComments(long id) Get the page with the given id, and perform an eager load of the comments and their children.longgetPageCount(@NonNull String spaceKey) Get total number of current pages in a spacelonggetPageCount(@NonNull String spaceKey, List<ContentStatus> statuses) Get total number of pages in a space, within any of the given statuses.getPageIds(Space space) Get the ids of all pages (current and historical) in the given space.getPageInTrash(String spaceKey, String title) getPages(LimitedRequest pageRequest) getPages(Space space, LimitedRequest pageRequest) getPagesByIds(Iterable<Long> ids) Get the pages with the given ids.getPagesCreatedOrUpdatedSinceDate(Date previousLoginDate) getPagesStartingWith(Space space, String s) Fetches statistics about pagesgetPagesWithPermissions(@NonNull Space space) Get all current pages in a space and eagerly fetch permissions at the same time.getPageWithComments(Space space, String pageTitle) Get the page by space and title, and perform an eager load of the comments and their children.getPermissionPages(Space space) getPermissionPages(Space space, LimitedRequest limitedRequest) Pagination permission pages for particular SpacelonggetPermissionPagesCount(Space space) Get total number of permission pages for particular SpacegetRecentlyAddedPages(int maxCount, @Nullable String spaceKey) getRecentlyAuthoredPagesByUser(ConfluenceUser user, int maxCount) getRecentlyUpdatedPages(int maxCount, @Nullable String spaceKey) getTopLevelPages(Space space) getTopLevelPages(Space space, LimitedRequest limitedRequest) final List<OutgoingLink>getUndefinedLinks(@Nullable String spaceKey) final List<OutgoingLink>getUndefinedLinks(@Nullable String spaceKey, LimitedRequest limitedRequest) Retrieve the undefined links in a space.final longgetUndefinedLinksCount(String spaceKey) Retrieve the undefined links count in a space.getUndefinedPages(@Nullable String spaceKey) Deprecated.protected voidscanFilteredSpaceAbstractPages(Space space, List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) Retrieves a page response of all Abstract Page in a Space with specified content types and content statuses.scanFilteredSpaceAbstractPages(List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) Retrieves a page response of Abstract Page with specified content types and content statuses.voidsetEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
applyChildVersioningPolicy, findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, findLatestVersionsIterator, findNamedQueryStringParams, findNamedQueryStringParams, remove, saveMethods inherited from class com.atlassian.confluence.core.persistence.hibernate.ConfluenceHibernateObjectDao
updateModificationDataMethods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, getHibernateTemplate, getSessionFactory, reIndex, save, saveEntity, saveRaw, setHibernateTemplate, setSessionFactory, uniqueResultMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
HibernatePageDao
public HibernatePageDao()
-
-
Method Details
-
getPageById
Description copied from interface:PageDaoGet the page with the given id.- Specified by:
getPageByIdin interfacePageDao- Parameters:
id- of the page to load- Returns:
- the page with the given id, or null if no such page exists
-
getPagesByIds
Description copied from interface:PageDaoGet the pages with the given ids.- Specified by:
getPagesByIdsin interfacePageDao
-
getCommentCountOnPage
public int getCommentCountOnPage(long id) Description copied from interface:PageDaoCount the number of comments on the passed in page.- Specified by:
getCommentCountOnPagein interfacePageDao
-
getPageByIdWithComments
Description copied from interface:PageDaoGet 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:
getPageByIdWithCommentsin interfacePageDao- Parameters:
id- of the page to load- Returns:
- the page with the given id, or null if no such page exists
-
getPage
-
getPageWithComments
Description copied from interface:PageDaoGet 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:
getPageWithCommentsin interfacePageDao- Parameters:
space- The space the page belongs topageTitle- The title of the page- Returns:
- the page with the given title in the given space, or null if no such page exists
-
getPage
Description copied from interface:PageDaoGet the page by space and title. -
getPages
-
getPagesWithPermissions
Description copied from interface:PageDaoGet all current pages in a space and eagerly fetch permissions at the same time. This is an optimisation for when you known that permissions will need to be fetched for all or most of the pages later.- Specified by:
getPagesWithPermissionsin interfacePageDao- Returns:
- a list of all the current pages in a space
-
getPages
- Specified by:
getPagesin interfacePageDaoInternal
-
getPages
- Specified by:
getPagesin interfacePageDaoInternal
-
getBlogPosts
- Specified by:
getBlogPostsin interfacePageDaoInternal
-
getAbstractPages
public List<AbstractPage> getAbstractPages(Space space, List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) - Specified by:
getAbstractPagesin interfacePageDaoInternal
-
getAbstractPages
public List<AbstractPage> getAbstractPages(List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) - Specified by:
getAbstractPagesin interfacePageDaoInternal
-
getPageIds
Description copied from interface:PageDaoGet the ids of all pages (current and historical) in the given space.- Specified by:
getPageIdsin interfacePageDao- Parameters:
space- space to retrieve page ids from, can not be null.- Returns:
- a Collection of ids for pages.
-
getAbstractPagesByTitle
- Specified by:
getAbstractPagesByTitlein interfacePageDaoInternal
-
getAbstractPagesByCreationDate
public List<AbstractPage> getAbstractPagesByCreationDate(com.atlassian.core.util.DateUtils.DateRange range, LimitedRequest pageRequest) - Specified by:
getAbstractPagesByCreationDatein interfacePageDaoInternal
-
getAbstractPages
public List<AbstractPage> getAbstractPages(Space space, String title, List<ContentStatus> statuses, LimitedRequest pageRequest) - Specified by:
getAbstractPagesin interfacePageDaoInternal
-
getAbstractPages
public List<AbstractPage> getAbstractPages(String title, List<ContentStatus> statuses, LimitedRequest pageRequest) - Specified by:
getAbstractPagesin interfacePageDaoInternal
-
getAbstractPages
public List<AbstractPage> getAbstractPages(com.atlassian.core.util.DateUtils.DateRange range, List<ContentStatus> statuses, LimitedRequest pageRequest) - Specified by:
getAbstractPagesin interfacePageDaoInternal
-
getPagesStartingWith
- Specified by:
getPagesStartingWithin interfacePageDao
-
getRecentlyAddedPages
- Specified by:
getRecentlyAddedPagesin interfacePageDao
-
getRecentlyUpdatedPages
- Specified by:
getRecentlyUpdatedPagesin interfacePageDao
-
getOrphanedPages
- Specified by:
getOrphanedPagesin interfacePageDao
-
getUndefinedPages
Deprecated.since 6.6.0, usegetUndefinedLinks(String)- Specified by:
getUndefinedPagesin interfacePageDao
-
getUndefinedLinks
- Specified by:
getUndefinedLinksin interfacePageDao
-
getUndefinedLinks
public final List<OutgoingLink> getUndefinedLinks(@Nullable String spaceKey, LimitedRequest limitedRequest) Description copied from interface:PageDaoInternalRetrieve the undefined links in a space.- Specified by:
getUndefinedLinksin interfacePageDaoInternal- Parameters:
spaceKey- space key- Returns:
- the list of outgoing links
-
getUndefinedLinksCount
Description copied from interface:PageDaoInternalRetrieve the undefined links count in a space.- Specified by:
getUndefinedLinksCountin interfacePageDaoInternal- Parameters:
spaceKey- space key- Returns:
- the count of outgoing links
-
getPermissionPages
- Specified by:
getPermissionPagesin interfacePageDao
-
getPermissionPages
Description copied from interface:PageDaoInternalPagination permission pages for particular Space- Specified by:
getPermissionPagesin interfacePageDaoInternal- Returns:
- Collection of permission pages within the request range
-
getPermissionPagesCount
Description copied from interface:PageDaoInternalGet total number of permission pages for particular Space- Specified by:
getPermissionPagesCountin interfacePageDaoInternal- Returns:
- the count
-
convertToBlogPost
Description copied from interface:PageDaoInternalConvert the page with given id into a blogpost- Specified by:
convertToBlogPostin interfacePageDaoInternal- Parameters:
id- of page to be convertedcurrentDate- current Date which would be updated as the creation date for blogpost- Returns:
- the number of rows updated in the database
-
countSpaceContentByTypedAndStatuses
public long countSpaceContentByTypedAndStatuses(Space space, List<ContentType> contentTypes, List<ContentStatus> contentStatuses) Description copied from interface:PageDaoInternalRetrieve the latest content count of specific content type for a given space with a particular status.- Specified by:
countSpaceContentByTypedAndStatusesin interfacePageDaoInternal- Parameters:
space- the spacecontentTypes- type of contentscontentStatuses- the statuses of the content being retrieved (e.g.ContentEntityObject.DELETED- Returns:
- the number of content objects with that status in that space
-
countContentByTypedAndStatuses
public long countContentByTypedAndStatuses(List<ContentType> contentTypes, List<ContentStatus> contentStatuses) Description copied from interface:PageDaoInternalRetrieve the latest content count of specific content type for a given space with a particular status.- Specified by:
countContentByTypedAndStatusesin interfacePageDaoInternal- Parameters:
contentTypes- type of contentscontentStatuses- the statuses of the content being retrieved (e.g.ContentEntityObject.DELETED- Returns:
- the number of content objects with that status in that space
-
getAuthoredPagesCountByUser
- Specified by:
getAuthoredPagesCountByUserin interfacePageDao
-
getRecentlyAuthoredPagesByUser
-
getPagesCreatedOrUpdatedSinceDate
- Specified by:
getPagesCreatedOrUpdatedSinceDatein interfacePageDao
-
getPersistentClass
- Specified by:
getPersistentClassin classHibernateObjectDao<Page>
-
findPagesWithCurrentOrHistoricalTitleInPermittedSpace
public List<AbstractPage> findPagesWithCurrentOrHistoricalTitleInPermittedSpace(SpacePermissionQueryBuilder permissionQueryBuilder, String pageTitle, Space space, int maxResultCount) Description copied from interface:PageDaoSearches 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:
findPagesWithCurrentOrHistoricalTitleInPermittedSpacein interfacePageDaopageTitle- title of a page in a previous version.space- Space to search. Must not be null.maxResultCount- maximum pages to return
-
findBlogsWithCurrentOrHistoricalTitleInPermittedSpace
public List<AbstractPage> findBlogsWithCurrentOrHistoricalTitleInPermittedSpace(SpacePermissionQueryBuilder permissionQueryBuilder, String blogTitle, Space space, int maxResultCount) Description copied from interface:PageDaoSearches 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:
findBlogsWithCurrentOrHistoricalTitleInPermittedSpacein interfacePageDao- Parameters:
permissionQueryBuilder- required to determine how to construct database queries for space permissions, for the current userblogTitle- 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
-
findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept
public List<AbstractPage> findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept(SpacePermissionQueryBuilder permissionQueryBuilder, String blogTitle, Space space, int maxResultCount) Description copied from interface:PageDaoSearches for blog posts in all spaces except the one specified, looking for those that have the given title in a current or previous version, and returns the first maxResultCount results.Only pages in spaces the remote user is able to view will be returned.
- Specified by:
findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExceptin interfacePageDaoblogTitle- Title of the blog to findspace- Space to exclude from search. If null, all spaces are searched.maxResultCount- maximum blog posts to return- Returns:
- a list of blog posts that have or have had the given title
-
findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept
public List<AbstractPage> findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept(SpacePermissionQueryBuilder permissionQueryBuilder, String pageTitle, Space space, int maxResultCount) Description copied from interface:PageDaoSearches 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:
findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExceptin interfacePageDaopageTitle- 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
-
findContentPermissionSummaryByIds
Description copied from interface:PageDaoGet Content creator for bulk permission checking- Specified by:
findContentPermissionSummaryByIdsin interfacePageDao- Parameters:
ids- of Content- Returns:
- list contain information for permission checking
-
countCurrentPages
public int countCurrentPages()Description copied from interface:PageDaoCounts the total number of current pages across all spaces- Specified by:
countCurrentPagesin interfacePageDao- Returns:
- the number of current pages
-
countDraftPages
public int countDraftPages()Description copied from interface:PageDaoCounts the number of pages that are drafts. This does not include drafts of pages that have already been published (i.e. pages with unpublished changes).- Specified by:
countDraftPagesin interfacePageDao- Returns:
- the number of draft pages
-
countPagesWithUnpublishedChanges
public int countPagesWithUnpublishedChanges()Description copied from interface:PageDaoCounts the number of published pages that have unpublished changes.- Specified by:
countPagesWithUnpublishedChangesin interfacePageDao- Returns:
- the number of pages with unpublished changes.
-
getPageCount
Description copied from interface:PageDaoGet total number of current pages in a space- Specified by:
getPageCountin interfacePageDao- Parameters:
spaceKey- the space to look for pages in- Returns:
- a count number of pages
-
getPageCount
Description copied from interface:PageDaoGet total number of pages in a space, within any of the given statuses.- Specified by:
getPageCountin interfacePageDao- Parameters:
spaceKey- the space to look for pages instatuses- list of statuses the pages can be in- Returns:
- a count number of pages
-
getPageStatistics
Description copied from interface:PageDaoFetches statistics about pages- Specified by:
getPageStatisticsin interfacePageDao- Returns:
- a PageStatisticsDTO with information about pages such as total, current, and draft count
-
countAllPages
public int countAllPages()Description copied from interface:PageDaoCounts the total number of all page entities across all spaces, including non-current pages- Specified by:
countAllPagesin interfacePageDao- Returns:
- the number of pages
-
getPageInTrash
- Specified by:
getPageInTrashin interfacePageDao
-
getDescendants
Description copied from interface:PageDaoFinds all descendant pages (recursive) of the given page- Specified by:
getDescendantsin interfacePageDao- Returns:
- List of descendant pages
-
countPagesInSubtree
Description copied from interface:PageDaoReturn total descendant page including input page- Specified by:
countPagesInSubtreein interfacePageDao- Returns:
- total page
-
getAncestorsFor
Description copied from interface:PageDaoGet the list page ids of the ancestors of the given page ids.- Specified by:
getAncestorsForin interfacePageDao- Parameters:
ids- the list of page ids to get ancestor page ids for- Returns:
- a map where the key is the given page id and the value is a list of all its ancestors' page ids
-
getDescendantTitles
Description copied from interface:PageDaoFinds all descendant titles of the given page- Specified by:
getDescendantTitlesin interfacePageDao- Returns:
- List of descendant titles
-
getDescendantIds
Description copied from interface:PageDaoFinds the ids of all descendant pages of the given page- Specified by:
getDescendantIdsin interfacePageDao- Returns:
- List of page ids
-
getDescendantIds
Description copied from interface:PageDaoFinds the ids of all descendant pages of the given page- Specified by:
getDescendantIdsin interfacePageDao- Returns:
- List of page ids
-
getTopLevelPages
- Specified by:
getTopLevelPagesin interfacePageDao
-
getTopLevelPages
- Specified by:
getTopLevelPagesin interfacePageDaoInternal
-
getChildren
- Specified by:
getChildrenin interfacePageDaoInternal
-
getDraftChildren
Description copied from interface:PageDaoReturns the children of a page which have a status of DRAFT, limited to the pagination requested. Will fetch drafts all drafts regardless of whether the current authenticated user has permission to view the drafts- Specified by:
getDraftChildrenin interfacePageDao- Parameters:
page- the page to find children forpageRequest- the pagination requested- Returns:
- the paginated response of Page entities
-
getAllChildren
Description copied from interface:PageDaoReturns all children of a page (including drafts), limited to the pagination requested.- Specified by:
getAllChildrenin interfacePageDao- Parameters:
page- the page to find children forpageRequest- the pagination requested- Returns:
- the paginated response of Page entities
-
getMaxSiblingPosition
Description copied from interface:PageDaoGets 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:
getMaxSiblingPositionin interfacePageDao- Parameters:
page- The page whose siblings from which to get the max position- Returns:
- The highest position value of all the page's siblings
-
scanFilteredSpaceAbstractPages
public List<AbstractPage> scanFilteredSpaceAbstractPages(List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) Description copied from interface:PageDaoInternalRetrieves a page response of Abstract Page with specified content types and content statuses.- Specified by:
scanFilteredSpaceAbstractPagesin interfacePageDaoInternalstatuses- list of content status which we are interested to fetchpageRequest- limit and cursor of the pages to retrieve. Cursor in pageRequest can't be null.- Returns:
- the paginated list of pages
-
scanFilteredSpaceAbstractPages
public List<AbstractPage> scanFilteredSpaceAbstractPages(Space space, List<ContentType> contentTypes, List<ContentStatus> statuses, LimitedRequest pageRequest) Description copied from interface:PageDaoInternalRetrieves a page response of all Abstract Page in a Space with specified content types and content statuses.- Specified by:
scanFilteredSpaceAbstractPagesin interfacePageDaoInternal- Parameters:
space- the space to locate the page incontentTypes- content status to matchstatuses- content status to matchpageRequest- limit and cursor of the pages to retrieve. Cursor in pageRequest can't be null.- Returns:
- the paginated list of pages
-
getById
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) -
publishEvent
- Overrides:
publishEventin classHibernateObjectDao<Page>
-
getUndefinedLinks(String)