Class ContentServiceInternalImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.content.internal.ContentServiceInternalImpl
- All Implemented Interfaces:
ContentServiceInternal
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
contentExists
(String siteId, String path) Check the existent of a content pathgetChildrenByPath
(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.Optional
<org.springframework.core.io.Resource> getContentByCommitId
(String siteId, String path, String commitId) Get content for commit idlong
getContentSize
(String siteId, String path) Get content sizegetContentVersionHistory
(String siteId, String path) Get the version history for a given content item.org.craftercms.core.service.Item
getItemByPath
(String siteId, String path, boolean preferContent) Get detailed for given pathgetItemsByStates
(String siteId, long statesBitMap, List<String> systemTypes, List<org.craftercms.commons.rest.parameters.SortField> sortFields, int offset, int limit) Get a list of items by state and system types.getSandboxItemsById
(String siteId, List<Long> ids, List<org.craftercms.commons.rest.parameters.SortField> sortFields, boolean preferContent) Get sandbox items for given list of pathsgetSandboxItemsByPath
(String siteId, Collection<String> paths, boolean preferContent) Get sandbox items for given list of pathsgetSubtreeItems
(String siteId, String path) Get subtree items for given path.getSubtreeItems
(String siteId, List<String> paths) Get subtree items for given paths.boolean
isEditable
(String itemPath, String mimeType) Check if item is editablevoid
itemLockByPath
(String siteId, String path) Lock item by path for given sitevoid
itemUnlockByPath
(String siteId, String path) Unlock item by path for given sitevoid
setAuditServiceInternal
(AuditServiceInternal auditServiceInternal) void
setContentRepository
(ContentRepository contentRepository) void
setItemDao
(ItemDAO itemDao) void
setSecurityService
(SecurityService securityService) void
setSemanticsAvailableActionsResolver
(SemanticsAvailableActionsResolver semanticsAvailableActionsResolver) void
setServicesConfig
(ServicesConfig servicesConfig) void
setSiteFeedMapper
(SiteFeedMapper siteFeedMapper) void
setStudioConfiguration
(StudioConfiguration studioConfiguration) boolean
shallowContentExists
(String siteId, String path) This is a faster, but less accurate, version of contentExists.
-
Constructor Details
-
ContentServiceInternalImpl
public ContentServiceInternalImpl()
-
-
Method Details
-
contentExists
Description copied from interface:ContentServiceInternal
Check the existent of a content path- Specified by:
contentExists
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- content path- Returns:
- true if the content exists, false otherwise
-
shallowContentExists
Description copied from interface:ContentServiceInternal
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.- Specified by:
shallowContentExists
in interfaceContentServiceInternal
- Returns:
- true if site has content object at path
-
getSubtreeItems
Description copied from interface:ContentServiceInternal
Get subtree items for given path.- Specified by:
getSubtreeItems
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- path to get subtree items for- Returns:
- list of paths of subtree items
-
getSubtreeItems
Description copied from interface:ContentServiceInternal
Get subtree items for given paths.- Specified by:
getSubtreeItems
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpaths
- list of paths to get subtree items for- Returns:
- list of paths of subtree items
-
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:ContentServiceInternal
Get list of children for given path- Specified by:
getChildrenByPath
in interfaceContentServiceInternal
- 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:
ServiceLayerException
UserNotFoundException
-
getChildrenByPaths
public GetChildrenByPathsBulkResult getChildrenByPaths(String siteId, List<String> paths, Map<String, GetChildrenBulkRequest.PathParams> pathParams) throws UserNotFoundException, ServiceLayerExceptionDescription copied from interface:ContentServiceInternal
Get children for paths bulk. This method will return children for a list of paths. Result items will also include aSandboxItem
object for the item itself.- Specified by:
getChildrenByPaths
in interfaceContentServiceInternal
- 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:
UserNotFoundException
- user not found (when calculating available actions)ServiceLayerException
- general service error
-
getItem
- Specified by:
getItem
in interfaceContentServiceInternal
-
getContentSize
Description copied from interface:ContentServiceInternal
Get content size- Specified by:
getContentSize
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- content path- Returns:
- size in bytes
-
getItemsByStates
public List<DetailedItem> getItemsByStates(String siteId, long statesBitMap, List<String> systemTypes, List<org.craftercms.commons.rest.parameters.SortField> sortFields, int offset, int limit) throws UserNotFoundException, ServiceLayerException Description copied from interface:ContentServiceInternal
Get a list of items by state and system types.- Specified by:
getItemsByStates
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierstatesBitMap
- mask of the states to filter bysystemTypes
- list of system types to filter bysortFields
- list of sort fieldsoffset
- number of items to skiplimit
- number of items to return- Returns:
- list of items
- Throws:
UserNotFoundException
ServiceLayerException
-
getItemByPath
public DetailedItem getItemByPath(String siteId, String path, boolean preferContent) throws ServiceLayerException, UserNotFoundException Description copied from interface:ContentServiceInternal
Get detailed for given path- Specified by:
getItemByPath
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- item for pathpreferContent
- if true return content item if available- Returns:
- detailed item
- Throws:
ServiceLayerException
UserNotFoundException
-
getSandboxItemsByPath
public List<SandboxItem> getSandboxItemsByPath(String siteId, Collection<String> paths, boolean preferContent) throws ServiceLayerException, UserNotFoundException Description copied from interface:ContentServiceInternal
Get sandbox items for given list of paths- Specified by:
getSandboxItemsByPath
in interfaceContentServiceInternal
- 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
-
getSandboxItemsById
public List<SandboxItem> getSandboxItemsById(String siteId, List<Long> ids, List<org.craftercms.commons.rest.parameters.SortField> sortFields, boolean preferContent) throws ServiceLayerException, UserNotFoundException Description copied from interface:ContentServiceInternal
Get sandbox items for given list of paths- Specified by:
getSandboxItemsById
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierids
- list of ids to get sandbox itemssortFields
-preferContent
- if true return content items if available- Returns:
- list of sandbox items
- Throws:
ServiceLayerException
UserNotFoundException
-
isEditable
Description copied from interface:ContentServiceInternal
Check if item is editable- Specified by:
isEditable
in interfaceContentServiceInternal
- Parameters:
itemPath
- item pathmimeType
- item mime type- Returns:
- true if item is editable
-
itemLockByPath
Description copied from interface:ContentServiceInternal
Lock item by path for given site- Specified by:
itemLockByPath
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- item path to lock
-
itemUnlockByPath
Description copied from interface:ContentServiceInternal
Unlock item by path for given site- Specified by:
itemUnlockByPath
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- item path
-
getContentByCommitId
public Optional<org.springframework.core.io.Resource> getContentByCommitId(String siteId, String path, String commitId) throws ContentNotFoundException Description copied from interface:ContentServiceInternal
Get content for commit id- Specified by:
getContentByCommitId
in interfaceContentServiceInternal
- Parameters:
siteId
- site identifierpath
- path of the contentcommitId
- commit id of the content version- Returns:
- the resource if available
- Throws:
ContentNotFoundException
-
getContentVersionHistory
public List<ItemVersion> getContentVersionHistory(String siteId, String path) throws ServiceLayerException Description copied from interface:ContentServiceInternal
Get the version history for a given content item.- Specified by:
getContentVersionHistory
in interfaceContentServiceInternal
- Parameters:
siteId
- the site idpath
- the content path- Returns:
- the list of versions
- Throws:
ServiceLayerException
- if an error occurs while create the list ofItemVersion
s
-
setContentRepository
-
setItemDao
-
setServicesConfig
-
setSiteFeedMapper
-
setSecurityService
-
setStudioConfiguration
-
setSemanticsAvailableActionsResolver
public void setSemanticsAvailableActionsResolver(SemanticsAvailableActionsResolver semanticsAvailableActionsResolver) -
setAuditServiceInternal
-