com.atlassian.confluence.api.service.content
Interface ContentService


@ExperimentalApi
public interface ContentService

Provides methods for creating, reading, updating and deleting Confluence Content objects such as Pages, BlogPosts and Comments. This interface provides no capability for searching content, use the SearchService instead.


Method Summary
 Content create(Content newContent)
          Create a piece of content.
 void delete(Content content)
          Removes an item of Content from the system.
 com.atlassian.fugue.Option<Content> find(ContentLocator locator, Expansion... expansions)
          Retrieve a piece of content by some more complex criteria (defined by the ContentLocator).
 com.atlassian.fugue.Option<Content> findById(java.lang.String contentId, Expansion... expansions)
          Retrieve a piece of content by its id.
 com.atlassian.fugue.Option<Macro> findMacro(java.lang.String contentId, java.lang.String versionId, java.lang.String hash, Expansion... expansions)
          Retrieve details about a macro matching the page, version and macro hash.
 Content update(Content content)
          Updates a piece of content.
 ValidationResult validateCreate(Content newContent)
          Validate that a piece of content can be included, including permission checks.
 ValidationResult validateDelete(Content content)
          Validate that a piece of content can be deleted, including permission checks.
 

Method Detail

findById

com.atlassian.fugue.Option<Content> findById(java.lang.String contentId,
                                             Expansion... expansions)
Retrieve a piece of content by its id.

Parameters:
contentId - the id of the content you are looking for
Returns:
the content, if one exists matching the id, or none otherwise.

findMacro

com.atlassian.fugue.Option<Macro> findMacro(java.lang.String contentId,
                                            java.lang.String versionId,
                                            java.lang.String hash,
                                            Expansion... expansions)
                                            throws ServiceException
Retrieve details about a macro matching the page, version and macro hash.

Parameters:
contentId - The content to scan for the macro
versionId - The version of the page to scan for the macro
hash - The hash identifying the body of the macro
Returns:
Optionally return a Macro matching the given criteria
Throws:
ServiceException

find

com.atlassian.fugue.Option<Content> find(ContentLocator locator,
                                         Expansion... expansions)
Retrieve a piece of content by some more complex criteria (defined by the ContentLocator).

Parameters:
locator - the locator containing the criteria for the content you are looking for
Returns:
the content, if one exists matching the criteria, or none otherwise.

validateCreate

ValidationResult validateCreate(Content newContent)
                                throws ServiceException
Validate that a piece of content can be included, including permission checks.

Parameters:
newContent - the content to be created
Returns:
an immutable Validation result.
Throws:
ServiceException

create

Content create(Content newContent)
               throws ServiceException
Create a piece of content.

Valid ContentRepresentations for the ContentBody can be found in the documentation on the ContentBodyConversionService.

Parameters:
newContent - the content to create
Returns:
the content created
Throws:
ServiceException - if the content cannot be created

update

Content update(Content content)
               throws ServiceException
Updates a piece of content.

Valid ContentRepresentations for the ContentBody can be found in the documentation on the ContentBodyConversionService.

Parameters:
content - the updated Content with metadata about the change
Returns:
the updated content after being persisted
Throws:
ServiceException

validateDelete

ValidationResult validateDelete(Content content)
Validate that a piece of content can be deleted, including permission checks.

Parameters:
content - the content to be deleted
Returns:
an immutable Validation result.

delete

void delete(Content content)
            throws ServiceException
Removes an item of Content from the system.

Parameters:
content - if of the content to remove
Throws:
ServiceException - if the content cannot be found, or cannot be deleted


Copyright © 2003-2014 Atlassian. All Rights Reserved.