Interface ContentEntityObjectDao<T extends ContentEntityObject>

    • Method Detail

      • getById

        T getById​(long id)
        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.
        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.
      • getRecentlyModifiedForChangeDigest

        List<ContentEntityObject> getRecentlyModifiedForChangeDigest​(Date fromDate)
        Retrieves a list of ContentEntityObjects that have been newly added or modified since the date specified. This list excludes drafts, space descriptions and mail.
        Parameters:
        fromDate - content modified after this date will be returned
        Returns:
        a list of ContentEntityObjects that have been newly added or modified since the date specified
      • getObjectType

        String getObjectType​(long id)
      • getFirstVersionBefore

        ContentEntityObject getFirstVersionBefore​(long originalVersionContentId,
                                                  int version)
      • getFirstVersionAfter

        ContentEntityObject getFirstVersionAfter​(long originalVersionContentId,
                                                 int version)
      • getVersionHistorySummary

        PageResponse<VersionHistorySummary> getVersionHistorySummary​(long originalContentId,
                                                                     LimitedRequest request)
        Get version history with pagination. So we don't have issue with super long history.
        Parameters:
        originalContentId - the content Id of latest version, the CURRENT version
        request - page request contains start, limit fields for pagination purpose.
        Returns:
        PageResponse of version history.
      • getVersionEditContributors

        Map<Long,​List<ConfluenceUser>> getVersionEditContributors​(Iterable<T> originalVersions)
        Get version edit contributors for a set of content identifiers. This returns the last modified of all versions of the content.
        Parameters:
        originalVersions - the contents of latest versions, the CURRENT versions
        Returns:
        A map between content if and list of contributor users (null indicates anonymous).
      • getAllModifiers

        @Deprecated
        default Set<ConfluenceUser> getAllModifiers​(T ceo)
        Deprecated.
        Get the Set of all ConfluenceUser that have modified (contributed) a content. This includes users for existing and deleted historical versions.
        Parameters:
        ceo - the content for which contributions have been made
        Returns:
        a Set of ConfluenceUser that have contributed to the content
        Since:
        7.12
      • getAllModifiers

        Map<Long,​Set<ConfluenceUser>> getAllModifiers​(Collection<Long> contentIds)
        Get the Set of all ConfluenceUser that have modified (contributed) content. This includes users for existing and deleted historical versions.
        Parameters:
        contentIds - the content IDs of interest
        Returns:
        a Map of content IDs to a Set of ConfluenceUser that have contributed to the content
        Since:
        7.14
      • getVersionsLastEditedByUser

        Map<Long,​ContentEntityObject> getVersionsLastEditedByUser​(Collection<Long> contentIds,
                                                                        com.atlassian.sal.api.user.UserKey userKey)
        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.
        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.
        Since:
        5.9.0
      • getContributionStatusByUser

        Map<Long,​ContributionStatus> getContributionStatusByUser​(Collection<ContentId> contentIds,
                                                                       com.atlassian.sal.api.user.UserKey userKey)
        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.

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

        PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUser​(@Nullable com.atlassian.sal.api.user.UserKey userKey,
                                                                               LimitedRequest request)
        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.
        Parameters:
        userKey - the key for the user for whom to retrieve the modified content
        request - the request
        Since:
        5.9.1
      • getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts

        PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts​(@Nullable com.atlassian.sal.api.user.UserKey userKey,
                                                                                              LimitedRequest request)
        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.
        Parameters:
        userKey - the key for the user for whom to retrieve the modified content
        request - the request
        Since:
        6.4.0
      • findHistoricalVersionsAfterVersion

        List<ContentEntityObject> findHistoricalVersionsAfterVersion​(long originalContentId,
                                                                     int version)
      • getLastEditedVersionsOf

        List<T> getLastEditedVersionsOf​(T content)
        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.
        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.
        Throws:
        IllegalArgumentException - if the content is not the latest version or null
      • findContentBySpaceIdAndStatus

        List<SpaceContentEntityObject> findContentBySpaceIdAndStatus​(long spaceId,
                                                                     String status,
                                                                     int offset,
                                                                     int count)
        Retrieve content for a given space with a particular status. Results will be sorted by descending date of last modification.
        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
      • countContentBySpaceIdAndStatus

        int countContentBySpaceIdAndStatus​(long spaceId,
                                           String status)
        Retrieve the count of content for a given space with a particular status.
        Parameters:
        spaceId - the id of the space
        status - the status of the content being retrieved (e.g. ContentEntityObject.DELETED
        Returns:
        the number of content objects with that status in that space
      • getOldestPageCreationDate

        Date getOldestPageCreationDate()
        Gets the creation date of the oldest page.
        Returns:
        creation date of the oldest page in Confluence
      • findAllDraftsFor

        List<ContentEntityObject> findAllDraftsFor​(long contentId)
        Retrieves a list of drafts for the given content if any drafts exist.
        Parameters:
        contentId - id of the content to retrieve the draft for
        Returns:
        a non-null list of drafts, with 0 or more elements.
        Since:
        6.0.6
        See Also:
        ContentEntityObject.DRAFT
      • findAllLegacyDraftsFor

        default List<Draft> findAllLegacyDraftsFor​(long contentId)
        Retrieves a list of Legacy drafts for the given content if any exist.
        Parameters:
        contentId - id of the content to retrieve the draft for
        Returns:
        a non-null list of drafts, with 0 or more elements.
        Since:
        6.15.3
        See Also:
        Draft
      • findDraftFor

        ContentEntityObject findDraftFor​(long contentId)
        Retrieves the draft for the given content if exists.
        Parameters:
        contentId - id of the content to retrieve the draft for
        Returns:
        the draft for the given content if exists, null otherwise
        See Also:
        ContentEntityObject.DRAFT
      • findUnpublishedContentWithUserContributions

        List<ContentEntityObject> findUnpublishedContentWithUserContributions​(String username)
        Retrieves the drafts for the given User. IMPORTANT: this method doesn't return published shared drafts, only personal drafts and unpublished shared drafts
        Parameters:
        username - the owner of the drafts
        Returns:
        a list of ContentEntityObject with the ContentEntityObject.DRAFT status
      • findDraftsWithUnpublishedChangesForUser

        default List<ContentEntityObject> findDraftsWithUnpublishedChangesForUser​(String creatorName)
        Retrieves the drafts for the given User, which contains unpublished changes
        Parameters:
        creatorName - the owner of the drafts
        Returns:
        a list of drafts (ContentEntityObject objects)
        Since:
        7.5.0