Class DelegatingPageDao

    • Constructor Detail

      • DelegatingPageDao

        protected DelegatingPageDao​(PageDaoInternal delegateDao)
    • Method Detail

      • getDelegateDao

        public PageDao getDelegateDao()
      • getPage

        public Page getPage​(Space space,
                            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
      • getPageWithComments

        public Page getPageWithComments​(Space space,
                                        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
      • remove

        public void remove​(com.atlassian.core.bean.EntityObject object)
        Description copied from interface: ObjectDao
        Remove object from persistence.
        Specified by:
        remove in interface ObjectDao
        Specified by:
        remove in interface ObjectDaoInternal<Page>
      • save

        public void save​(com.atlassian.core.bean.EntityObject objectToSave,
                         com.atlassian.core.bean.EntityObject originalObject)
        Description copied from interface: VersionedObjectDao
        Saves the given current object and historical object
        Specified by:
        save in interface VersionedObjectDao<Page>
        Parameters:
        objectToSave - the current object.
        originalObject - the original object. This will be mutated to become a historical version as part of this save.
      • saveEntity

        public void saveEntity​(Page currentObject,
                               @Nullable Page originalObject)
        Description copied from interface: VersionedObjectDaoInternal
        Saves the given current object and historical object.
        Specified by:
        saveEntity in interface VersionedObjectDaoInternal<Page>
        Parameters:
        currentObject - the current object.
        originalObject - the original object. This will be mutated to become a historical version as part of this save.
      • saveEntity

        public void saveEntity​(Page objectToSave)
        Description copied from interface: ObjectDaoInternal
        Saves the given object to the database.
        Specified by:
        saveEntity in interface ObjectDaoInternal<Page>
        Parameters:
        objectToSave - the object to save.
      • saveRaw

        public void saveRaw​(com.atlassian.core.bean.EntityObject objectToSave)
        Description copied from interface: ObjectDao
        saves the object. if the object is new, this won't set the creation date on the object. if it already exists, then it won't set the date that it was updated.
        Specified by:
        saveRaw in interface ObjectDao
        Specified by:
        saveRaw in interface ObjectDaoInternal<Page>
        Parameters:
        objectToSave - the object to save.
      • saveRawEntity

        public void saveRawEntity​(Page objectToSave)
        Description copied from interface: ObjectDaoInternal
        Saves the object without updating modification daa.

        If the object is new, this won't set the creation date on the object. If it already exists, then it won't set the date that it was updated.

        Specified by:
        saveRawEntity in interface ObjectDaoInternal<Page>
        Parameters:
        objectToSave - the object to save.
      • findAllSorted

        public @NonNull List<Page> findAllSorted​(String s)
        Description copied from interface: ObjectDao
        Find all objects currently persisted of a particular type and sort results by named property.
        Specified by:
        findAllSorted in interface ObjectDao
        Specified by:
        findAllSorted in interface ObjectDaoInternal<Page>
        Parameters:
        s - the name of the property to be sorted on. This should be null if no sorting is required.
      • findAllSorted

        public @NonNull List<Page> findAllSorted​(String s,
                                                 boolean cached,
                                                 int firstRow,
                                                 int maxRows)
        Description copied from interface: ObjectDao
        Find all objects currently persisted of a particular type and sort results by named property. This version of the method allows more control over the query.
        Specified by:
        findAllSorted in interface ObjectDao
        Specified by:
        findAllSorted in interface ObjectDaoInternal<Page>
        Parameters:
        s - the name of the property to be sorted on. This should be null if no sorting is required.
        cached - control whether the results should be cached
        firstRow - the index of the first result to be returned
        maxRows - the maximum number of results required. Use -1 to specify no limit.
      • findByClassIds

        @Deprecated
        public <T> @NonNull PageResponse<T> findByClassIds​(Iterable<Long> ids,
                                                           LimitedRequest limitedRequest,
                                                           com.google.common.base.Predicate<? super T> filter)
        Deprecated.
        Description copied from interface: ObjectDao
        Find a list of objects from the same persistent class.
        Specified by:
        findByClassIds in interface ObjectDao
        Specified by:
        findByClassIds in interface ObjectDaoInternal<Page>
        Type Parameters:
        T - the type of entity to return
        Parameters:
        ids - - the ids of the entities to find
        limitedRequest - the pagination request defining the page size to fetch
        filter - a predicate to do in memory filtering of the result set before returning
        Returns:
        a list of objects matching the filters
      • findByClassIdsFiltered

        public @NonNull PageResponse<Page> findByClassIdsFiltered​(Iterable<Long> ids,
                                                                  LimitedRequest limitedRequest,
                                                                  Predicate<? super Page> filter)
        Description copied from interface: ObjectDaoInternal
        Find a list of objects from the same persistent class.
        Specified by:
        findByClassIdsFiltered in interface ObjectDaoInternal<Page>
        Parameters:
        ids - - the ids of the entities to find
        limitedRequest - the pagination request defining the page size to fetch
        filter - a predicate to do in memory filtering of the result set before returning
        Returns:
        a list of objects matching the filters
      • findLatestVersionsCount

        public long findLatestVersionsCount()
        Description copied from interface: VersionedObjectDao
        Returns the number of results for the latest versions of the current persistent class.
        Specified by:
        findLatestVersionsCount in interface VersionedObjectDao<Page>
        Returns:
        a long representing the number of results
      • findPagesWithCurrentOrHistoricalTitleInPermittedSpace

        public List<AbstractPage> findPagesWithCurrentOrHistoricalTitleInPermittedSpace​(SpacePermissionQueryBuilder permissionQueryBuilder,
                                                                                        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:
        findPagesWithCurrentOrHistoricalTitleInPermittedSpace in interface PageDao
        pageTitle - 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: 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:
        findBlogsWithCurrentOrHistoricalTitleInPermittedSpace in interface PageDao
        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
      • findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept

        public List<AbstractPage> findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept​(SpacePermissionQueryBuilder permissionQueryBuilder,
                                                                                                  String blogTitle,
                                                                                                  Space space,
                                                                                                  int maxResultCount)
        Description copied from interface: PageDao
        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.

        Specified by:
        findBlogsWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept in interface PageDao
        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
      • findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept

        public List<AbstractPage> findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept​(SpacePermissionQueryBuilder permissionQueryBuilder,
                                                                                                  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:
        findPagesWithCurrentOrHistoricalTitleInAllPermittedSpacesExcept in interface PageDao
        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
      • getById

        public Page getById​(long id)
        Description copied from interface: ContentEntityObjectDao
        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.
        Specified by:
        getById in interface ContentEntityObjectDao<Page>
        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.
      • getDescendantIds

        public List<Long> getDescendantIds​(Page page)
        Description copied from interface: PageDao
        Finds the ids of all descendant pages of the given page
        Specified by:
        getDescendantIds in interface PageDao
        Returns:
        List of page ids
      • getDescendantIds

        public List<Long> getDescendantIds​(Page page,
                                           ContentStatus... statuses)
        Description copied from interface: PageDao
        Finds the ids of all descendant pages of the given page
        Specified by:
        getDescendantIds in interface PageDao
        Returns:
        List of page ids
      • countPagesInSubtree

        public int countPagesInSubtree​(@NonNull Page page)
        Description copied from interface: PageDao
        Return total descendant page including input page
        Specified by:
        countPagesInSubtree in interface PageDao
        Returns:
        total page
      • getDescendants

        public List<Page> getDescendants​(Page page)
        Description copied from interface: PageDao
        Finds all descendant pages (recursive) of the given page
        Specified by:
        getDescendants in interface PageDao
        Returns:
        List of descendant pages
      • getDescendantTitles

        public List<String> getDescendantTitles​(Page page)
        Description copied from interface: PageDao
        Finds all descendant titles of the given page
        Specified by:
        getDescendantTitles in interface PageDao
        Returns:
        List of descendant titles
      • 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
      • 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
      • 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
      • getAncestorsFor

        public Map<Long,​List<Long>> getAncestorsFor​(Collection<Long> ids)
        Description copied from interface: PageDao
        Get the list page ids of the ancestors of the given page ids.
        Specified by:
        getAncestorsFor in interface PageDao
        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
      • getPagesWithPermissions

        public List<Page> getPagesWithPermissions​(Space space)
        Description copied from interface: PageDao
        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.
        Specified by:
        getPagesWithPermissions in interface PageDao
        Returns:
        a list of all the current pages in a space
      • getPages

        @Deprecated
        public PageResponse<Page> getPages​(Space space,
                                           LimitedRequest pageRequest,
                                           com.google.common.base.Predicate<? super Page> filter)
        Deprecated.
        Description copied from interface: PageDao
        Retrieves a page response of the current content in the given space.
        Specified by:
        getPages in interface PageDao
        Parameters:
        space - the space to locate the page in
        pageRequest - the start and offset of the pages to retrieve
        filter - the predicate to pages the returned results by, may be null
      • getPages

        @Deprecated
        public PageResponse<Page> getPages​(LimitedRequest pageRequest,
                                           com.google.common.base.Predicate<? super Page> filter)
        Deprecated.
        Description copied from interface: PageDao
        Retrieves a page response of all the current pages of the Confluence instance.
        Specified by:
        getPages in interface PageDao
        Parameters:
        pageRequest - the start and offset of the pages to retrieve
        filter - the predicate to filter the returned results by, may be null
        Returns:
        the paginated list of pages
      • getBlogPosts

        @Deprecated
        public PageResponse<BlogPost> getBlogPosts​(Space space,
                                                   LimitedRequest pageRequest,
                                                   @Nullable com.google.common.base.Predicate<? super BlogPost> filter)
        Deprecated.
        Description copied from interface: PageDao
        Retrieves a page response of all the current blog posts in the give space.
        Specified by:
        getBlogPosts in interface PageDao
        Parameters:
        space - the space to locate the blog posts in
        pageRequest - the start and offset of the pages to retrieve
        filter - the predicate to filter the returned results by, may be null
        Returns:
        the paginated list of all the current blog posts by space
      • getChildren

        @Deprecated
        public PageResponse<Page> getChildren​(Page page,
                                              LimitedRequest pageRequest,
                                              com.google.common.base.Predicate<? super Page> predicate,
                                              Depth depth)
        Deprecated.
        Description copied from interface: PageDao
        Returns the children of a page which have a status of CURRENT, limited to the pagination requested.
        Specified by:
        getChildren in interface PageDao
        Parameters:
        page - the page to find children for
        pageRequest - the pagination requested
        predicate - predicate used to entities
        depth - the depth to return children to
        Returns:
        the paginated response of Page entities
      • getDraftChildren

        public PageResponse<Page> getDraftChildren​(Page page,
                                                   LimitedRequest pageRequest,
                                                   Depth depth)
        Description copied from interface: PageDao
        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
        Specified by:
        getDraftChildren in interface PageDao
        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

        public PageResponse<Page> getAllChildren​(Page page,
                                                 LimitedRequest pageRequest,
                                                 Depth depth)
        Description copied from interface: PageDao
        Returns all children of a page (including drafts), limited to the pagination requested.
        Specified by:
        getAllChildren in interface PageDao
        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
      • getMaxSiblingPosition

        public 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
      • getPageIds

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

        @Deprecated
        public PageResponse<AbstractPage> getAbstractPagesByTitle​(String title,
                                                                  LimitedRequest pageRequest,
                                                                  com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        Returns the abstract pages that exactly match the given title, limited to the pagination request. To get just pages or blog posts can be requested just specifying a content type based filter.
        Specified by:
        getAbstractPagesByTitle in interface PageDao
        Parameters:
        title - the title of the page to match
        pageRequest - the pagination requested
        filter - the predicate to apply to the results before returning
        Returns:
        the paginated list of AbstractPages by title
      • getAbstractPagesByCreationDate

        @Deprecated
        public PageResponse<AbstractPage> getAbstractPagesByCreationDate​(org.joda.time.DateTime date,
                                                                         LimitedRequest pageRequest,
                                                                         com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        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.
        Specified by:
        getAbstractPagesByCreationDate in interface PageDao
        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
        public PageResponse<AbstractPage> getAbstractPages​(List<ContentType> contentTypes,
                                                           List<ContentStatus> statuses,
                                                           LimitedRequest pageRequest,
                                                           @Nullable com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        Retrieves a page response of all pages found in this instance of Confluence, within any of the given statuses.
        Specified by:
        getAbstractPages in interface PageDao
        Parameters:
        contentTypes - list of content types to find
        statuses - list of statuses the pages can be in
        pageRequest - the start and offset of the pages to retrieve
        filter - the predicate to filter the returned results by, may be null
        Returns:
        the paginated list of pages
      • getAbstractPages

        @Deprecated
        public PageResponse<AbstractPage> getAbstractPages​(Space space,
                                                           List<ContentType> contentTypes,
                                                           List<ContentStatus> statuses,
                                                           LimitedRequest pageRequest,
                                                           @Nullable com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        Retrieves a page response for all content (pages and/or blog posts) in the given space, within any of the specified statuses and content types.
        Specified by:
        getAbstractPages in interface PageDao
        Parameters:
        space - the space to locate the page in
        contentTypes - list of content types to find
        statuses - list of statuses the pages can be in
        pageRequest - the pagination request
        filter - the predicate to pages the returned results by, may be null
        Returns:
        the paginated list of pages by space, with the given statuses
      • getAbstractPages

        @Deprecated
        public PageResponse<AbstractPage> getAbstractPages​(Space space,
                                                           String title,
                                                           List<ContentStatus> statuses,
                                                           LimitedRequest pageRequest,
                                                           com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        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.
        Specified by:
        getAbstractPages in interface PageDao
        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
        public PageResponse<AbstractPage> getAbstractPages​(String title,
                                                           List<ContentStatus> statuses,
                                                           LimitedRequest pageRequest,
                                                           com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        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.
        Specified by:
        getAbstractPages in interface PageDao
        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
        public PageResponse<AbstractPage> getAbstractPages​(org.joda.time.DateTime date,
                                                           List<ContentStatus> statuses,
                                                           LimitedRequest pageRequest,
                                                           com.google.common.base.Predicate<? super AbstractPage> filter)
        Deprecated.
        Description copied from interface: PageDao
        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.
        Specified by:
        getAbstractPages in interface PageDao
        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
      • getVersionEditContributors

        public Map<Long,​List<ConfluenceUser>> getVersionEditContributors​(Iterable<Page> originalVersions)
        Description copied from interface: ContentEntityObjectDao
        Get version edit contributors for a set of content identifiers. This returns the last modified of all versions of the content.
        Specified by:
        getVersionEditContributors in interface ContentEntityObjectDao<Page>
        Parameters:
        originalVersions - the contents of latest versions, the CURRENT versions
        Returns:
        A map between content if and list of contributor users (null indicates anonymous).
      • getVersionsLastEditedByUser

        public Map<Long,​ContentEntityObject> getVersionsLastEditedByUser​(Collection<Long> contentIds,
                                                                               com.atlassian.sal.api.user.UserKey userKey)
        Description copied from interface: ContentEntityObjectDao
        Gets the ContentEntityObject objects, either the current version or historical version relating to given contentIds of the current version that was the most recent version edited by the given user. Only content with a "current" status are returned.
        Specified by:
        getVersionsLastEditedByUser in interface ContentEntityObjectDao<Page>
        Parameters:
        contentIds - the ids of the content we're interested in. These *must* be ids of the latest version.
        userKey - the userKey of the user that we're interested in
        Returns:
        the ContentEntityObject objects relating to the version of the given contentIds that were last edited by the given user.
      • getContributionStatusByUser

        public Map<Long,​ContributionStatus> getContributionStatusByUser​(Collection<ContentId> contentIds,
                                                                              com.atlassian.sal.api.user.UserKey userKey)
        Description copied from interface: ContentEntityObjectDao
        Identifies the most recent contributions made to a Collection of content by the given user. A contribution can either be a page publish, unpublished changes to a draft or anything that triggers a touch relation.

        It takes a Collection of contentIds and returns a Map of contentIds to ContributionStatuses for the supplied Ids.

        If non existing ContentIds are used, they will not be present in the returned Map. If no contribution status can be found for the supplied contentIds, they will not be present in the returned Map.

        Anonymous users are not supported.

        Specified by:
        getContributionStatusByUser in interface ContentEntityObjectDao<Page>
        Parameters:
        contentIds - the IDs of the content we want to query. These *must* be IDs of the latest version
        userKey - the userKey of the user who's changes we are interested in
        Returns:
        the ContributionStatus of each content
      • refresh

        public void refresh​(com.atlassian.core.bean.EntityObject objectToRefresh)
        Description copied from interface: ObjectDao
        Refreshes the object again with the fresh data from db.
        Specified by:
        refresh in interface ObjectDao
        Specified by:
        refresh in interface ObjectDaoInternal<Page>
      • replicate

        public void replicate​(Object objectToReplicate)
        Description copied from interface: ObjectDao
        Replicate the object. Replication does not generate a new id if the object does not exist in database and it overwrites the database row if the object already exists in database.
        Specified by:
        replicate in interface ObjectDao
        Specified by:
        replicate in interface ObjectDaoInternal<Page>
      • replicateEntity

        public void replicateEntity​(Page objectToReplicate)
        Description copied from interface: ObjectDaoInternal
        Replicate the object. Replication does not generate a new id if the object does not exist in database and it overwrites the database row if the object already exists in database.
        Specified by:
        replicateEntity in interface ObjectDaoInternal<Page>
      • getLastEditedVersionsOf

        public List<Page> getLastEditedVersionsOf​(Page content)
        Description copied from interface: ContentEntityObjectDao
        Retrieves all the last edited versions for each user who has contributed to the specified piece of content. That is, if a user has contributed multiple edits, only the version that corresponds to their latest edit will be added to the list returned. Result will be sorted with the earliest version coming first.
        Specified by:
        getLastEditedVersionsOf in interface ContentEntityObjectDao<Page>
        Parameters:
        content - content (must be the latest version)
        Returns:
        the last edited versions for each user who has contributed to the specified piece of content.
      • findContentBySpaceIdAndStatus

        public List<SpaceContentEntityObject> findContentBySpaceIdAndStatus​(long spaceId,
                                                                            String status,
                                                                            int offset,
                                                                            int count)
        Description copied from interface: ContentEntityObjectDao
        Retrieve content for a given space with a particular status. Results will be sorted by descending date of last modification.
        Specified by:
        findContentBySpaceIdAndStatus in interface ContentEntityObjectDao<Page>
        Parameters:
        spaceId - the id of the space
        status - the status of the content being retrieved (e.g. ContentEntityObject.DELETED
        offset - the offset of the first item to retrieve (0-based)
        count - the maximum number of items to retrieve
        Returns:
        the list of content matching the query
      • findAllLegacyDraftsFor

        public List<Draft> findAllLegacyDraftsFor​(long contentId)
        Description copied from interface: ContentEntityObjectDao
        Retrieves a list of Legacy drafts for the given content if any exist.
        Specified by:
        findAllLegacyDraftsFor in interface ContentEntityObjectDao<Page>
        Parameters:
        contentId - id of the content to retrieve the draft for
        Returns:
        a non-null list of drafts, with 0 or more elements.
        See Also:
        Draft
      • getPageAndBlogPostsVersionsLastEditedByUser

        public PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUser​(com.atlassian.sal.api.user.UserKey userKey,
                                                                                      LimitedRequest request)
        Description copied from interface: ContentEntityObjectDao
        Retrieve a page of entities, either the current version or historical version, that have been modified by the user, in order of the user's most recent modification. Only content with a "current" status are returned.
        Specified by:
        getPageAndBlogPostsVersionsLastEditedByUser in interface ContentEntityObjectDao<Page>
        Parameters:
        userKey - the key for the user for whom to retrieve the modified content
        request - the request
      • getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts

        public PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts​(com.atlassian.sal.api.user.UserKey userKey,
                                                                                                     LimitedRequest request)
        Description copied from interface: ContentEntityObjectDao
        Retrieve a page of entities, either the current version or historical version, that have been modified by the user, in order of the user's most recent modification. Only content with "current" or "draft" status are returned.
        Specified by:
        getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts in interface ContentEntityObjectDao<Page>
        Parameters:
        userKey - the key for the user for whom to retrieve the modified content
        request - the request
      • countAllPages

        public int countAllPages()
        Description copied from interface: PageDao
        Counts the total number of all page entities across all spaces, including non-current pages
        Specified by:
        countAllPages in interface PageDao
        Returns:
        the number of pages
      • getPageStatistics

        public Optional<PageStatisticsDTO> getPageStatistics()
        Description copied from interface: PageDao
        Fetches statistics about pages
        Specified by:
        getPageStatistics in interface PageDao
        Returns:
        a PageStatisticsDTO with information about pages such as total, current, and draft count
      • countCurrentPages

        public int countCurrentPages()
        Description copied from interface: PageDao
        Counts the total number of current pages across all spaces
        Specified by:
        countCurrentPages in interface PageDao
        Returns:
        the number of current pages
      • countDraftPages

        public int countDraftPages()
        Description copied from interface: PageDao
        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).
        Specified by:
        countDraftPages in interface PageDao
        Returns:
        the number of draft pages
      • countPagesWithUnpublishedChanges

        public int countPagesWithUnpublishedChanges()
        Description copied from interface: PageDao
        Counts the number of published pages that have unpublished changes.
        Specified by:
        countPagesWithUnpublishedChanges in interface PageDao
        Returns:
        the number of pages with unpublished changes.
      • getPageCount

        public long getPageCount​(@NonNull String spaceKey)
        Description copied from interface: PageDao
        Get total number of current pages in a space
        Specified by:
        getPageCount in interface PageDao
        Parameters:
        spaceKey - the space to look for pages in
        Returns:
        a count number of pages
      • getPageCount

        public long getPageCount​(@NonNull String spaceKey,
                                 List<ContentStatus> statuses)
        Description copied from interface: PageDao
        Get total number of pages in a space, within any of the given statuses.
        Specified by:
        getPageCount in interface PageDao
        Parameters:
        spaceKey - the space to look for pages in
        statuses - list of statuses the pages can be in
        Returns:
        a count number of pages
      • saveRawWithoutReindex

        public void saveRawWithoutReindex​(com.atlassian.core.bean.EntityObject objectToSave)
        Description copied from interface: ContentEntityObjectDaoInternal

        This is for internal use only, Do not rely on it as a public API.

        Perform a saveRaw but without performing the re-index; it is unnecessary in the context of a migration or upgrade.

        Specified by:
        saveRawWithoutReindex in interface ContentEntityObjectDaoInternal<Page>
      • scanFilteredPages

        public @NonNull PageResponse<Page> scanFilteredPages​(List<ContentStatus> statuses,
                                                             LimitedRequest pageRequest,
                                                             @Nullable Predicate<? super Page> filter)
        Description copied from interface: PageDaoInternal
        Retrieves a page response of all the pages with specified content statuses.
        Specified by:
        scanFilteredPages in interface PageDaoInternal
        Parameters:
        statuses - list of content status which we are interested to fetch
        pageRequest - limit and cursor of the pages to retrieve. Cursor in pageRequest can't be null.
        filter - the predicate to filter the returned results by, may be null
        Returns:
        the paginated list of pages
      • scanFilteredPages

        public @NonNull PageResponse<Page> scanFilteredPages​(Space space,
                                                             List<ContentStatus> statuses,
                                                             LimitedRequest pageRequest,
                                                             @Nullable Predicate<? super Page> filter)
        Description copied from interface: PageDaoInternal
        Retrieves a page response of all pages in space with specified content statuses.
        Specified by:
        scanFilteredPages in interface PageDaoInternal
        Parameters:
        space - the space to locate the page in
        statuses - content status to match
        pageRequest - limit and cursor of the pages to retrieve. Cursor in pageRequest can't be null.
        filter - the predicate to filter the returned results by, may be null
        Returns:
        the paginated list of pages