Interface ContentEntityManager
-
- All Known Subinterfaces:
CommentManager
,CommentManagerInternal
,ContentEntityManagerInternal
,CustomContentManager
,PageManager
,PageManagerInternal
,SpaceDescriptionManager
- All Known Implementing Classes:
DefaultCommentManager
,DefaultContentEntityManager
,DefaultCustomContentManager
,DefaultPageManager
,DefaultPersonalInformationManager
,DefaultSpaceDescriptionManager
@ParametersAreNonnullByDefault public interface ContentEntityManager
-
-
Field Summary
Fields Modifier and Type Field Description static int
ITERATE_ALL
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description @Nullable ContentEntityObject
getById(long id)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicableMap<Long,ContributionStatus>
getContributionStatusByUser(@NonNull Collection<ContentId> contentIds, @Nullable com.atlassian.sal.api.user.UserKey userKey)
Identifies the most recent contributions made to a set of content by the given user.@Nullable ContentEntityObject
getNextVersion(ContentEntityObject ceo)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicable@Nullable ContentEntityObject
getOtherVersion(ContentEntityObject ceo, int version)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicable@NonNull PageResponse<AbstractPage>
getPageAndBlogPostsVersionsLastEditedByUser(@Nullable com.atlassian.sal.api.user.UserKey userKey, LimitedRequest request)
Retrieve a page of entities that have been modified by the user, in order of the user's most recent modification.@NonNull PageResponse<AbstractPage>
getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts(@Nullable com.atlassian.sal.api.user.UserKey userKey, LimitedRequest request)
Retrieve a page of entities that have been modified by the user, in order of the user's most recent modification.@Nullable ContentEntityObject
getPreviousVersion(ContentEntityObject ceo)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicable@NonNull Iterator
getRecentlyAddedEntities(@Nullable String spaceKey, int maxResults)
Retrieve an iterator of recently added entities, in order of most recent to last.@NonNull Iterator
getRecentlyModifiedEntities(String spaceKey, int maxResults)
Retrieve an iterator of recently modified entities, in order of most recent to last.@NonNull Iterator
getRecentlyModifiedEntitiesForUser(String username)
Retrieve an iterator of recently modified entities, in order of most recent to last.@NonNull List
getRecentlyModifiedForChangeDigest(Date fromDate)
Retrieves a list ofContentEntityObject
s that have been newly added or modified since the date specified.@NonNull List<VersionHistorySummary>
getVersionHistorySummaries(ContentEntityObject ceo)
Get a VersionHistorySummary for all previous versions of a ContentEntityObject, starting with the current content.@NonNull Map<Long,ContentEntityObject>
getVersionsLastEditedByUser(@NonNull Collection<ContentId> contentIds, @Nullable com.atlassian.sal.api.user.UserKey userKey)
Gets theContentEntityObject
objects relating to the version of the given contentIds that were last edited by the given user.void
refreshContentEntity(ContentEntityObject obj)
Refreshes the specified entity (including content) in the Hibernate session to ensure that subsequent retrievals are up-to-date.void
removeContentEntity(ContentEntityObject obj)
Removes given content entity object and all associated domain objects i.e.void
removeHistoricalVersion(ContentEntityObject historicalVersion)
Removes a historical ContentEntityObject.void
revertContentEntityBackToVersion(ContentEntityObject obj, int version, @Nullable String revertComment, boolean revertTitle)
Reverts aContentEntityObject
back to its state at the version specified byversion
.void
saveContentEntity(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)
In order to create a history for this object, we need to pass in the modified as well as the original version of the object.void
saveContentEntity(ContentEntityObject obj, @Nullable SaveContext saveContext)
<T extends ContentEntityObject>
voidsaveNewVersion(T current, Modification<T> modification)
Applies the state changes supplied by modification and persists those changes to a new version.<T extends ContentEntityObject>
voidsaveNewVersion(T current, Modification<T> modification, @Nullable SaveContext saveContext)
Applies the state changes supplied by modification and persists those changes to a new version.
-
-
-
Field Detail
-
ITERATE_ALL
static final int ITERATE_ALL
- See Also:
- Constant Field Values
-
-
Method Detail
-
refreshContentEntity
void refreshContentEntity(ContentEntityObject obj)
Refreshes the specified entity (including content) in the Hibernate session to ensure that subsequent retrievals are up-to-date.- Parameters:
obj
- the object to be refreshed in the Hibernate session.
-
saveContentEntity
void saveContentEntity(ContentEntityObject obj, @Nullable SaveContext saveContext)
- Parameters:
obj
- - theContentEntityObject
to savesaveContext
- - aSaveContext
holding additional parameters for the manager to use when saving.
-
saveContentEntity
void saveContentEntity(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)
In order to create a history for this object, we need to pass in the modified as well as the original version of the object.- Parameters:
saveContext
- - aSaveContext
holding additional parameters for the manager to use when saving.
-
saveNewVersion
<T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification)
Applies the state changes supplied by modification and persists those changes to a new version.manager.<Page>saveNewVersion(page, new Modification<Page>() { public void modify(Page page) { page.setTitle("foobar"); } });
- Type Parameters:
T
- the type content. This ensures that the type of current is the same as the type passed to the modification- Parameters:
current
- the current / latest versionmodification
- an implementation ofModification
which describes the state changes you require
-
saveNewVersion
<T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification, @Nullable SaveContext saveContext)
Applies the state changes supplied by modification and persists those changes to a new version.manager.<Page>saveNewVersion(page, new Modification<Page>() { public void modify(Page page) { page.setTitle("foobar"); } }, new DefaultSaveContext());
- Type Parameters:
T
- the type content. This ensures that the type of current is the same as the type passed to the modification- Parameters:
current
- the current / latest versionmodification
- an implementation ofModification
which describes the state changes you requiresaveContext
- the save context (null if you have no specific requirements - or just usesaveNewVersion(ContentEntityObject, Modification)
).
-
removeContentEntity
void removeContentEntity(ContentEntityObject obj)
Removes given content entity object and all associated domain objects i.e. if we remove a page it removes all its labels and attachments
-
revertContentEntityBackToVersion
void revertContentEntityBackToVersion(ContentEntityObject obj, int version, @Nullable String revertComment, boolean revertTitle)
Reverts a
ContentEntityObject
back to its state at the version specified byversion
. Creates a new latest version that resembles the previous state.Since Confluence 4.0 most ContentEntityObjects are assumed to be XHTML formatted. So in reverting a ContentEntityObject which actually has a WIKI
BodyType
this will be migrated on the fly to XHTML.- Parameters:
obj
- The ContentEntityObject to revertversion
- The version to revert torevertComment
- A comment to be associated with the revertrevertTitle
- If true, the ContentEntityObject title will be reverted to the old state
-
getRecentlyAddedEntities
@NonNull Iterator getRecentlyAddedEntities(@Nullable String spaceKey, int maxResults)
Retrieve an iterator of recently added entities, in order of most recent to last. The iterator is lazy-loading, so you can filter the output and return the first 'n' that interest you.For performance reasons, it's a VERY bad idea to supply both a space key, and infinite results.
If you supply a space key, this WILL NOT RETURN ANY COMMENTS. There is currently no way around this, you have to retrieve comments separately and splice the results together. Sorry.
- Parameters:
spaceKey
- the space key to look up the entities for. If spaceKey is null, there is assumed to be no space, and things like user info and space descriptions will also be returned.maxResults
- the maximum number of entities to return in the iterator. Any number zero or less (Use the ITERATE_ALL constant) will cause the iterator to go over every entity.
-
getRecentlyModifiedEntities
@NonNull Iterator getRecentlyModifiedEntities(String spaceKey, int maxResults)
Retrieve an iterator of recently modified entities, in order of most recent to last. The iterator is lazy-loading, so you can filter the output and return the first 'n' that interest you.For performance reasons, it's a VERY bad idea to supply both a space key, and infinite results.
- Parameters:
spaceKey
- the space key to look up the entities for.maxResults
- the maximum number of entities to return in the iterator. Any number zero or less (Use the ITERATE_ALL constant) will cause the iterator to go over every entity.
-
getRecentlyModifiedForChangeDigest
@NonNull List 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
@NonNull Iterator getRecentlyModifiedEntitiesForUser(String username)
Retrieve an iterator of recently modified entities, in order of most recent to last. The iterator is lazy-loading, so you can filter the output and return the first 'n' that interest you.- Parameters:
username
- the user for which to retrieve the modified content
-
getPageAndBlogPostsVersionsLastEditedByUser
@NonNull PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUser(@Nullable com.atlassian.sal.api.user.UserKey userKey, LimitedRequest request)
Retrieve a page of entities 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
@NonNull PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUserIncludingDrafts(@Nullable com.atlassian.sal.api.user.UserKey userKey, LimitedRequest request)
Retrieve a page of entities 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
-
getById
@Deprecated @Nullable ContentEntityObject getById(long id)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicable- Parameters:
id
-- Returns:
- the object with the corresponding id or null if the object with that id does not exist
-
getPreviousVersion
@Deprecated @Nullable ContentEntityObject getPreviousVersion(ContentEntityObject ceo)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicableGet the previous version of the entity in the sequence ofVersioned
.Returns null for
ContentEntityObject.DRAFT
s.
-
getNextVersion
@Deprecated @Nullable ContentEntityObject getNextVersion(ContentEntityObject ceo)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicableGet the next version of the entity in the sequence ofVersioned
.Returns null for
ContentEntityObject.DRAFT
s.
-
getOtherVersion
@Deprecated @Nullable ContentEntityObject getOtherVersion(ContentEntityObject ceo, int version)
Deprecated.since 7.5.0, useContentService.find(Expansion...)
for plugins, or useContentEntityManagerInternal
in core where applicable
-
getVersionHistorySummaries
@NonNull List<VersionHistorySummary> getVersionHistorySummaries(ContentEntityObject ceo)
Get a VersionHistorySummary for all previous versions of a ContentEntityObject, starting with the current content.- Parameters:
ceo
- the entity object to return the version history of- Returns:
- the full version history of that object, as VersionHistorySummary objects.
-
getVersionsLastEditedByUser
@NonNull Map<Long,ContentEntityObject> getVersionsLastEditedByUser(@NonNull Collection<ContentId> contentIds, @Nullable com.atlassian.sal.api.user.UserKey userKey)
Gets theContentEntityObject
objects relating to the version of the given contentIds that were last 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(@NonNull Collection<ContentId> contentIds, @Nullable com.atlassian.sal.api.user.UserKey userKey)
Identifies the most recent contributions made to a set of content by the given user. A contribution can either be a page publish, or a set of unpublished changes which have been saved to a draft. Does not return aContributionStatus
for a content ID if the user has never contributed to the content.- 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 - Since:
- 6.4.0
-
removeHistoricalVersion
void removeHistoricalVersion(ContentEntityObject historicalVersion)
Removes a historical ContentEntityObject.- Parameters:
historicalVersion
- a historical entity object to remove
-
-