Interface ContentService
-
- All Known Implementing Classes:
ContentServiceImpl
public interface ContentService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
deleteContent(String siteId, String path, String submissionComment)
Delete content for given path.boolean
deleteContent(String siteId, List<String> paths, String submissionComment)
Delete content for given paths.List<String>
getChildItems(String siteId, String path)
Get child items for given path.List<String>
getChildItems(String siteId, List<String> paths)
Get child items for given paths.GetChildrenResult
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 pathorg.springframework.core.io.Resource
getContentAsResource(String site, String path)
Returns content wrapped as aResource
instanceOptional<org.springframework.core.io.Resource>
getContentByCommitId(String siteId, String path, String commitId)
Get content for commit idorg.craftercms.core.service.Item
getItem(String siteId, String path, boolean flatten)
DetailedItem
getItemByPath(String siteId, String path, boolean preferContent)
Get detailed item for given pathorg.dom4j.Document
getItemDescriptor(String siteId, String path, boolean flatten)
List<QuickCreateItem>
getQuickCreatableContentTypes(String siteId)
Get list of content types marked as quick creatable for given siteList<SandboxItem>
getSandboxItemsByPath(String siteId, List<String> paths, boolean preferContent)
Get sandbox items for given list of pathsvoid
lockContent(String siteId, String path)
Lock item by path for given siteboolean
renameContent(String site, String path, String name)
Rename content for given pathvoid
unlockContent(String siteId, String path)
Unlock item by path for given site
-
-
-
Method Detail
-
getQuickCreatableContentTypes
List<QuickCreateItem> getQuickCreatableContentTypes(String siteId) throws SiteNotFoundException
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
List<String> getChildItems(String siteId, String path)
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
List<String> getChildItems(String siteId, List<String> paths) throws SiteNotFoundException
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:
ServiceLayerException
UserNotFoundException
-
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:
ServiceLayerException
UserNotFoundException
-
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:
ServiceLayerException
UserNotFoundException
-
lockContent
void lockContent(String siteId, String path) throws UserNotFoundException, ServiceLayerException
Lock item by path for given site- Parameters:
siteId
- site identifierpath
- path to lock- Throws:
UserNotFoundException
ServiceLayerException
-
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:
ContentNotFoundException
ContentAlreadyUnlockedException
SiteNotFoundException
-
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
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 error
-
getContentAsResource
org.springframework.core.io.Resource getContentAsResource(String site, String path) throws ContentNotFoundException
Returns content wrapped as aResource
instance- 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
-
-