Interface ContentService
- All Known Implementing Classes:
ContentServiceImpl
public interface ContentService
-
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> types, 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.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 pathbooleanshallowContentExists(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
-
Method Details
-
contentExists
Check the existent of a content path- Parameters:
siteId- site identifierpath- content path- Returns:
- true if the content exists, false otherwise
- Throws:
SiteNotFoundException
-
shallowContentExists
This 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.- Returns:
- true if site has content object at path
- Throws:
SiteNotFoundException
-
getQuickCreatableContentTypes
Get list of content types marked as quick creatable for given site- Parameters:
siteId- site id to use- Returns:
- list of content types
- Throws:
SiteNotFoundException
-
getChildItems
Get child items for given path. Child item is - belongs to item subtree - is item specific dependency- Parameters:
siteId- site identifierpath- path to get child items for- Returns:
- list of paths of child items
-
getChildItems
Get child items for given paths. Child item is - belongs to item subtree - is item specific dependency- Parameters:
siteId- site identifierpaths- list of paths to get child items for- Returns:
- list of paths of child items
- Throws:
SiteNotFoundException
-
deleteContent
boolean deleteContent(String siteId, String path, String submissionComment) throws ServiceLayerException, AuthenticationException, DeploymentException, UserNotFoundException Delete content for given path. Following content will be deleted: - given path - child items for given path- 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
boolean deleteContent(String siteId, List<String> paths, String submissionComment) throws ServiceLayerException, AuthenticationException, DeploymentException, UserNotFoundException Delete content for given paths. Following content will be deleted: - given paths - child items for given paths- 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
GetChildrenResult getChildrenByPath(String siteId, String path, String locale, String keyword, List<String> types, List<String> excludes, String sortStrategy, String order, int offset, int limit) throws ServiceLayerException, UserNotFoundException Get list of children for given path- Parameters:
siteId- site identifierpath- item path to children forlocale- filter children by localekeyword- filter children by keywordtypes- 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
GetChildrenByPathsBulkResult getChildrenByPaths(String siteId, List<String> paths, Map<String, GetChildrenBulkRequest.PathParams> pathParams) throws ServiceLayerException, UserNotFoundExceptionGet children for paths bulk. This method will return children for a list of paths. Result items will also include aSandboxItemobject for the item itself.- 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
org.craftercms.core.service.Item getItem(String siteId, String path, boolean flatten) throws SiteNotFoundException, ContentNotFoundException -
getItemDescriptor
org.dom4j.Document getItemDescriptor(String siteId, String path, boolean flatten) throws SiteNotFoundException, ContentNotFoundException -
getItemByPath
DetailedItem getItemByPath(String siteId, String path, boolean preferContent) throws ServiceLayerException, UserNotFoundException Get detailed item for given path- Parameters:
siteId- site identifierpath- item pathpreferContent- if true return content item if available- Returns:
- detailed item
- Throws:
ServiceLayerExceptionUserNotFoundException
-
getSandboxItemsByPath
List<SandboxItem> getSandboxItemsByPath(String siteId, List<String> paths, boolean preferContent) throws ServiceLayerException, UserNotFoundException Get sandbox items for given list of paths- 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
Lock item by path for given site- Parameters:
siteId- site identifierpath- path to lock- Throws:
UserNotFoundExceptionServiceLayerException
-
unlockContent
void unlockContent(String siteId, String path) throws ContentNotFoundException, ContentAlreadyUnlockedException, SiteNotFoundException Unlock item by path for given site- Parameters:
siteId- site identifierpath- item path- Throws:
ContentNotFoundExceptionContentAlreadyUnlockedExceptionSiteNotFoundException
-
getContentByCommitId
Optional<org.springframework.core.io.Resource> getContentByCommitId(String siteId, String path, String commitId) throws ContentNotFoundException Get content for commit id- Parameters:
siteId- site identifierpath- path of the contentcommitId- commit id of the content version- Returns:
- the content if available
- Throws:
ContentNotFoundException
-
renameContent
boolean renameContent(String site, String path, String name) throws ServiceLayerException, UserNotFoundException, org.craftercms.commons.validation.ValidationException Rename content for given path- 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
org.springframework.core.io.Resource getContentAsResource(String site, String path) throws ContentNotFoundException Returns content wrapped as aResourceinstance- 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
Get the version history for a given content item.- Parameters:
siteId- the site idpath- the content path- Returns:
- the list of versions
- Throws:
ServiceLayerException- if an error occurs while create the list ofItemVersions
-