public class

DefaultContentEntityManager

extends Object
implements ContentEntityManager
java.lang.Object
   ↳ com.atlassian.confluence.core.DefaultContentEntityManager
Known Direct Subclasses

Summary

[Expand]
Inherited Constants
From interface com.atlassian.confluence.core.ContentEntityManager
Fields
protected AttachmentManager attachmentManager
protected ContentEntityObjectDao contentEntityObjectDao
protected EventManager eventManager
protected ConfluenceIndexer indexer
protected LabelManager labelManager
protected LinkManager linkManager
Public Constructors
DefaultContentEntityManager()
Public Methods
Iterator getAllCurrentEntities()
ContentEntityObject getById(long id)
ContentEntityObject getNextVersion(ContentEntityObject ceo)
ContentEntityObject getOtherVersion(ContentEntityObject ceo, int version)
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.
void removeContentEntity(ContentEntityObject obj)
Removes given content entity object and all associated domain objects i.e.
void revertContentEntityBackToVersion(ContentEntityObject obj, int version, String revertComment, boolean revertTitle)

Reverts a ContentEntityObject back to its state at the version specified by version.

void revertContentEntityBackToVersion(ContentEntityObject obj, int 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> void saveNewVersion(T current, Modification<T> modification)
Applies the state changes supplied by modification and persists those changes to a new version.
<T extends ContentEntityObject> void 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)
void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
void setEventManager(EventManager eventManager)
void setIndexer(ConfluenceIndexer indexer)
void setLabelManager(LabelManager labelManager)
void setLinkManager(LinkManager linkManager)
@Deprecated void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
This method is deprecated. since 4.0.
@Deprecated void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, boolean saveNewVersion)
This method is deprecated. since 4.0.
@Deprecated void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, boolean saveNewVersion)
This method is deprecated. since 4.0.
@Deprecated void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey)
This method is deprecated. since 4.0.
@Deprecated void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, SaveContext saveContext, boolean saveNewVersion)
This method is deprecated. since 4.0.
@Deprecated void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
This method is deprecated. since 4.0.
@Deprecated void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, SaveContext saveContext)
This method is deprecated. since 4.0.
Protected Methods
EventManager getEventManager()
PageDao getPageDao()
void publishCreateEvent(ContentEntityObject obj)
This method publishes *CreateEventss.
void publishRemoveEvent(ContentEntityObject obj)
This method publishes *RemoveEvents.
void publishUpdateEvent(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
This method publishes *UpdateEvents.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.core.ContentEntityManager

Fields

protected AttachmentManager attachmentManager

protected ContentEntityObjectDao contentEntityObjectDao

protected EventManager eventManager

protected ConfluenceIndexer indexer

protected LabelManager labelManager

protected LinkManager linkManager

Public Constructors

public DefaultContentEntityManager ()

Public Methods

public Iterator getAllCurrentEntities ()

public ContentEntityObject getById (long id)

Returns
  • ContentEntityObject with the given id. WARNING: Due to CONF-17972 the object may not be the correct type.

public ContentEntityObject getNextVersion (ContentEntityObject ceo)

public ContentEntityObject getOtherVersion (ContentEntityObject ceo, int version)

public ContentEntityObject getPreviousVersion (ContentEntityObject ceo)

public Iterator getRecentlyAddedEntities (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.

public 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.

public 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

public List getRecentlyModifiedForChangeDigest (Date fromDate)

Retrieves a list of ContentEntityObjects 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 ContentEntityObjects that have been newly added or modified since the date specified

public 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.

public 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

public void revertContentEntityBackToVersion (ContentEntityObject obj, int version, 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.

Parameters
obj The ContentEntityObject to revert
version The version to revert to
revertComment A comment to be associated with the revert
revertTitle If true, the ContentEntityObject title will be reverted to the old state

public void revertContentEntityBackToVersion (ContentEntityObject obj, int version)

public 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.

Parameters
saveContext - a SaveContext holding additional parameters for the manager to use when saving.

public void saveContentEntity (ContentEntityObject obj, SaveContext saveContext)

public 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");
      }
 });
 
Parameters
current the current / latest version
modification an implementation of Modification which describes the state changes you require

public void saveNewVersion (T current, Modification<T> modification, 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());
 
Parameters
current the current / latest version
modification an implementation of Modification which describes the state changes you require
saveContext the save context (null if you have no specific requirements - or just use saveNewVersion(ContentEntityObject, Modification)).

public void setAttachmentManager (AttachmentManager attachmentManager)

public void setContentEntityObjectDao (ContentEntityObjectDao contentEntityObjectDao)

public void setEventManager (EventManager eventManager)

public void setIndexer (ConfluenceIndexer indexer)

public void setLabelManager (LabelManager labelManager)

public void setLinkManager (LinkManager linkManager)

@Deprecated public void updateContentLinkingTo (SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)

This method is deprecated.
since 4.0.

Loops through all the content that currently links to 'contentBeingChanged' and renames all the links.
This will skip any referring content that is the 'contentBeingChanged' (i.e. content links to itself).
If you only want to change the links of a specific content object, use the 'updateSingleContentLinkinTo' function.
This rename will be recorded in the content's history

@Deprecated public void updateContentLinkingTo (SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, boolean saveNewVersion)

This method is deprecated.
since 4.0.

@Deprecated public void updateOutgoingLinksInContent (SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, boolean saveNewVersion)

This method is deprecated.
since 4.0.

Update the links on the page itself. If links are local (refering to the current space), a spacekey has to be added to the link

@Deprecated public void updateOutgoingLinksInContent (SpaceContentEntityObject contentBeingRefactored, String newSpaceKey)

This method is deprecated.
since 4.0.

Update the links on the page itself. If links are local (refering to the current space), a spacekey has to be added to the link

@Deprecated public void updateSingleContentLinkinTo (ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, SaveContext saveContext, boolean saveNewVersion)

This method is deprecated.
since 4.0.

@Deprecated public void updateSingleContentLinkinTo (ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)

This method is deprecated.
since 4.0.

Renames all links contained in the 'referringContent' that currently links to 'contentBeingRefactored'.
This rename will be recorded in the content's history

@Deprecated public void updateSingleContentLinkinTo (ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, SaveContext saveContext)

This method is deprecated.
since 4.0.

Protected Methods

protected EventManager getEventManager ()

protected PageDao getPageDao ()

protected void publishCreateEvent (ContentEntityObject obj)

This method publishes *CreateEventss. Specific content entity object manager that need to publish those events should override this method.

Parameters
obj the created content entity object

protected void publishRemoveEvent (ContentEntityObject obj)

This method publishes *RemoveEvents. Specific content entity object manager that need to publish those events should override this method.

Parameters
obj the removed content entity object

protected void publishUpdateEvent (ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)

This method publishes *UpdateEvents. Specific content entity object manager that need to publish those events should override this method.

Parameters
obj the updated content entity object
origObj the old version of the content entity object, for history purpose
saveContext the associated SaveContext