com.atlassian.confluence.content
Class DefaultCustomContentManager

java.lang.Object
  extended by com.atlassian.confluence.core.DefaultContentEntityManager
      extended by com.atlassian.confluence.content.DefaultCustomContentManager
All Implemented Interfaces:
CustomContentManager, ContentEntityManager

public class DefaultCustomContentManager
extends DefaultContentEntityManager
implements CustomContentManager

Generic manager for pluggable content.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.CustomContentManager
CustomContentManager.SortField, CustomContentManager.SortOrder
 
Field Summary
 
Fields inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
attachmentManager, contentEntityObjectDao, eventManager, hibernateSessionManager, indexer, labelManager, linkManager
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultCustomContentManager()
           
 
Method Summary
 long countChildrenOfType(CustomContentEntityObject content, java.lang.String contentModuleKey)
          Get the total number of children of a piece of content with the given type
 java.util.Iterator<CustomContentEntityObject> findAllChildren(CustomContentEntityObject content)
          Get an iterator of all children of a piece of content.
 java.util.Collection<CustomContentEntityObject> findAllInSpace(Space space)
          Deprecated. 
<T> java.util.Iterator<T>
findByQuery(ContentQuery<T> query, int offset, int maxResults)
          Get the results of a query for PluginContentEntityObjects
 java.util.Iterator<CustomContentEntityObject> findChildrenOfType(CustomContentEntityObject content, java.lang.String pluginContentKey, int offset, int maxResults, CustomContentManager.SortField sortField, CustomContentManager.SortOrder sortOrder)
          Get an iterator of children of a piece of content with a given type.
 java.util.Iterator<CustomContentEntityObject> findCurrentInSpace(Space space, java.lang.String pluginContentKey, int offset, int maxResults, CustomContentManager.SortField sortField, CustomContentManager.SortOrder sortOrder)
          Get an iterator of all the current, non-deleted content of the given type in the given space.
<T> T
findFirstObjectByQuery(ContentQuery<T> query)
          Find the first result of a query for PluginContentEntityObjects.
 int findTotalInSpace(Space space, java.lang.String pluginContentKey)
          Get the total count of current, non-deleted content of the given type in the given space.
 CustomContentEntityObject getById(long id)
          Find a single CustomContentEntityObject by its id
 CustomContentEntityObject newPluginContentEntityObject(java.lang.String contentModuleKey)
          Create a new CustomContentEntityObject for the given module.
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 removeAllInSpace(java.lang.String pluginContentKey, Space space)
          Remove all plugin content of a particular type from a given space.
 void removeAllPluginContent(java.lang.String contentModuleKey)
          Remove all plugin content of a particular type
 void removeAllPluginContentInSpace(Space space)
          Remove all plugin content (of all types) from a given space.
 void removeContentEntity(ContentEntityObject obj)
          Removes given content entity object and all associated domain objects i.e.
 void setContentTypeManager(ContentTypeManager contentTypeManager)
           
 void setCustomContentDao(CustomContentDao customContentDao)
           
 CustomContentEntityObject updatePluginModuleKey(CustomContentEntityObject content, java.lang.String pluginModuleKey)
          Update the type of an existing CustomContentEntityObject with the specified module key.
 
Methods inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
getBodyContentForRevert, getEventManager, getNextVersion, getOtherVersion, getPageDao, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, saveNewVersion, saveNewVersion, setAttachmentManager, setContentEntityObjectDao, setEventManager, setHibernateSessionManager, setIndexer, setLabelManager, setLinkManager, suppressNotificationsOnEventIfRequired, updateContentLinkingTo, updateContentLinkingTo, updateOutgoingLinksInContent, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.core.ContentEntityManager
getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, saveNewVersion, saveNewVersion, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Constructor Detail

DefaultCustomContentManager

public DefaultCustomContentManager()
Method Detail

newPluginContentEntityObject

public CustomContentEntityObject newPluginContentEntityObject(java.lang.String contentModuleKey)
Description copied from interface: CustomContentManager
Create a new CustomContentEntityObject for the given module. This method will ensure that the plugin delegate and various necessary arguments are set.

Specified by:
newPluginContentEntityObject in interface CustomContentManager
Parameters:
contentModuleKey - the module complete key of the content's ContentAdapter module
Returns:
a blank entity object for that plugin

updatePluginModuleKey

public CustomContentEntityObject updatePluginModuleKey(CustomContentEntityObject content,
                                                       java.lang.String pluginModuleKey)
Description copied from interface: CustomContentManager
Update the type of an existing CustomContentEntityObject with the specified module key.

Specified by:
updatePluginModuleKey in interface CustomContentManager
pluginModuleKey - the module complete key of the content's ContentAdapter module
Returns:
a blank entity object for that plugin

getById

public CustomContentEntityObject getById(long id)
Description copied from interface: CustomContentManager
Find a single CustomContentEntityObject by its id

Specified by:
getById in interface CustomContentManager
Specified by:
getById in interface ContentEntityManager
Overrides:
getById in class DefaultContentEntityManager
Parameters:
id - the ID of the entity to retrieve
Returns:
ContentEntityObject with the given id. WARNING: Due to CONF-17972 the object may not be the correct type.

findByQuery

public <T> java.util.Iterator<T> findByQuery(ContentQuery<T> query,
                                             int offset,
                                             int maxResults)
Description copied from interface: CustomContentManager
Get the results of a query for PluginContentEntityObjects

Specified by:
findByQuery in interface CustomContentManager
Parameters:
query - the query to perform
offset - the first result to return
maxResults - the maximum number of results to return
Returns:
an iterator of the results of the query

findFirstObjectByQuery

