@ParametersAreNonnullByDefault public class DefaultContentEntityManager extends Object implements ContentEntityManagerInternal
ITERATE_ALL| Constructor and Description |
|---|
DefaultContentEntityManager(ContentEntityObjectDao contentEntityObjectDao,
LinkManager linkManager,
ConfluenceIndexer indexer,
LabelManager labelManager,
AttachmentManager attachmentManager,
HibernateSessionManager hibernateSessionManager,
com.google.common.base.Supplier<XhtmlContent> xhtmlContent,
com.atlassian.event.api.EventPublisher eventPublisher,
NotificationManager notificationManager) |
| Modifier and Type | Method and Description |
|---|---|
protected AttachmentManager |
getAttachmentManager() |
protected BodyContent |
getBodyContentForRevert(ContentEntityObject historicalVersion) |
ContentEntityObject |
getById(ContentId id) |
ContentEntityObject |
getById(ContentId id,
int version) |
ContentEntityObject |
getById(long id) |
PageResponse<ContentEntityObject> |
getByIds(List<ContentId> contentIds,
LimitedRequest limitedRequest,
com.google.common.base.Predicate<? super AbstractLabelableEntityObject>... filters) |
protected ContentEntityObjectDao |
getContentEntityObjectDao() |
protected com.atlassian.event.api.EventPublisher |
getEventPublisher() |
protected HibernateSessionManager |
getHibernateSessionManager() |
protected ConfluenceIndexer |
getIndexer() |
protected LabelManager |
getLabelManager() |
protected LinkManager |
getLinkManager() |
ContentEntityObject |
getNextVersion(ContentEntityObject ceo) |
protected NotificationManager |
getNotificationManager() |
ContentEntityObject |
getOtherVersion(ContentEntityObject ceo,
int version) |
protected PageDao |
getPageDao() |
ContentEntityObject |
getPreviousVersion(ContentEntityObject ceo) |
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
ContentEntityObjects 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.
|
protected void |
publishCreateEvent(ContentEntityObject obj)
This method publishes
*CreateEventss. |
protected void |
publishCreateEvent(ContentEntityObject obj,
SaveContext saveContext) |
protected void |
publishRemoveEvent(ContentEntityObject obj)
This method publishes
*RemoveEvents. |
protected void |
publishUpdateEvent(ContentEntityObject obj,
ContentEntityObject origObj,
SaveContext saveContext)
This method publishes
*UpdateEvents. |
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 entity,
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 |
setAttachmentManager(AttachmentManager attachmentManager)
Deprecated.
since 5.8. Use {#DefaultContentEntityManager} instead.
|
protected void |
suppressNotificationsOnEventIfRequired(ContentEvent event,
SaveContext saveContext)
Sets suppressNotifications on the event if required by the SaveContext
|
void |
updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
String newTitle)
Deprecated.
since 4.0.
|
void |
updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
String newTitle,
boolean saveNewVersion)
Deprecated.
since 4.0.
|
void |
updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey)
Deprecated.
since 4.0.
|
void |
updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
boolean saveNewVersion)
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.
|
void |
updateSingleContentLinkinTo(ContentEntityObject referringContent,
SpaceContentEntityObject contentBeingRefactored,
String newSpaceKey,
String newTitle,
SaveContext saveContext,
boolean saveNewVersion)
Deprecated.
since 4.0.
|
public DefaultContentEntityManager(ContentEntityObjectDao contentEntityObjectDao, LinkManager linkManager, ConfluenceIndexer indexer, LabelManager labelManager, AttachmentManager attachmentManager, HibernateSessionManager hibernateSessionManager, com.google.common.base.Supplier<XhtmlContent> xhtmlContent, com.atlassian.event.api.EventPublisher eventPublisher, NotificationManager notificationManager)
public void refreshContentEntity(ContentEntityObject obj)
ContentEntityManagerrefreshContentEntity in interface ContentEntityManagerobj - the object to be refreshed in the Hibernate session.public void saveContentEntity(ContentEntityObject obj, @Nullable SaveContext saveContext)
saveContentEntity in interface ContentEntityManagerobj - - the ContentEntityObject to savesaveContext - - a SaveContext object for the manager.public void saveContentEntity(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)
ContentEntityManagersaveContentEntity in interface ContentEntityManagersaveContext - - a SaveContext holding additional parameters for the manager to use when saving.public <T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification)
ContentEntityManager
manager.<Page>saveNewVersion(page, new Modification<Page>() {
public void modify(Page page) {
page.setTitle("foobar");
}
});
saveNewVersion in interface ContentEntityManagerT - 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 requirepublic <T extends ContentEntityObject> void saveNewVersion(T current, Modification<T> modification, @Nullable SaveContext saveContext)
ContentEntityManager
manager.<Page>saveNewVersion(page, new Modification<Page>() {
public void modify(Page page) {
page.setTitle("foobar");
}
}, new DefaultSaveContext());
saveNewVersion in interface ContentEntityManagerT - 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 ContentEntityManager.saveNewVersion(ContentEntityObject, Modification)).public void removeContentEntity(ContentEntityObject obj)
ContentEntityManagerremoveContentEntity in interface ContentEntityManager@Nullable public ContentEntityObject getById(long id)
getById in interface ContentEntityManager@Nullable public ContentEntityObject getById(ContentId id)
getById in interface ContentEntityManagerInternal@Nullable public ContentEntityObject getById(ContentId id, int version)
getById in interface ContentEntityManagerInternalid - the id of the last version CEO. Previous version ids will make this method return nullpublic PageResponse<ContentEntityObject> getByIds(List<ContentId> contentIds, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super AbstractLabelableEntityObject>... filters)
getByIds in interface ContentEntityManagerInternalcontentIds - the contentIds of the candidate ContentEntityObjectslimitedRequest - the page request to applyfilters - an optional predicatepublic void revertContentEntityBackToVersion(ContentEntityObject entity, int version, @Nullable String revertComment, boolean revertTitle)
ContentEntityManager
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.
revertContentEntityBackToVersion in interface ContentEntityManagerentity - 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 protected BodyContent getBodyContentForRevert(ContentEntityObject historicalVersion)
@Nonnull public Iterator getRecentlyAddedEntities(@Nullable String spaceKey, int maxResults)
ContentEntityManagergetRecentlyAddedEntities in interface ContentEntityManagerspaceKey - 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 public Iterator getRecentlyModifiedEntities(String spaceKey, int maxResults)
ContentEntityManagergetRecentlyModifiedEntities in interface ContentEntityManagerspaceKey - 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 public Iterator getRecentlyModifiedEntitiesForUser(String username)
ContentEntityManagergetRecentlyModifiedEntitiesForUser in interface ContentEntityManagerusername - the user for which to retrieve the modified content@Nonnull public List getRecentlyModifiedForChangeDigest(Date fromDate)
ContentEntityManagerContentEntityObjects that have been newly added or modified
since the date specified. This list excludes drafts, space descriptions and mail.getRecentlyModifiedForChangeDigest in interface ContentEntityManagerfromDate - content modified after this date will be returnedContentEntityObjects that have been newly added or modified
since the date specified@Deprecated public void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey)
ContentEntityManagerupdateOutgoingLinksInContent in interface ContentEntityManager@Deprecated public void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, boolean saveNewVersion)
@Deprecated public void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
ContentEntityManagerupdateContentLinkingTo in interface ContentEntityManager@Deprecated public void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, boolean saveNewVersion)
@Deprecated public void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
ContentEntityManagerupdateSingleContentLinkinTo in interface ContentEntityManager@Deprecated public void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, @Nullable SaveContext saveContext)
updateSingleContentLinkinTo in interface ContentEntityManager@Deprecated public void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, SaveContext saveContext, boolean saveNewVersion)
@Nullable public ContentEntityObject getPreviousVersion(ContentEntityObject ceo)
getPreviousVersion in interface ContentEntityManager@Nullable public ContentEntityObject getNextVersion(ContentEntityObject ceo)
getNextVersion in interface ContentEntityManager@Nullable public ContentEntityObject getOtherVersion(ContentEntityObject ceo, int version)
getOtherVersion in interface ContentEntityManager@Nonnull public List<VersionHistorySummary> getVersionHistorySummaries(ContentEntityObject ceo)
ContentEntityManagergetVersionHistorySummaries in interface ContentEntityManagerceo - the entity object to return the version history ofpublic void removeHistoricalVersion(ContentEntityObject historicalVersion)
ContentEntityManagerremoveHistoricalVersion in interface ContentEntityManagerhistoricalVersion - a historical entity object to removeprotected PageDao getPageDao()
protected void publishCreateEvent(ContentEntityObject obj)
*CreateEventss.
Specific content entity object manager that need to publish those events should override this method.obj - the created content entity objectprotected void publishCreateEvent(ContentEntityObject obj, @Nullable SaveContext saveContext)
protected void publishUpdateEvent(ContentEntityObject obj, @Nullable ContentEntityObject origObj, @Nullable SaveContext saveContext)
*UpdateEvents.
Specific content entity object manager that need to publish those events should override this method.obj - the updated content entity objectorigObj - the old version of the content entity object, for history purposesaveContext - the associated SaveContextprotected void publishRemoveEvent(ContentEntityObject obj)
*RemoveEvents.
Specific content entity object manager that need to publish those events should override this method.obj - the removed content entity objectprotected void suppressNotificationsOnEventIfRequired(ContentEvent event, @Nullable SaveContext saveContext)
event - saveContext - protected ContentEntityObjectDao getContentEntityObjectDao()
protected LinkManager getLinkManager()
protected ConfluenceIndexer getIndexer()
protected LabelManager getLabelManager()
protected AttachmentManager getAttachmentManager()
protected HibernateSessionManager getHibernateSessionManager()
protected com.atlassian.event.api.EventPublisher getEventPublisher()
protected NotificationManager getNotificationManager()
@Deprecated public void setAttachmentManager(AttachmentManager attachmentManager)
Copyright © 2003–2015 Atlassian. All rights reserved.