Class ContentServiceImpl
- java.lang.Object
-
- com.atlassian.confluence.api.impl.service.content.ContentServiceImpl
-
- All Implemented Interfaces:
ContentService
public class ContentServiceImpl extends Object implements ContentService
Server implementation of theContentService
. Contrast with the RemoteContentService.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ContentServiceImpl.ValidatorImpl
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.api.service.content.ContentService
ContentService.ContentFetcher, ContentService.ContentFinder, ContentService.ParameterContentFinder, ContentService.SingleContentFetcher, ContentService.Validator
-
-
Field Summary
-
Fields inherited from interface com.atlassian.confluence.api.service.content.ContentService
DEFAULT_EXPANSIONS
-
-
Constructor Summary
Constructors Constructor Description ContentServiceImpl(PermissionManager permissionManager, ContentFactory contentFactory, ContentFinderFactory contentFinderFactory, ContentTrashService trashService, ApiSupportProvider apiSupportProvider, ContentEntityManagerInternal contentEntityManager, UserChecker userChecker, com.google.common.base.Supplier<TouchRelationSupport> touchRelationSupportSupplier, com.atlassian.event.api.EventPublisher eventPublisher, LicenseService licenseService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
ContentServiceImpl
public ContentServiceImpl(PermissionManager permissionManager, ContentFactory contentFactory, ContentFinderFactory contentFinderFactory, ContentTrashService trashService, ApiSupportProvider apiSupportProvider, ContentEntityManagerInternal contentEntityManager, UserChecker userChecker, com.google.common.base.Supplier<TouchRelationSupport> touchRelationSupportSupplier, com.atlassian.event.api.EventPublisher eventPublisher, LicenseService licenseService)
-
-
Method Detail
-
find
public ContentService.ContentFinder find(Expansion... expansions)
Description copied from interface:ContentService
Create a ContentFinder for locating content, the expansions will be applied to each piece of content that matches the finder. Content will be retrieved by using the fetch methods on the returned ContentFinder.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);
- Specified by:
find
in interfaceContentService
- Returns:
-
create
public Content create(Content newContent) throws ServiceException
Description copied from interface:ContentService
Create a piece of content.Valid
ContentRepresentation
s for theContentBody
can be found in the documentation on theContentBodyConversionService
.- Specified by:
create
in interfaceContentService
- Parameters:
newContent
- the content to create- Returns:
- the content created
- Throws:
ServiceException
- if the content cannot be created
-
create
public Content create(Content newContent, Expansion... expansions) throws ServiceException
Description copied from interface:ContentService
Create a piece of content.Valid
ContentRepresentation
s for theContentBody
can be found in the documentation on theContentBodyConversionService
.- Specified by:
create
in interfaceContentService
- Parameters:
newContent
- the content to createexpansions
- the particular expansions will be applied to the new created content- Returns:
- the content created
- Throws:
ServiceException
- if the content cannot be created
-
update
public Content update(Content updatedContent) throws ServiceException
Description copied from interface:ContentService
Updates a piece of content.Valid
ContentRepresentation
s for theContentBody
can be found in the documentation on theContentBodyConversionService
.Content with an existing status of
ContentStatus.TRASHED
that is updated to have statusContentStatus.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.- Specified by:
update
in interfaceContentService
- Parameters:
updatedContent
- the updatedContent
- Returns:
- the updated content after being persisted
- Throws:
ServiceException
-
delete
public void delete(Content content) throws ServiceException
Description copied from interface:ContentService
Removes a piece of Content from the system.The way that this method behaves depends on whether the Content being deleted supports trashing, and its current status:
-
Trashable content currently includes Pages and Blogpost, which can have two statuses relevant here:
current
, in which case calling this method will trash the contenttrashed
, in which case calling this method will fail. Clients should useContentTrashService.purge(Content)
to permanently delete trashed content.
-
Non-trashable content (e.g. Comments, Attachments) will be immediately and permanently purged from the
system, without being updated to have
trashed
status.
The methods
ContentTrashService.trash(Content)
andContentTrashService.purge(Content)
can be used for content that is known to support trashing.- Specified by:
delete
in interfaceContentService
- Parameters:
content
- the content to remove- Throws:
ServiceException
- if the content cannot be found, or cannot be deleted
-
Trashable content currently includes Pages and Blogpost, which can have two statuses relevant here:
-
validator
public ContentServiceImpl.ValidatorImpl validator()
Description copied from interface:ContentService
Get the validator view of the ContentService.- Specified by:
validator
in interfaceContentService
- Returns:
- a Validator that can be used to validate service requests.
-
buildContent
public Content buildContent(ContentEntityObject entity, List<ContentStatus> statuses, Expansion... expansions)
-
setPermissionManager
public void setPermissionManager(PermissionManager permissionManager)
-
-