@ParametersAreNonnullByDefault public interface ContentEntityManager
Modifier and Type | Field and Description |
---|---|
static int |
ITERATE_ALL |
Modifier and Type | Method and Description |
---|---|
ContentEntityObject |
getById(long id) |
ContentEntityObject |
getNextVersion(ContentEntityObject ceo)
Get the next version of the entity in the sequence of
Versioned . |
ContentEntityObject |
getOtherVersion(ContentEntityObject ceo,
int version) |
PageResponse<AbstractPage> |
getPageAndBlogPostsVersionsLastEditedByUser(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.
|
ContentEntityObject |
getPreviousVersion(ContentEntityObject ceo)
Get the previous version of the entity in the sequence of
Versioned . |
Iterator |
getRecentlyAddedEntities(String spaceKey,
int maxResults)
Retrieve an iterator of recently added entities, in order of most recent to last.
|
Iterator |
getRecentlyModifiedEntities(String spaceKey,
int maxResults)
Retrieve an iterator of recently modified entities, in order of most recent to last.
|
Iterator |
getRecentlyModifiedEntitiesForUser(String username)
Retrieve an iterator of recently modified entities, in order of most recent to last.
|
List |
getRecentlyModifiedForChangeDigest(Date fromDate)
Retrieves a list of
ContentEntityObject s that have been newly added or modified
since the date specified. |
List<VersionHistorySummary> |
getVersionHistorySummaries(ContentEntityObject ceo)
Get a VersionHistorySummary for all previous versions of a ContentEntityObject, starting with the current
content.
|
Map<Long,ContentEntityObject> |
getVersionsLastEditedByUser(Collection<ContentId> contentIds,
com.atlassian.sal.api.user.UserKey userKey)
Gets the
ContentEntityObject 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,
String revertComment,
boolean revertTitle)
Reverts a
ContentEntityObject back to its state at the version specified by version . |
void |
saveContentEntity(ContentEntityObject obj,
ContentEntityObject origObj,
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,
SaveContext saveContext) |
<T extends ContentEntityObject> |
saveNewVersion(T current,
Modification<T> modification)
Applies the state changes supplied by modification and persists those changes to a new version.
|
<T extends ContentEntityObject> |
saveNewVersion(T current,
Modification<T> modification,
SaveContext saveContext)
Applies the state changes supplied by modification and persists those changes to a new version.
|
void |
updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
String newTitle)
Deprecated.
since 4.0.
|
void |
updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey)
Deprecated.
since 4.0
|
void |
updateSingleContentLinkinTo(ContentEntityObject referringContent,
SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
String newTitle)
Deprecated.
since 4.0
|
void |
updateSingleContentLinkinTo(ContentEntityObject referringContent,
SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
String newTitle,
SaveContext saveContext)
Deprecated.
since 4.0
|
static final int ITERATE_ALL
void refreshContentEntity(ContentEntityObject obj)
obj
- the object to be refreshed in the Hibernate session.void saveContentEntity(ContentEntityObject obj, @Nullable SaveContext saveContext)
obj
- - the ContentEntityObject
to savesaveContext
- - a SaveContext
holding additional parameters for the manager to use when saving.void saveContentEntity(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)
saveContext
- - a SaveContext
holding additional parameters for the manager to use when saving.<T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification)
manager.<Page>saveNewVersion(page, new Modification<Page>() { public void modify(Page page) { page.setTitle("foobar"); } });
T
- the type content. This ensures that the type of current is the same as the type passed to the modificationcurrent
- the current / latest versionmodification
- an implementation of Modification
which describes the state changes you require<T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification, @Nullable SaveContext saveContext)
manager.<Page>saveNewVersion(page, new Modification<Page>() { public void modify(Page page) { page.setTitle("foobar"); } }, new DefaultSaveContext());
T
- the type content. This ensures that the type of current is the same as the type passed to the modificationcurrent
- the current / latest versionmodification
- an implementation of Modification
which describes the state changes you requiresaveContext
- the save context (null if you have no specific requirements - or just use saveNewVersion(ContentEntityObject, Modification)
).void removeContentEntity(ContentEntityObject obj)
void revertContentEntityBackToVersion(ContentEntityObject obj, int version, @Nullable String revertComment, boolean revertTitle)
Reverts a ContentEntityObject
back to its state at the version specified by version
.
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.
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@Nonnull Iterator getRecentlyAddedEntities(@Nullable String spaceKey, int maxResults)
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.
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.@Nonnull Iterator getRecentlyModifiedEntities(String spaceKey, int maxResults)
For performance reasons, it's a VERY bad idea to supply both a space key, and infinite results.
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.@Nonnull List getRecentlyModifiedForChangeDigest(Date fromDate)
ContentEntityObject
s that have been newly added or modified
since the date specified. This list excludes drafts, space descriptions and mail.fromDate
- content modified after this date will be returnedContentEntityObject
s that have been newly added or modified
since the date specified@Nonnull Iterator getRecentlyModifiedEntitiesForUser(String username)
username
- the user for which to retrieve the modified content@Nonnull PageResponse<AbstractPage> getPageAndBlogPostsVersionsLastEditedByUser(@Nullable com.atlassian.sal.api.user.UserKey userKey, LimitedRequest request)
userKey
- the key for the user for whom to retrieve the modified contentrequest
- the request@Nullable ContentEntityObject getById(long id)
id
- @Deprecated void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
@Deprecated void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey)
@Deprecated void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
@Deprecated void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, @Nullable SaveContext saveContext)
referringContent
- contentBeingRefactored
- newSpaceKey
- newTitle
- saveContext
- @Nullable ContentEntityObject getPreviousVersion(ContentEntityObject ceo)
Versioned
.
Returns null for ContentEntityObject.DRAFT
s.
@Nullable ContentEntityObject getNextVersion(ContentEntityObject ceo)
Versioned
.
Returns null for ContentEntityObject.DRAFT
s.
@Nullable ContentEntityObject getOtherVersion(ContentEntityObject ceo, int version)
@Nonnull List<VersionHistorySummary> getVersionHistorySummaries(ContentEntityObject ceo)
ceo
- the entity object to return the version history of@Nonnull Map<Long,ContentEntityObject> getVersionsLastEditedByUser(Collection<ContentId> contentIds, com.atlassian.sal.api.user.UserKey userKey)
ContentEntityObject
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.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 inContentEntityObject
objects relating to the version of the given contentIds that were last
edited by the given user.void removeHistoricalVersion(ContentEntityObject historicalVersion)
historicalVersion
- a historical entity object to removeCopyright © 2003–2017 Atlassian. All rights reserved.