com.atlassian.confluence.core
Class DefaultContentEntityManager

java.lang.Object
  extended bycom.atlassian.confluence.core.DefaultContentEntityManager
All Implemented Interfaces:
ContentEntityManager
Direct Known Subclasses:
DefaultCommentManager, DefaultMailContentManager, DefaultPageManager, DefaultPersonalInformationManager

public class DefaultContentEntityManager
extends Object
implements ContentEntityManager


Field Summary
protected  ContentEntityObjectDao contentEntityObjectDao
           
protected  EventManager eventManager
           
protected  ConfluenceIndexer indexer
           
protected  LinkManager linkManager
           
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultContentEntityManager()
           
 
Method Summary
 Iterator getAllCurrentEntities()
          Retrieves an Iterator for all entities.
 ContentEntityObject getById(long id)
           
 List getEntitiesModifiedSince(Date date)
           
protected  EventManager getEventManager()
           
 List getLockedBySpace(String spaceKey)
           
 ContentEntityObject getNextVersion(ContentEntityObject ceo)
           
 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(int maxResults)
          Deprecated.  
 Iterator getRecentlyModifiedEntities(String spaceKey, int maxResults)
          Retrieve an iterator of recently modified entities, in order of most recent to last.
 Iterator getRecentlyModifiedEntitiesByType(ListQuery query, int firstResult)
           
 Iterator getRecentlyModifiedEntitiesForUser(String username)
          Retrieve an iterator of recently modified entities, in order of most recent to last.
 List 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 publishRemoveEvent(ContentEntityObject obj)
          This method publishes *RemoveEvents.
protected  void publishUpdateEvent(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
          This method publishes *UpdateEvents.
 void refreshContentEntity(ContentEntityObject obj)
           
 void removeContentEntity(ContentEntityObject obj)
           
 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)
           
 void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
           
 void setEventManager(EventManager eventManager)
           
 void setIndexer(ConfluenceIndexer indexer)
           
 void setLabelManager(LabelManager labelManager)
           
 void setLinkManager(LinkManager linkManager)
           
 void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
          Loops through all the content that currently links to 'contentBeingChanged' and renames all the links.
 void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored, String newSpaceKey)
          Update the links on the page itself.
 void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle)
          Renames all links contained in the 'referringContent' that currently links to 'contentBeingRefactored'.
 void updateSingleContentLinkinTo(ContentEntityObject referringContent, SpaceContentEntityObject contentBeingRefactored, String newSpaceKey, String newTitle, SaveContext saveContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentEntityObjectDao

protected ContentEntityObjectDao contentEntityObjectDao

linkManager

protected LinkManager linkManager

indexer

protected ConfluenceIndexer indexer

eventManager

protected EventManager eventManager
Constructor Detail

DefaultContentEntityManager

public DefaultContentEntityManager()
Method Detail

setContentEntityObjectDao

public void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)

setLinkManager

public void setLinkManager(LinkManager linkManager)

saveContentEntity

public void saveContentEntity(ContentEntityObject obj,
                              SaveContext saveContext)
Specified by:
saveContentEntity in interface ContentEntityManager
Parameters:
obj - - the ContentEntityObject to save
saveContext - - a SaveContext object for the manager.

saveContentEntity

public void saveContentEntity(ContentEntityObject obj,
                              ContentEntityObject origObj,
                              SaveContext saveContext)
Description copied from interface: ContentEntityManager
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.

Specified by:
saveContentEntity in interface ContentEntityManager
Parameters:
obj -
origObj -
saveContext - - a SaveContext holding additional parameters for the manager to use when saving.

removeContentEntity

public void removeContentEntity(ContentEntityObject obj)
Specified by:
removeContentEntity in interface ContentEntityManager

refreshContentEntity

public void refreshContentEntity(ContentEntityObject obj)
Specified by:
refreshContentEntity in interface ContentEntityManager

getById

public ContentEntityObject getById(long id)
Specified by:
getById in interface ContentEntityManager

revertContentEntityBackToVersion

public void revertContentEntityBackToVersion(ContentEntityObject obj,
                                             int version)
Specified by:
revertContentEntityBackToVersion in interface ContentEntityManager

getRecentlyAddedEntities

public Iterator getRecentlyAddedEntities(String spaceKey,
                                         int maxResults)
Description copied from interface: ContentEntityManager
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.

Specified by:
getRecentlyAddedEntities in interface ContentEntityManager
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

public Iterator getRecentlyModifiedEntities(String spaceKey,
                                            int maxResults)
Description copied from interface: ContentEntityManager
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.

Specified by:
getRecentlyModifiedEntities in interface ContentEntityManager
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.

getRecentlyModifiedEntities

public Iterator getRecentlyModifiedEntities(int maxResults)
Deprecated.  

