Interface ContentEntityObjectDao<T extends ContentEntityObject>
-
- All Superinterfaces:
ObjectDao
,VersionedObjectDao<T>
- All Known Subinterfaces:
ContentDao
,ContentDaoInternal
,ContentEntityObjectDaoInternal<T>
,CustomContentDao
,PageDao
,PageDaoInternal
- All Known Implementing Classes:
AbstractContentEntityObjectHibernateDao
,ContentEntityObjectHibernateDao
,DefaultContentDao
,DelegatingPageDao
,HibernatePageDao
,PluginContentHibernateDao
,ReadThroughCachingPageDao
@Transactional(readOnly=true) public interface ContentEntityObjectDao<T extends ContentEntityObject> extends VersionedObjectDao<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description int
countContentBySpaceIdAndStatus(long spaceId, String status)
Retrieve the count of content for a given space with a particular status.List<ContentEntityObject>
findAllDraftsFor(long contentId)
Retrieves a list of drafts for the given content if any drafts exist.default List<Draft>
findAllLegacyDraftsFor(long contentId)
Retrieves a list of Legacy drafts for the given content if any exist.List<SpaceContentEntityObject>
findContentBySpaceIdAndStatus(long spaceId, String status, int offset, int count)
Retrieve content for a given space with a particular status.PageResponse<SpaceContentEntityObject>
findContentBySpaceIdAndStatus(long spaceId, String status, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super SpaceContentEntityObject> predicate)
Deprecated.since 7.0.1.ContentEntityObject
findDraftFor(long contentId)
Retrieves the draft for the given content if exists.default List<ContentEntityObject>
findDraftsWithUnpublishedChangesForUser(String creatorName)
Retrieves the drafts for the givenUser
, which contains unpublished changesList<ContentEntityObject>
findHistoricalVersionsAfterVersion(long originalContentId, int version)
List<ContentEntityObject>
findPreviousVersions(long originalContentId)
List<ContentEntityObject>
findUnpublishedContentWithUserContributions(String username)
Retrieves the drafts for the givenUser
.Iterator<SpaceContentEntityObject>
getAllCurrentEntities()
Map<Long,Set<ConfluenceUser>>
getAllModifiers(Collection<Long> contentIds)
Get the Set of allConfluenceUser
that have modified (contributed) content.default Set<ConfluenceUser>
getAllModifiers(T ceo)
Deprecated.since 7.14 usegetAllModifiers(Collection)
T
getById(long id)
Retrieve the object with a particular id from the database.List<ContentEntityObject>
getContentAuthoredByUser(String username)
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.ContentEntityObject
getFirstVersionAfter(long originalVersionContentId, int version)
ContentEntityObject
getFirstVersionBefore(long originalVersionContentId, int version)
List<T>
getLastEditedVersionsOf(T content)
Retrieves all the last edited versions for each user who has contributed to the specified piece of content.String
getObjectType(long id)
Date
getOldestPageCreationDate()
Gets the creation date of the oldest page.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.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.Iterator<ContentEntityObject>
getRecentlyAddedEntities(String spaceKey, int maxResults)
Iterator<ContentEntityObject>
getRecentlyModifiedEntities(int maxResults)
Iterator<SpaceContentEntityObject>
getRecentlyModifiedEntities(String spaceKey, int maxResults)
Iterator<ContentEntityObject>
getRecentlyModifiedEntitiesForUser(String username)
List<ContentEntityObject>
getRecentlyModifiedForChangeDigest(Date fromDate)
Retrieves a list ofContentEntityObject
s that have been newly added or modified since the date specified.List<ContentEntityObject>
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)
ContentEntityObject
getVersion(long originalVersionContentId, int version)
Map<Long,List<ConfluenceUser>>
getVersionEditContributors(Iterable<T> originalVersions)
Get version edit contributors for a set of content identifiers.List<VersionHistorySummary>
getVersionHistorySummary(long originalContentId)
PageResponse<VersionHistorySummary>
getVersionHistorySummary(long originalContentId, LimitedRequest request)
Get version history with pagination.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.Map<Long,ContentEntityObject>
getVersionsLastEditedByUserNew(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey)
Deprecated.since 6.4.0-
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, findByClassIds, getPersistentClass, refresh, remove, replicate, save, saveRaw
-
Methods inherited from interface com.atlassian.confluence.core.persistence.VersionedObjectDao
findLatestVersionsCount, findLatestVersionsIterator, save
-
-
-
-
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.
-
getContentAuthoredByUser
List<ContentEntityObject> getContentAuthoredByUser(String username)
-
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 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
Iterator<ContentEntityObject> getRecentlyModifiedEntitiesForUser(String username)
-
getTrashedContent
@Deprecated List<ContentEntityObject> getTrashedContent(String spaceKey)
Deprecated.since 6.10.0 usegetTrashedContents(String, int, int)
-
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 versionrequest
- 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.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
Map<Long,Set<ConfluenceUser>> getAllModifiers(Collection<Long> contentIds)
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
List<ContentEntityObject> findPreviousVersions(long originalContentId)
-
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 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
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 spacestatus
- 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 givenUser
. 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 theContentEntityObject.DRAFT
status
-
findDraftsWithUnpublishedChangesForUser
default List<ContentEntityObject> findDraftsWithUnpublishedChangesForUser(String creatorName)
Retrieves the drafts for the givenUser
, which contains unpublished changes- Parameters:
creatorName
- the owner of the drafts- Returns:
- a list of drafts (
ContentEntityObject
objects) - Since:
- 7.5.0
-
-