Interface PageDao

    • Method Detail

      • getPageById

        Page getPageById​(long id)
        Get the page with the given id.
        Parameters:
        id - of the page to load
        Returns:
        the page with the given id, or null if no such page exists
      • getPagesByIds

        List<Page> getPagesByIds​(Iterable<Long> ids)
        Get the pages with the given ids.
        Since:
        4.2
      • getPageByIdWithComments

        Page getPageByIdWithComments​(long id)
        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.
        Parameters:
        id - of the page to load
        Returns:
        the page with the given id, or null if no such page exists
      • getCommentCountOnPage

        int getCommentCountOnPage​(long id)
        Count the number of comments on the passed in page.
      • getPage

        Page getPage​(Space space,
                     String pageTitle)
        Get the page by space and title.
        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
      • getPageWithComments

        Page getPageWithComments​(Space space,
                                 String pageTitle)
        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.
        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

        List<Page> getPages​(@Nullable Space space,
                            boolean currentOnly)
      • getPagesWithPermissions

        List<Page> getPagesWithPermissions​(Space space)
        Get 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.
        Returns:
        a list of all the current pages in a space
        Since:
        6.1.3
      • getRecentlyAddedPages

        List<Page> getRecentlyAddedPages​(int maxCount,
                                         @Nullable String spaceKey)
      • getRecentlyUpdatedPages

        List<Page> getRecentlyUpdatedPages​(int maxCount,
                                           @Nullable String spaceKey)
      • getOrphanedPages

        @Deprecated
        List<Page> getOrphanedPages​(@Nullable String spaceKey)
        Deprecated.
        since 7.0.0, no replacement

        This should be removed as the result of this ticket https://jira.atlassian.com/browse/CONFSRVDEV-10111

      • getPermissionPages

        List<Page> getPermissionPages​(Space space)
      • getAuthoredPagesCountByUser

        int getAuthoredPagesCountByUser​(String username)
      • getRecentlyAuthoredPagesByUser

        List<Page> getRecentlyAuthoredPagesByUser​(String username,
                                                  int maxCount)
      • getPagesCreatedOrUpdatedSinceDate

        List<Page> getPagesCreatedOrUpdatedSinceDate​(Date previousLoginDate)
      • findPagesWithCurrentOrHistoricalTitleInPermittedSpace

        List<AbstractPage> 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.

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

        Parameters:
        pageTitle - title of a page in a previous version.
        space - Space to search. Must not be null.
        maxResultCount - maximum pages to return
        Since:
        5.9
      • findBlogsWithCurrentOrHistoricalTitleInPermittedSpace

        List<AbstractPage> 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.

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

        Parameters:
        permissionQueryBuilder - required to determine how to construct database queries for space permissions, for the current user
        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
        Since:
        5.9
      • findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept

        List<AbstractPage> 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.

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

        Parameters:
        blogTitle - Title of the blog to find
        space - 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
        Since:
        5.9
      • findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept

        List<AbstractPage> findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept​(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.

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

        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
        Since:
        5.9
      • findContentPermissionSummaryByIds

        List<ContentPermissionSummary> findContentPermissionSummaryByIds​(Collection<Long> ids)
        Get Content creator for bulk permission checking
        Parameters:
        ids - of Content
        Returns:
        list contain information for permission checking
        Since:
        6.0
      • countCurrentPages

        int countCurrentPages()
        Counts the total number of current pages across all spaces
        Returns:
        the number of current pages
        Since:
        5.9
      • countDraftPages

        int countDraftPages()
        Counts 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).
        Returns:
        the number of draft pages
        Since:
        6.3.1
      • countPagesWithUnpublishedChanges

        int countPagesWithUnpublishedChanges()
        Counts the number of published pages that have unpublished changes.
        Returns:
        the number of pages with unpublished changes.
        Since:
        6.3.1
      • countAllPages

        int countAllPages()
        Counts the total number of all page entities across all spaces, including non-current pages
        Returns:
        the number of pages
        Since:
        5.9
      • getPageStatistics

        Optional<PageStatisticsDTO> getPageStatistics()
        Fetches statistics about pages
        Returns:
        a PageStatisticsDTO with information about pages such as total, current, and draft count
        Since:
        6.11.0
      • getPageCount

        long getPageCount​(@NonNull String spaceKey)
        Get total number of current pages in a space
        Parameters:
        spaceKey - the space to look for pages in
        Returns:
        a count number of pages
        Since:
        6.1.3
      • getPageCount

        long getPageCount​(@NonNull String spaceKey,
                          List<ContentStatus> statuses)
        Get total number of pages in a space, within any of the given statuses.
        Parameters:
        spaceKey - the space to look for pages in
        statuses - list of statuses the pages can be in
        Returns:
        a count number of pages
        Since:
        7.14.0
      • getAncestorsFor

        Map<Long,​List<Long>> getAncestorsFor​(Collection<Long> ids)
        Get the list page ids of the ancestors of the given page ids.
        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
        Since:
        6.0
      • getDescendants

        List<Page> getDescendants​(Page page)
        Finds all descendant pages (recursive) of the given page
        Returns:
        List of descendant pages
      • getDescendantTitles

        List<String> getDescendantTitles​(Page page)
        Finds all descendant titles of the given page
        Returns:
        List of descendant titles
      • getDescendantIds

        List<Long> getDescendantIds​(Page page)
        Finds the ids of all descendant pages of the given page
        Returns:
        List of page ids
      • getDescendantIds

        List<Long> getDescendantIds​(Page page,
                                    ContentStatus... statuses)
        Finds the ids of all descendant pages of the given page
        Parameters:
        page -
        Returns:
        List of page ids
      • countPagesInSubtree

        int countPagesInSubtree​(@NonNull Page page)
        Return total descendant page including input page
        Returns:
        total page
      • getDraftChildren

        PageResponse<Page> getDraftChildren​(Page page,
                                            LimitedRequest pageRequest,
                                            Depth depth)
        Returns 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
        Parameters:
        page - the page to find children for
        pageRequest - the pagination requested
        depth - the depth to return children to
        Returns:
        the paginated response of Page entities
      • getAllChildren

        PageResponse<Page> getAllChildren​(Page page,
                                          LimitedRequest pageRequest,
                                          Depth depth)
        Returns all children of a page (including drafts), limited to the pagination requested.
        Parameters:
        page - the page to find children for
        pageRequest - the pagination requested
        depth - the depth to return children to
        Returns:
        the paginated response of Page entities
        Since:
        6.7.1
      • getMaxSiblingPosition

        Integer getMaxSiblingPosition​(Page page)
        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.
        Parameters:
        page - The page whose siblings from which to get the max position
        Returns:
        The highest position value of all the page's siblings
        Since:
        3.5.12
      • getPageIds

        Collection<Long> getPageIds​(Space space)
        Get the ids of all pages (current and historical) in the given space.
        Parameters:
        space - space to retrieve page ids from, can not be null.
        Returns:
        a Collection of ids for pages.
        Since:
        4.2
      • getAbstractPagesByCreationDate

        @Deprecated
        PageResponse<AbstractPage> getAbstractPagesByCreationDate​(org.joda.time.DateTime date,
                                                                  LimitedRequest pageRequest,
                                                                  com.google.common.base.Predicate<? super AbstractPage> filter)
        Returns the abstract pages created on the given date, that also match the given filter, limited to the page request. To get just pages or blog posts can be requested just specifying a content type based filter.
        Parameters:
        date - - the creation date to match
        pageRequest - the pagination request
        filter - the predicate to apply to the results before returning
        Returns:
        the paginated list of AbstractPages created on the given date
      • getAbstractPages

        @Deprecated
        PageResponse<AbstractPage> getAbstractPages​(Space space,
                                                    String title,
                                                    List<ContentStatus> statuses,
                                                    LimitedRequest pageRequest,
                                                    com.google.common.base.Predicate<? super AbstractPage> filter)
        Returns the abstract pages from a space that exactly match the given title and are in any of the specified statuses, and match the given filter, limited to the pagination request. To get just pages or blog posts can be requested just specifying a content type based filter.
        Parameters:
        space - space the page belongs to
        title - the title of the page to match
        statuses - list of statuses the content can be in
        pageRequest - the pagination requested
        filter - the predicate to apply to the results before returning
        Returns:
        the paginated list of AbstractPages by space and title, with the given statuses
      • getAbstractPages

        @Deprecated
        PageResponse<AbstractPage> getAbstractPages​(String title,
                                                    List<ContentStatus> statuses,
                                                    LimitedRequest pageRequest,
                                                    com.google.common.base.Predicate<? super AbstractPage> filter)
        Returns the abstract pages that exactly match the given title, are in any of the specified statuses, and match the given filter, limited to the pagination request. To get just pages or blog posts can be requested just specifying a content type based filter.
        Parameters:
        title - the title of the page to match
        statuses - list of statuses the content can be in
        pageRequest - the pagination requested
        filter - the predicate to apply to the results before returning
        Returns:
        the paginated list of AbstractPages by title
      • getAbstractPages

        @Deprecated
        PageResponse<AbstractPage> getAbstractPages​(org.joda.time.DateTime date,
                                                    List<ContentStatus> statuses,
                                                    LimitedRequest pageRequest,
                                                    com.google.common.base.Predicate<? super AbstractPage> filter)
        Returns the abstract pages created on the given date and are in the , that also match the given filter, limited to the page request. To get just pages or blog posts can be requested just specifying a content type based filter.
        Parameters:
        date - the creation date to match
        statuses - list of statuses the content can be in
        pageRequest - the pagination request
        filter - the predicate to apply to the results before returning
        Returns:
        the paginated list of AbstractPages created on the given date