Specified by:
getRecentlyModifiedEntities in interface ContentEntityManager

getAllCurrentEntities

public Iterator getAllCurrentEntities()
Description copied from interface: ContentEntityManager
Retrieves an Iterator for all entities. The result is not restricted to any types, but returns only the current version of each object.

Specified by:
getAllCurrentEntities in interface ContentEntityManager
Returns:
an Iterator of all the entities

getRecentlyModifiedEntitiesForUser

public Iterator getRecentlyModifiedEntitiesForUser(String username)
Description copied from interface: ContentEntityManager
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.

Specified by:
getRecentlyModifiedEntitiesForUser in interface ContentEntityManager
Parameters:
username - the user for which to retrieve the modified content

getRecentlyModifiedEntitiesByType

public Iterator getRecentlyModifiedEntitiesByType(ListQuery query,
                                                  int firstResult)
Specified by:
getRecentlyModifiedEntitiesByType in interface ContentEntityManager

getEntitiesModifiedSince

public List getEntitiesModifiedSince(Date date)
Specified by:
getEntitiesModifiedSince in interface ContentEntityManager

getLockedBySpace

public List getLockedBySpace(String spaceKey)
Specified by:
getLockedBySpace in interface ContentEntityManager

updateOutgoingLinksInContent

public void updateOutgoingLinksInContent(SpaceContentEntityObject contentBeingRefactored,
                                         String newSpaceKey)
Description copied from interface: ContentEntityManager
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

Specified by:
updateOutgoingLinksInContent in interface ContentEntityManager
Parameters:
contentBeingRefactored -
newSpaceKey -

updateContentLinkingTo

public void updateContentLinkingTo(SpaceContentEntityObject contentBeingRefactored,
                                   String newSpaceKey,
                                   String newTitle)
Description copied from interface: ContentEntityManager
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

Specified by:
updateContentLinkingTo in interface ContentEntityManager
Parameters:
contentBeingRefactored -
newSpaceKey -
newTitle -

updateSingleContentLinkinTo

public void updateSingleContentLinkinTo(ContentEntityObject referringContent,
                                        SpaceContentEntityObject contentBeingRefactored,
                                        String newSpaceKey,
                                        String newTitle)
Description copied from interface: ContentEntityManager
Renames all links contained in the 'referringContent' that currently links to 'contentBeingRefactored'.
This rename will be recorded in the content's history

Specified by:
updateSingleContentLinkinTo in interface ContentEntityManager
Parameters:
referringContent -
contentBeingRefactored -
newSpaceKey -
newTitle -

updateSingleContentLinkinTo

public void updateSingleContentLinkinTo(ContentEntityObject referringContent,
                                        SpaceContentEntityObject contentBeingRefactored,
                                        String newSpaceKey,
                                        String newTitle,
                                        SaveContext saveContext)
Specified by:
updateSingleContentLinkinTo in interface ContentEntityManager

getPreviousVersion

public ContentEntityObject getPreviousVersion(ContentEntityObject ceo)
Specified by:
getPreviousVersion in interface ContentEntityManager

getNextVersion

public ContentEntityObject getNextVersion(ContentEntityObject ceo)
Specified by:
getNextVersion in interface ContentEntityManager

getOtherVersion

public ContentEntityObject getOtherVersion(ContentEntityObject ceo,
                                           int version)
Specified by:
getOtherVersion in interface ContentEntityManager

getVersionHistorySummaries

public List getVersionHistorySummaries(ContentEntityObject ceo)
Description copied from interface: ContentEntityManager
Get a VersionHistorySummary for all previous versions of a ContentEntityObject, starting with the current content.

Specified by:
getVersionHistorySummaries in interface ContentEntityManager
Parameters:
ceo - the entity object to return the version history of
Returns:
the full version history of that object, as VersionHistorySummary objects.

getPageDao

protected PageDao getPageDao()

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj)
This method publishes *CreateEventss. Specific content entity object manager that need to publish those events should override this method. Default implmentation doesn't do anything

Parameters:
obj - the created content entity object

publishUpdateEvent

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. Default implmentation doesn't do anything

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

publishRemoveEvent

protected void publishRemoveEvent(ContentEntityObject obj)
This method publishes *RemoveEvents. Specific content entity object manager that need to publish those events should override this method. Default implmentation doesn't do anything

Parameters:
obj - the removed content entity object

setEventManager

public void setEventManager(EventManager eventManager)
Specified by:
setEventManager in interface ContentEntityManager

setLabelManager

public void setLabelManager(LabelManager labelManager)

getEventManager

protected EventManager getEventManager()

setIndexer

public void setIndexer(ConfluenceIndexer indexer)


Confluence is developed by Atlassian.