@ExperimentalApi
public interface ContentService
Content
objects such as
Pages, BlogPosts and Comments.Modifier and Type | Interface and Description |
---|---|
static interface |
ContentService.ContentFetcher
A content fetcher that also allows fetching many, this exists as a separate interface
to allow the type system to only offer fetchMany methods when appropriate.
|
static interface |
ContentService.ContentFinder
A finder for locating content
|
static interface |
ContentService.ParameterContentFinder
A content finder allowing various parameters to be set to restrict the fetched content.
|
static interface |
ContentService.SingleContentFetcher |
static interface |
ContentService.Validator
Provides methods for validating the create, update and delete methods.
|
Modifier and Type | Method and Description |
---|---|
Content |
create(Content newContent)
Create a piece of content.
|
Content |
create(Content newContent,
Expansion... expansions)
Create a piece of content.
|
void |
delete(Content content)
Removes a piece of Content from the system.
|
ContentService.ContentFinder |
find(Expansion... expansions)
Create a ContentFinder for locating content, the expansions will be applied to each piece of content that matches the
finder.
|
Content |
update(Content content)
Updates a piece of content.
|
ContentService.Validator |
validator()
Get the validator view of the ContentService.
|
ContentService.ContentFinder find(Expansion... expansions)
For example, to fetch the first 50 blog posts in the DEV Space :
contentService.find()
.withSpace("DEV")
.withType(ContentType.BLOG_POST)
.fetchMany(new SimplePageRequest(0,50);
expansions
- Content create(Content newContent) throws ServiceException
Valid ContentRepresentation
s for the ContentBody
can be found in the documentation on the
ContentBodyConversionService
.
newContent
- the content to createServiceException
- if the content cannot be createdContent create(Content newContent, Expansion... expansions) throws ServiceException
Valid ContentRepresentation
s for the ContentBody
can be found in the documentation on the
ContentBodyConversionService
.
newContent
- the content to createexpansions
- the particular expansions will be applied to the new created contentServiceException
- if the content cannot be createdContent update(Content content) throws ServiceException
Valid ContentRepresentation
s for the ContentBody
can be found in the documentation on the
ContentBodyConversionService
.
Content with an existing status of ContentStatus.TRASHED
that is updated to have status
ContentStatus.CURRENT
will be restored from the trash, provided that the version in the supplied
Content is correct and the user has permission to perform the restore.
Any other changes to the Content being restored will be discarded.
content
- the updated Content
ServiceException
void delete(Content content) throws ServiceException
The way that this method behaves depends on whether the Content being deleted supports trashing, and its current status:
current
, in which case calling this method will trash the contenttrashed
, in which case calling this method will fail. Clients should use
ContentTrashService.purge(Content)
to permanently delete trashed content.trashed
status.
The methods ContentTrashService.trash(Content)
and ContentTrashService.purge(Content)
can be used for content that is known to support trashing.
content
- the content to removeServiceException
- if the content cannot be found, or cannot be deletedContentService.Validator validator()
Copyright © 2003–2016 Atlassian. All rights reserved.