com.atlassian.confluence.content
Interface CustomContentManager

All Superinterfaces:
ContentEntityManager
All Known Implementing Classes:
DefaultCustomContentManager

public interface CustomContentManager
extends ContentEntityManager


Nested Class Summary
static class CustomContentManager.SortField
           
static class CustomContentManager.SortOrder
           
 
Field Summary
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
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. Since 4.2. No replacement.
<T> PageResponse<T>
findByQuery(ContentQuery<T> query, boolean cacheable, LimitedRequest request, com.google.common.base.Predicate<T> predicate)
          Get the results of a query for CustomContentEntityObjects
<T> java.util.Iterator<T>
findByQuery(ContentQuery<T> query, int offset, int maxResults)
          Get the results of a query for CustomContentEntityObjects
 java.util.Iterator<CustomContentEntityObject> findChildrenOfType(CustomContentEntityObject content, java.lang.String contentModuleKey, 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 contentModuleKey, 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 CustomContentEntityObjects.
 int findTotalInSpace(Space space, java.lang.String contentModuleKey)
          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.
 void removeAllInSpace(java.lang.String contentModuleKey, 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.
 CustomContentEntityObject updatePluginModuleKey(CustomContentEntityObject content, java.lang.String pluginModuleKey)
          Update the type of an existing CustomContentEntityObject with the specified module key.
 
Methods inherited from interface com.atlassian.confluence.core.ContentEntityManager
getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, removeHistoricalVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, saveNewVersion, saveNewVersion, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Method Detail

newPluginContentEntityObject

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

Parameters:
contentModuleKey - the module complete key of the content's ContentAdapter module
Returns:
a blank entity object for that plugin

updatePluginModuleKey

CustomContentEntityObject updatePluginModuleKey(CustomContentEntityObject content,
                                                java.lang.String pluginModuleKey)
Update the type of an existing CustomContentEntityObject with the specified module key.

Parameters:
pluginModuleKey - the module complete key of the content's ContentAdapter module
Returns:
a blank entity object for that plugin

getById

CustomContentEntityObject getById(long id)
Find a single CustomContentEntityObject by its id

Specified by:
getById in interface ContentEntityManager
Parameters:
id - the ID of the entity to retrieve
Returns:
the entity, or null if no such entity exists.

findByQuery

<T> java.util.Iterator<T> findByQuery(ContentQuery<T> query,
                                      int offset,
                                      int maxResults)
Get the results of a query for CustomContentEntityObjects

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

findByQuery

<T> PageResponse<T> findByQuery(ContentQuery<T> query,
                                boolean cacheable,
                                LimitedRequest request,
                                com.google.common.base.Predicate<T> predicate)
Get the results of a query for CustomContentEntityObjects

Parameters:
query - the query to perform
cacheable - whether the results for the given query can be cached
request - the limited pagination request
predicate - the filter to apply to the results
Returns:
a PageResponse of the results of the query, after filtering with the given predicate

findFirstObjectByQuery

<T> T findFirstObjectByQuery(ContentQuery<T> query)
Find the first result of a query for CustomContentEntityObjects. This is a convenience method for queries where we expect to only retrieve a single result.

Parameters:
query - the query to perform
Returns:
the first result of the query, or null if no results are returned

findTotalInSpace

int findTotalInSpace(Space space,
                     java.lang.String contentModuleKey)
Get the total count of current, non-deleted content of the given type in the given space.

Parameters:
space - the space to count content in
contentModuleKey - 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

java.util.Iterator<CustomContentEntityObject> findCurrentInSpace(Space space,
                                                                 java.lang.String contentModuleKey,
                                                                 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.

Parameters:
space - the space to retrieve content from
contentModuleKey - 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

long countChildrenOfType(CustomContentEntityObject content,
                         java.lang.String contentModuleKey)
Get the total number of children of a piece of content with the given type

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

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

Parameters:
content - the content to look for children of
contentModuleKey - 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

java.util.Iterator<CustomContentEntityObject> findAllChildren(CustomContentEntityObject content)
Get an iterator of all children of a piece of content.

Parameters:
content - the content to look for children of

removeAllInSpace

void removeAllInSpace(java.lang.String contentModuleKey,
                      Space space)
Remove all plugin content of a particular type from a given space.

Parameters:
contentModuleKey - the plugin module complete key of the content to be searched for
space - the space from which to delete all content of that type

removeAllPluginContentInSpace

void removeAllPluginContentInSpace(Space space)
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.

Parameters:
space -

removeAllPluginContent

void removeAllPluginContent(java.lang.String contentModuleKey)
Remove all plugin content of a particular type

Parameters:
contentModuleKey - the plugin module complete key of the content to be searched for

findAllInSpace

@Deprecated
java.util.Collection<CustomContentEntityObject> findAllInSpace(Space space)
Deprecated. Since 4.2. No replacement.

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.

Parameters:
space - a space
Returns:
all plugin content within that space


Copyright © 2003-2014 Atlassian. All Rights Reserved.