Class ContentServiceImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.content.ContentServiceImpl
- All Implemented Interfaces:
ContentService,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class ContentServiceImpl
extends Object
implements ContentService, org.springframework.context.ApplicationContextAware
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontentExists(String siteId, String path) Check the existent of a content pathbooleandeleteContent(String siteId, String path, String submissionComment) Delete content for given path.booleandeleteContent(String siteId, List<String> paths, String submissionComment) Delete content for given paths.getChildItems(String siteId, String path) Get child items for given path.getChildItems(String siteId, List<String> paths) Get child items for given paths.getChildrenByPath(String siteId, String path, String locale, String keyword, List<String> systemTypes, List<String> excludes, String sortStrategy, String order, int offset, int limit) Get list of children for given pathgetChildrenByPaths(String siteId, List<String> paths, Map<String, GetChildrenBulkRequest.PathParams> pathParams) Get children for paths bulk.@Valid org.springframework.core.io.ResourcegetContentAsResource(String site, String path) Returns content wrapped as aResourceinstanceOptional<org.springframework.core.io.Resource> getContentByCommitId(String siteId, String path, String commitId) Get content for commit idgetContentVersionHistory(String siteId, String path) Get the version history for a given content item.org.craftercms.core.service.ItemgetItemByPath(String siteId, String path, boolean preferContent) Get detailed item for given pathorg.dom4j.DocumentgetItemDescriptor(String siteId, String path, boolean flatten) getQuickCreatableContentTypes(String siteId) Get list of content types marked as quick creatable for given sitegetSandboxItemsByPath(String siteId, List<String> paths, boolean preferContent) Get sandbox items for given list of pathsvoidlockContent(String siteId, String path) Lock item by path for given sitebooleanrenameContent(String site, String path, String name) Rename content for given pathvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetAuditServiceInternal(AuditServiceInternal auditServiceInternal) voidsetContentServiceInternal(ContentServiceInternal contentServiceInternal) voidsetContentServiceV1(ContentService contentService) voidsetContentTypeServiceInternal(ContentTypeServiceInternal contentTypeServiceInternal) voidsetDependencyServiceInternal(DependencyServiceInternal dependencyServiceInternal) voidsetDeploymentService(DeploymentService deploymentService) voidsetGeneralLockService(GeneralLockService generalLockService) voidsetItemServiceInternal(ItemServiceInternal itemServiceInternal) voidsetSecurityService(SecurityService securityService) voidsetSiteService(SiteService siteService) voidsetUserServiceInternal(UserServiceInternal userServiceInternal) booleanshallowContentExists(String site, String path) This is a faster, but less accurate, version of contentExists.voidunlockContent(String siteId, String path) Unlock item by path for given site
-
Constructor Details
-
ContentServiceImpl
public ContentServiceImpl()
-
-
Method Details
-
contentExists
Description copied from interface:ContentServiceCheck the existent of a content path- Specified by:
contentExistsin interfaceContentService- Parameters:
siteId- site identifierpath- content path- Returns:
- true if the content exists, false otherwise
- Throws:
SiteNotFoundException
-
shallowContentExists
Description copied from interface:ContentServiceThis is a faster, but less accurate, version of contentExists. This prioritizes performance over checking the actual underlying repository if the content is actually in the store or we simply hold a reference to the object in the actual store.- Specified by:
shallowContentExistsin interfaceContentService- Returns:
- true if site has content object at path
- Throws:
SiteNotFoundException
-
getQuickCreatableContentTypes
public List<QuickCreateItem> getQuickCreatableContentTypes(String siteId) throws SiteNotFoundException Description copied from interface:ContentServiceGet list of content types marked as quick creatable for given site- Specified by:
getQuickCreatableContentTypesin interfaceContentService- Parameters:
siteId- site id to use- Returns:
- list of content types
- Throws:
SiteNotFoundException
-
getChildItems
Description copied from interface:ContentServiceGet child items for given path. Child item is - belongs to item subtree - is item specific dependency- Specified by:
getChildItemsin interfaceContentService- Parameters:
siteId- site identifierpath- path to get child items for- Returns:
- list of paths of child items
-
getChildItems
Description copied from interface:ContentServiceGet child items for given paths. Child item is - belongs to item subtree - is item specific dependency- Specified by:
getChildItemsin interfaceContentService- Parameters:
siteId- site identifierpaths- list of paths to get child items for- Returns:
- list of paths of child items
- Throws:
SiteNotFoundException
-
deleteContent
public boolean deleteContent(String siteId, String path, String submissionComment) throws ServiceLayerException, AuthenticationException, DeploymentException, UserNotFoundException Description copied from interface:ContentServiceDelete content for given path. Following content will be deleted: - given path - child items for given path- Specified by:
deleteContentin interfaceContentService- Parameters:
siteId- site identifierpath- content to be deletedsubmissionComment- submission comment- Returns:
- true if success, otherwise false
- Throws:
ServiceLayerException- general service errorAuthenticationException- authentication errorDeploymentException- deployment error caused by deleteUserNotFoundException
-
deleteContent
public boolean deleteContent(String siteId, List<String> paths, String submissionComment) throws ServiceLayerException, AuthenticationException, DeploymentException, UserNotFoundException Description copied from interface:ContentServiceDelete content for given paths. Following content will be deleted: - given paths - child items for given paths- Specified by:
deleteContentin interfaceContentService- Parameters:
siteId- site identifierpaths- content to be deletedsubmissionComment- submission comment- Returns:
- true if success, otherwise false
- Throws:
ServiceLayerException- general service errorAuthenticationException- authentication errorDeploymentException- deployment error caused by deleteUserNotFoundException
-
getChildrenByPath
public GetChildrenResult getChildrenByPath(String siteId, String path, String locale, String keyword, List<String> systemTypes, List<String> excludes, String sortStrategy, String order, int offset, int limit) throws ServiceLayerException, UserNotFoundException Description copied from interface:ContentServiceGet list of children for given path- Specified by:
getChildrenByPathin interfaceContentService- Parameters:
siteId- site identifierpath- item path to children forlocale- filter children by localekeyword- filter children by keywordsystemTypes- filter children by typeexcludes- exclude items by pathsortStrategy- sort orderorder- ascending or descendingoffset- offset of the first child in the resultlimit- number of children to return- Returns:
- list of children
- Throws:
ServiceLayerExceptionUserNotFoundException
-
getChildrenByPaths
public GetChildrenByPathsBulkResult getChildrenByPaths(String siteId, List<String> paths, Map<String, GetChildrenBulkRequest.PathParams> pathParams) throws ServiceLayerException, UserNotFoundExceptionDescription copied from interface:ContentServiceGet children for paths bulk. This method will return children for a list of paths. Result items will also include aSandboxItemobject for the item itself.- Specified by:
getChildrenByPathsin interfaceContentService- Parameters:
siteId- the site idpaths- paths to get children for. Notice that this parameter is redundant with the pathParams. This list of paths is used to validate permissions.pathParams- Map of extra parameters for each path- Returns:
- object containing a list of
GetChildrenByPathsBulkResult.ChildrenByPathResult - Throws:
ServiceLayerException- general service errorUserNotFoundException- user not found (when calculating available actions)
-
getItem
public org.craftercms.core.service.Item getItem(String siteId, String path, boolean flatten) throws SiteNotFoundException, ContentNotFoundException - Specified by:
getItemin interfaceContentService- Throws:
SiteNotFoundExceptionContentNotFoundException
-
getItemDescriptor
public org.dom4j.Document getItemDescriptor(String siteId, String path, boolean flatten) throws SiteNotFoundException, ContentNotFoundException - Specified by:
getItemDescriptorin interfaceContentService- Throws:
SiteNotFoundExceptionContentNotFoundException
-
getItemByPath
public DetailedItem getItemByPath(String siteId, String path, boolean preferContent) throws ServiceLayerException, UserNotFoundException Description copied from interface:ContentServiceGet detailed item for given path- Specified by:
getItemByPathin interfaceContentService- Parameters:
siteId- site identifierpath- item pathpreferContent- if true return content item if available- Returns:
- detailed item
- Throws:
ServiceLayerExceptionUserNotFoundException
-
getSandboxItemsByPath
public List<SandboxItem> getSandboxItemsByPath(String siteId, List<String> paths, boolean preferContent) throws ServiceLayerException, UserNotFoundException Description copied from interface:ContentServiceGet sandbox items for given list of paths- Specified by:
getSandboxItemsByPathin interfaceContentService- Parameters:
siteId- site identifierpaths- list of paths to get sandbox itemspreferContent- if true return content items if available- Returns:
- list of sandbox items
- Throws:
ServiceLayerExceptionUserNotFoundException
-
lockContent
public void lockContent(String siteId, String path) throws UserNotFoundException, ServiceLayerException Description copied from interface:ContentServiceLock item by path for given site- Specified by:
lockContentin interfaceContentService- Parameters:
siteId- site identifierpath- path to lock- Throws:
UserNotFoundExceptionServiceLayerException
-
unlockContent
public void unlockContent(String siteId, String path) throws ContentNotFoundException, ContentAlreadyUnlockedException, SiteNotFoundException Description copied from interface:ContentServiceUnlock item by path for given site- Specified by:
unlockContentin interfaceContentService- Parameters:
siteId- site identifierpath- item path- Throws:
ContentNotFoundExceptionContentAlreadyUnlockedExceptionSiteNotFoundException
-
getContentByCommitId
public Optional<org.springframework.core.io.Resource> getContentByCommitId(String siteId, String path, String commitId) throws ContentNotFoundException Description copied from interface:ContentServiceGet content for commit id- Specified by:
getContentByCommitIdin interfaceContentService- Parameters:
siteId- site identifierpath- path of the contentcommitId- commit id of the content version- Returns:
- the content if available
- Throws:
ContentNotFoundException
-
renameContent
public boolean renameContent(String site, String path, String name) throws ServiceLayerException, UserNotFoundException, org.craftercms.commons.validation.ValidationException Description copied from interface:ContentServiceRename content for given path- Specified by:
renameContentin interfaceContentService- Parameters:
site- site identifierpath- path of the contentname- new name of the content- Returns:
- true if success, otherwise false
- Throws:
ServiceLayerException- general service errorUserNotFoundException- user not found errororg.craftercms.commons.validation.ValidationException
-
getContentAsResource
@Valid public @Valid org.springframework.core.io.Resource getContentAsResource(String site, String path) throws ContentNotFoundException Description copied from interface:ContentServiceReturns content wrapped as aResourceinstance- Specified by:
getContentAsResourcein interfaceContentService- Parameters:
site- the site idpath- the path of the content- Returns:
- the resource object
- Throws:
ContentNotFoundException- if there is no content at the given path
-
getContentVersionHistory
public List<ItemVersion> getContentVersionHistory(String siteId, String path) throws ServiceLayerException Description copied from interface:ContentServiceGet the version history for a given content item.- Specified by:
getContentVersionHistoryin interfaceContentService- Parameters:
siteId- the site idpath- the content path- Returns:
- the list of versions
- Throws:
ServiceLayerException- if an error occurs while create the list ofItemVersions
-
setApplicationContext
public void setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
setContentServiceInternal
-
setContentTypeServiceInternal
-
setDependencyServiceInternal
-
setDeploymentService
-
setUserServiceInternal
-
setSiteService
-
setAuditServiceInternal
-
setItemServiceInternal
-
setSecurityService
-
setGeneralLockService
-
setContentServiceV1
-