Interface ContentEntityObjectDao
- All Known Subinterfaces:
ContentEntityObjectDaoInternal
- All Known Implementing Classes:
ContentEntityObjectHibernateDao
@Transactional(readOnly=true)
public interface ContentEntityObjectDao
-
Method Summary
Modifier and TypeMethodDescriptionint
countContentBySpaceIdAndStatus
(long spaceId, String status) Retrieve the count of content for a given space with a particular status.findAllDraftsFor
(long contentId) Retrieves a list of drafts for the given content if any drafts exist.findAllLegacyDraftsFor
(long contentId) Retrieves a list of Legacy drafts for the given content if any exist.findContentBySpaceIdAndStatus
(long spaceId, String status, int offset, int count) Retrieve content for a given space with a particular status.findContentBySpaceIdAndStatus
(long spaceId, String status, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super SpaceContentEntityObject> predicate) Deprecated.since 7.0.1.findDraftFor
(long contentId) Retrieves the draft for the given content if exists.default List<ContentEntityObject>
Retrieves the drafts for the givenUser
, which contains unpublished changesfindHistoricalVersionsAfterVersion
(long originalContentId, int version) findPreviousVersions
(long originalContentId) Retrieves the drafts for the givenUser
.default Set<ConfluenceUser>
Deprecated.since 7.14 usegetAllModifiers(Collection)
getAllModifiers
(Collection<Long> contentIds) Get the Set of allConfluenceUser
that have modified (contributed) content.getById
(long id) Retrieve the object with a particular id from the database.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.getFirstVersionAfter
(long originalVersionContentId, int version) getFirstVersionBefore
(long originalVersionContentId, int version) Retrieves all the last edited versions for each user who has contributed to the specified piece of content.getObjectType
(long id) 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.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.getRecentlyAddedEntities
(String spaceKey, int maxResults) getRecentlyModifiedEntities
(int maxResults) getRecentlyModifiedEntities
(String spaceKey, int maxResults) getRecentlyModifiedForChangeDigest
(Date fromDate) Retrieves a list ofContentEntityObject
s that have been newly added or modified since the date specified.getTrashedContent
(String spaceKey) Deprecated.since 6.10.0 usegetTrashedContents(String, int, int)
default List<ContentEntityObject>
getTrashedContents
(String spaceKey, int offset, int limit) default PageResponse<ContentEntityObject>
getTrashedContents
(String spaceKey, LimitedRequest pageRequest, @Nullable Predicate<? super ContentEntityObject> filter) getVersion
(long originalVersionContentId, int version) getVersionEditContributors
(Iterable<ContentEntityObject> originalVersions) Get version edit contributors for a set of content identifiers.getVersionHistorySummary
(long originalContentId) getVersionHistorySummary
(long originalContentId, LimitedRequest request) Get version history with pagination.getVersionsLastEditedByUser
(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey) Gets theContentEntityObject
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.getVersionsLastEditedByUserNew
(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey) Deprecated.since 6.4.0void
save
(ContentEntityObject contentEntityObject) void
save
(ContentEntityObject entity, ContentEntityObject entityClone)
-
Method Details
-
getById
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
-
getAllCurrentEntities
Iterator<SpaceContentEntityObject> getAllCurrentEntities() -
getRecentlyAddedEntities
-
getRecentlyModifiedEntities
-
getRecentlyModifiedEntities
-
getRecentlyModifiedForChangeDigest
Retrieves a list ofContentEntityObject
s 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
ContentEntityObject
s that have been newly added or modified since the date specified
-
getRecentlyModifiedEntitiesForUser
-
getTrashedContent
Deprecated.since 6.10.0 usegetTrashedContents(String, int, int)
-
getTrashedContents
- Since:
- 6.10.0
-
getTrashedContents
default PageResponse<ContentEntityObject> getTrashedContents(String spaceKey, LimitedRequest pageRequest, @Nullable Predicate<? super ContentEntityObject> filter) - Since:
- 8.0
-
getObjectType
-
getFirstVersionBefore
-
getFirstVersionAfter
-
getVersion
-
getVersionHistorySummary
-
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 versionrequest
- 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.since 7.14 usegetAllModifiers(Collection)
Get the Set of allConfluenceUser
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
Get the Set of allConfluenceUser
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 aSet
ofConfluenceUser
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 theContentEntityObject
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.0Same asgetVersionsLastEditedByUser(Collection, UserKey)
, but a refined implementation for new Recently Worked On Drafts work. TODO: replacegetVersionsLastEditedByUser(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 versionuserKey
- 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 contentrequest
- 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 contentrequest
- the request- Since:
- 6.4.0
-
findPreviousVersions
-
findHistoricalVersionsAfterVersion
-
getLastEditedVersionsOf
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 spacestatus
- 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) Deprecated.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 spacestatus
- the status of the content being retrieved (e.g.ContentEntityObject.DELETED
limitedRequest
- - the start and offset of the pages to retrievepredicate
- - a predicate to filter the returned results by- Returns:
- a PageResponse of ContentEntityObjects in the space with the given status
-
countContentBySpaceIdAndStatus
Retrieve the count of content for a given space with a particular status.- Parameters:
spaceId
- the id of the spacestatus
- the status of the content being retrieved (e.g.ContentEntityObject.DELETED
- Returns:
- the number of content objects with that status in that space
-
findAllDraftsFor
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
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
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
Retrieves the drafts for the givenUser
. 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 theContentEntityObject.DRAFT
status
-
findDraftsWithUnpublishedChangesForUser
Retrieves the drafts for the givenUser
, which contains unpublished changes- Parameters:
creator
- the owner of the drafts- Returns:
- a list of drafts (
ContentEntityObject
objects) - Since:
- 7.5.0
-
save
- Since:
- 9.0
-
save
- Since:
- 9.0
-