Interface ContentEntityObjectDao

All Known Subinterfaces:
ContentEntityObjectDaoInternal
All Known Implementing Classes:
ContentEntityObjectHibernateDao

@Transactional(readOnly=true) public interface ContentEntityObjectDao
  • Method Details

    • getById

      ContentEntityObject 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.
    • getContentAuthoredByUser

      List<ContentEntityObject> getContentAuthoredByUser(ConfluenceUser user)
    • getAllCurrentEntities

      Iterator<SpaceContentEntityObject> getAllCurrentEntities()
    • getRecentlyAddedEntities

      Iterator<ContentEntityObject> getRecentlyAddedEntities(String spaceKey, int maxResults)
    • getRecentlyModifiedEntities

      Iterator<ContentEntityObject> getRecentlyModifiedEntities(int maxResults)
    • getRecentlyModifiedEntities

      Iterator<SpaceContentEntityObject> getRecentlyModifiedEntities(String spaceKey, int maxResults)
    • 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
    • getRecentlyModifiedEntitiesForUser

      Iterator<ContentEntityObject> getRecentlyModifiedEntitiesForUser(ConfluenceUser user)
    • getTrashedContent

      @Deprecated List<ContentEntityObject> getTrashedContent(String spaceKey)
      Deprecated.
    • getTrashedContents

      default List<ContentEntityObject> getTrashedContents(String spaceKey, int offset, int limit)
      Since:
      6.10.0
    • getTrashedContents

      default PageResponse<ContentEntityObject> getTrashedContents(String spaceKey, LimitedRequest pageRequest, @Nullable Predicate<? super ContentEntityObject> filter)
      Since:
      8.0
    • getObjectType

      String getObjectType(long id)
    • getFirstVersionBefore

      ContentEntityObject getFirstVersionBefore(long originalVersionContentId, int version)
    • getFirstVersionAfter

      ContentEntityObject getFirstVersionAfter(long originalVersionContentId, int version)
    • getVersion

      ContentEntityObject getVersion(long originalVersionContentId, int version)
    • getVersionHistorySummary

      List<VersionHistorySummary> getVersionHistorySummary(long originalContentId)
    • 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<ContentEntityObject> 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(ContentEntityObject 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
    • getVersionsLastEditedByUserNew

      @Deprecated Map<Long,ContentEntityObject> getVersionsLastEditedByUserNew(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey)
      Deprecated.
      since 6.4.0
      Same as getVersionsLastEditedByUser(Collection, UserKey), but a refined implementation for new Recently Worked On Drafts work. TODO: replace getVersionsLastEditedByUser(Collection, UserKey) with the implementation of this method
      Since:
      6.4.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
    • findPreviousVersions

      List<ContentEntityObject> findPreviousVersions(long originalContentId)
    • findHistoricalVersionsAfterVersion

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

      List<ContentEntityObject> getLastEditedVersionsOf(ContentEntityObject 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
    • findContentBySpaceIdAndStatus

      @Deprecated PageResponse<SpaceContentEntityObject> findContentBySpaceIdAndStatus(long spaceId, String status, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super SpaceContentEntityObject> predicate)
      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
      limitedRequest - - the start and offset of the pages to retrieve
      predicate - - a predicate to filter the returned results by
      Returns:
      a PageResponse of ContentEntityObjects in the space with the given status
    • 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
    • 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:
    • 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:
    • 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:
    • findUnpublishedContentWithUserContributions

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

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

      void save(ContentEntityObject entity, ContentEntityObject entityClone)
      Since:
      9.0
    • save

      void save(ContentEntityObject contentEntityObject)
      Since:
      9.0