public <T> T findFirstObjectByQuery(ContentQuery<T> query)
Description copied from interface: CustomContentManager
Find the first result of a query for PluginContentEntityObjects. This is a convenience method for queries where we expect to only retrieve a single result.

Specified by:
findFirstObjectByQuery in interface CustomContentManager
Parameters:
query - the query to perform
Returns:
the first result of the query, or null if no results are returned

findTotalInSpace

public int findTotalInSpace(Space space,
                            java.lang.String pluginContentKey)
Description copied from interface: CustomContentManager
Get the total count of current, non-deleted content of the given type in the given space.

Specified by:
findTotalInSpace in interface CustomContentManager
Parameters:
space - the space to count content in
pluginContentKey - the plugin module complete key of the content to be searched for
Returns:
the total number of non-deleted, non-historical versions of content of the given type in that space

findCurrentInSpace

public java.util.Iterator<CustomContentEntityObject> findCurrentInSpace(Space space,
                                                                        java.lang.String pluginContentKey,
                                                                        int offset,
                                                                        int maxResults,
                                                                        CustomContentManager.SortField sortField,
                                                                        CustomContentManager.SortOrder sortOrder)
Description copied from interface: CustomContentManager
Get an iterator of all the current, non-deleted content of the given type in the given space.

Specified by:
findCurrentInSpace in interface CustomContentManager
Parameters:
space - the space to retrieve content from
pluginContentKey - the plugin module complete key of the content to be searched for
sortField - what field to sort the content on
sortOrder - which direction to sort the content in
Returns:
an iterator of the non-deleted, non-historical versions of content of the given type in that space

countChildrenOfType

public long countChildrenOfType(CustomContentEntityObject content,
                                java.lang.String contentModuleKey)
Description copied from interface: CustomContentManager
Get the total number of children of a piece of content with the given type

Specified by:
countChildrenOfType in interface CustomContentManager
Parameters:
content - the content to look for children of
contentModuleKey - the module key for the type of child to look for
Returns:
the number of available children of that type

findChildrenOfType

public java.util.Iterator<CustomContentEntityObject> findChildrenOfType(CustomContentEntityObject content,
                                                                        java.lang.String pluginContentKey,
                                                                        int offset,
                                                                        int maxResults,
                                                                        CustomContentManager.SortField sortField,
                                                                        CustomContentManager.SortOrder sortOrder)
Description copied from interface: CustomContentManager
Get an iterator of children of a piece of content with a given type.

Specified by:
findChildrenOfType in interface CustomContentManager
Parameters:
content - the content to look for children of
pluginContentKey - the module key of the type of child to look for
offset - the offset of the first result
maxResults - the maximum total results to return
sortField - what field to sort the content on
sortOrder - which direction to sort the content in

findAllChildren

public java.util.Iterator<CustomContentEntityObject> findAllChildren(CustomContentEntityObject content)
Description copied from interface: CustomContentManager
Get an iterator of all children of a piece of content.

Specified by:
findAllChildren in interface CustomContentManager
Parameters:
content - the content to look for children of

removeAllInSpace

public void removeAllInSpace(java.lang.String pluginContentKey,
                             Space space)
Description copied from interface: CustomContentManager
Remove all plugin content of a particular type from a given space.

Specified by:
removeAllInSpace in interface CustomContentManager
Parameters:
pluginContentKey - the plugin module complete key of the content to be searched for
space - the space from which to delete all content of that type

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *CreateEventss. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishCreateEvent in class DefaultContentEntityManager
Parameters:
obj - the created content entity object

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj,
                                  SaveContext saveContext)
Overrides:
publishCreateEvent in class DefaultContentEntityManager

publishUpdateEvent

protected void publishUpdateEvent(ContentEntityObject obj,
                                  ContentEntityObject origObj,
                                  SaveContext saveContext)
Description copied from class: DefaultContentEntityManager
This method publishes *UpdateEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishUpdateEvent in class DefaultContentEntityManager
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)
Description copied from class: DefaultContentEntityManager
This method publishes *RemoveEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishRemoveEvent in class DefaultContentEntityManager
Parameters:
obj - the removed content entity object

removeAllPluginContentInSpace

public void removeAllPluginContentInSpace(Space space)
Description copied from interface: CustomContentManager
Remove all plugin content (of all types) from a given space. This usually happens when a space is removed. Plugins wishing to perform extra work on space removal should listen for the PluginContentWillBeRemovedForSpaceEvent event.

Specified by:
removeAllPluginContentInSpace in interface CustomContentManager

removeAllPluginContent

public void removeAllPluginContent(java.lang.String contentModuleKey)
Description copied from interface: CustomContentManager
Remove all plugin content of a particular type

Specified by:
removeAllPluginContent in interface CustomContentManager
Parameters:
contentModuleKey - the plugin module complete key of the content to be searched for

removeContentEntity

public void removeContentEntity(ContentEntityObject obj)
Description copied from interface: ContentEntityManager
Removes given content entity object and all associated domain objects i.e. if we remove a page it removes all its labels and attachments

Specified by:
removeContentEntity in interface ContentEntityManager
Overrides:
removeContentEntity in class DefaultContentEntityManager

findAllInSpace

@Deprecated
public java.util.Collection<CustomContentEntityObject> findAllInSpace(Space space)
Deprecated. 

This method is required for space exports to work properly. Which is a good sign that space exports are evil and need to be rewritten. If you call it from anywhere else, I will kill a puppy.

Specified by:
findAllInSpace in interface CustomContentManager
Parameters:
space - a space
Returns:
all plugin content within that space

setCustomContentDao

public void setCustomContentDao(CustomContentDao customContentDao)

setContentTypeManager

public void setContentTypeManager(ContentTypeManager contentTypeManager)


Copyright © 2003-2014 Atlassian. All Rights Reserved.