public class ContentServiceImpl extends Object implements ContentService
ContentService
. Contrast with the RemoteContentService.Modifier and Type | Class and Description |
---|---|
class |
ContentServiceImpl.ValidatorImpl |
ContentService.ContentFetcher, ContentService.ContentFinder, ContentService.ParameterContentFinder, ContentService.SingleContentFetcher, ContentService.Validator
DEFAULT_EXPANSIONS
Constructor and Description |
---|
ContentServiceImpl(PermissionManager permissionManager,
ContentFactory contentFactory,
ContentFinderFactory contentFinderFactory,
ContentTrashService trashService,
ApiSupportProvider apiSupportProvider,
ContentEntityManagerInternal contentEntityManager,
UserChecker userChecker,
com.google.common.base.Supplier<TouchRelationSupport> touchRelationSupportSupplier) |
Modifier and Type | Method and Description |
---|---|
Content |
buildContent(ContentEntityObject entity,
List<ContentStatus> statuses,
Expansion... expansions) |
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.
|
void |
setPermissionManager(PermissionManager permissionManager) |
Content |
update(Content updatedContent)
Updates a piece of content.
|
ContentServiceImpl.ValidatorImpl |
validator()
Get the validator view of the ContentService.
|
public ContentServiceImpl(PermissionManager permissionManager, ContentFactory contentFactory, ContentFinderFactory contentFinderFactory, ContentTrashService trashService, ApiSupportProvider apiSupportProvider, ContentEntityManagerInternal contentEntityManager, UserChecker userChecker, com.google.common.base.Supplier<TouchRelationSupport> touchRelationSupportSupplier)
public ContentService.ContentFinder find(Expansion... expansions)
ContentService
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);
find
in interface ContentService
public Content create(Content newContent) throws ServiceException
ContentService
Valid ContentRepresentation
s for the ContentBody
can be found in the documentation on the
ContentBodyConversionService
.
create
in interface ContentService
newContent
- the content to createServiceException
- if the content cannot be createdpublic Content create(Content newContent, Expansion... expansions) throws ServiceException
ContentService
Valid ContentRepresentation
s for the ContentBody
can be found in the documentation on the
ContentBodyConversionService
.
create
in interface ContentService
newContent
- the content to createexpansions
- the particular expansions will be applied to the new created contentServiceException
- if the content cannot be createdpublic Content update(Content updatedContent) throws ServiceException
ContentService
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.
update
in interface ContentService
updatedContent
- the updated Content
ServiceException
public void delete(Content content) throws ServiceException
ContentService
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.
delete
in interface ContentService
content
- the content to removeServiceException
- if the content cannot be found, or cannot be deletedpublic ContentServiceImpl.ValidatorImpl validator()
ContentService
validator
in interface ContentService
public Content buildContent(ContentEntityObject entity, List<ContentStatus> statuses, Expansion... expansions)
public void setPermissionManager(PermissionManager permissionManager)
Copyright © 2003–2018 Atlassian. All rights reserved.