Class ContentServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v1.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
Content Services that other services may use- Author:
- russdanner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ContentServiceImpl.PastedPathMap
Simple Object to hold result of calculating target paths for copy/cut and paste operation.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ContentServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDependenciesToDelete(String site, String sourceContentPath, GoLiveDeleteCandidates candidates)
protected void
addOrderValue(List<DmOrderTO> orders, String orderName, String orderStr)
add order value to the list of ordersprotected void
addRemovedDependenciesToDelete(String site, String relativePath, GoLiveDeleteCandidates candidates)
void
checkContentExists(String site, String path)
Checks if a content exists at a given path and throw an exception if it does not.void
checkWriteAssetPath(String path)
Check if path is a correct location to write asset contentprotected void
childDeleteItems(String site, ContentItemTO contentItem, GoLiveDeleteCandidates items)
Iterate over all paths inside the folderprotected double
computeReorder(String site, String relativePath, DmOrderTO beforeOrderTO, DmOrderTO afterOrderTO, String orderName)
Will need to include the floating pages as well for orderValue computation Since the beforeOrder and afterOrder in the UI does not include floating pages will need to do special processingprotected ContentServiceImpl.PastedPathMap
constructNewPathForCutCopy(String site, String fromPath, String toPath, boolean adjustOnCollide)
@javax.validation.Valid boolean
contentExists(String site, String path)
Check if content exists@Valid String
copyContent(String site, String fromPath, String toPath)
copy content fromPath to toPathprotected String
copyContent(String site, String fromPath, String toPath, Set<String> processedPaths)
internal method copy that handles Get dependencies is already recursive@Valid ContentItemTO
createDummyDmContentItemForDeletedNode(String site, String relativePath)
@javax.validation.Valid boolean
createFolder(String site, String path, String name)
create a folderprotected ContentItemTO
createNewContentItemTO(String site, String contentPath)
@javax.validation.Valid boolean
deleteContent(String site, String path, boolean generateActivity, String approver)
@javax.validation.Valid boolean
deleteContent(String site, String path, String approver)
delete content at the pathprotected List<String>
filterDependenciesMatchingDeletePattern(String site, String sourcePath, List<String> dependencies)
protected void
generateDeleteActivity(String site, String path, String approver)
protected static String
getBrowserUri(String uri, String replacePattern, boolean isPage)
protected String
getBrowserUri(ContentItemTO item)
@Valid InputStream
getContent(String site, String path)
get document from wcm content@Valid org.dom4j.Document
getContentAsDocument(String site, String path)
get document from wcm content@Valid org.springframework.core.io.Resource
getContentAsResource(String site, String path)
Returns content wrapped as aResource
instance@Valid String
getContentAsString(String site, String path)
get content as string from repository@Valid String
getContentAsString(String site, String path, String encoding)
get content as string from repositoryprotected Map<String,String>
getContentIds(org.dom4j.Document document)
Return the values for PageID and GroupID provided a Document@Valid ContentItemTO
getContentItem(String site, String path)
get the content item (metadata) at a specific path@Valid ContentItemTO
getContentItem(String site, String path, int depth)
get the content item (metadata) at a specific path@Valid ContentItemTO
getContentItemTree(String site, String path, int depth)
get the tree of content items (metadata) beginning at a root@Valid VersionTO[]
getContentItemVersionHistory(String site, String path)
get the version history for an item@javax.validation.Valid long
getContentSize(String site, String path)
get file size@Valid String
getContentTypeClass(String site, String uri)
@Valid Optional<org.springframework.core.io.Resource>
getContentVersion(String site, String path, String commitId)
return the content for a given version@Valid String
getContentVersionAsString(String site, String path, String version)
return the content for a given version@Valid GoLiveDeleteCandidates
getDeleteCandidates(String site, String relativePath)
protected List<DeleteDependencyConfigTO>
getDeletePatternConfig(String site, String relativePath)
String
getItemContentType(String site, String path)
Retrieves the content type for a given path@Valid List<DmOrderTO>
getItemOrders(String site, String path)
protected List<DmOrderTO>
getItemOrders(List<org.dom4j.Node> nodes)
get WCM content item order metadataprotected Map<String,String>
getItemSpecificDependencies(String site, String path, org.dom4j.Document document, Map<String,String> copyDependencies)
@Valid String
getNextAvailableName(String site, String path)
get the next available of the given content name at the given path (used for paste/duplicate)protected List<String>
getRemovedDependencies(DependencyDiffService.DiffRequest diffRequest, boolean matchDeletePattern)
protected ContentItemTO
loadContentItem(String site, String path)
protected void
loadContentTypeProperties(String site, ContentItemTO item, String contentType)
void
lockContent(String site, String path)
protected boolean
matchesPatterns(String uri, List<String> patterns)
@Valid String
moveContent(String site, String fromPath, String toPath)
move content fromPath to toPathvoid
notifyContentEvent(String site, String path)
Notify when there is a content updateprotected ContentItemTO
populateContentDrivenProperties(String site, ContentItemTO item)
protected ContentItemTO
populateItemChildren(ContentItemTO item, int depth)
protected void
populateMetadata(String site, ContentItemTO item)
protected void
populateWorkflowProperties(String site, ContentItemTO item)
@Valid ResultTO
processContent(String id, InputStream input, boolean isXml, Map<String,String> params, String contentChainForm)
boolean
pullFromRemote(String siteId, String remoteName, String remoteBranch)
Pull from remote repositoryboolean
pushToRemote(String siteId, String remoteName, String remoteBranch)
Push content to remote repository@javax.validation.Valid boolean
renameContent(String site, String path, String name)
rename a content item@javax.validation.Valid double
reorderItems(String site, String relativePath, String before, String after, String orderName)
protected org.dom4j.Document
replaceCopyDependency(org.dom4j.Document document, String depPath, String copyDepPath)
@javax.validation.Valid boolean
revertContentItem(String site, String path, String version, boolean major, String comment)
revert a version (create a new version based on an old version)void
setActivityStreamServiceInternal(ActivityStreamServiceInternal activityStreamServiceInternal)
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setAuditServiceInternal(AuditServiceInternal auditServiceInternal)
void
setContentItemIdGenerator(ContentItemIdGenerator contentItemIdGenerator)
void
setContentProcessor(ProcessContentExecutor contentProcessor)
void
setContentRepository(ContentRepository contentRepository)
void
setContentRepositoryV2(ContentRepository contentRepository)
void
setContentServiceV2(ContentService contentServiceV2)
void
setContentTypeService(ContentTypeService contentTypeService)
void
setDependencyDiffService(DependencyDiffService dependencyDiffService)
void
setDependencyService(DependencyService dependencyService)
void
setDmContentLifeCycleService(DmContentLifeCycleService dmContentLifeCycleService)
void
setDmPageNavigationOrderService(DmPageNavigationOrderService dmPageNavigationOrderService)
void
setEntitlementValidator(org.craftercms.commons.entitlements.validator.EntitlementValidator entitlementValidator)
void
setItemServiceInternal(ItemServiceInternal itemServiceInternal)
void
setSecurityService(SecurityService securityService)
void
setServicesConfig(ServicesConfig servicesConfig)
void
setSiteService(SiteService siteService)
void
setStudioConfiguration(StudioConfiguration studioConfiguration)
void
setUserServiceInternal(UserServiceInternal userServiceInternal)
void
setWorkflowServiceInternal(WorkflowServiceInternal workflowServiceInternal)
@javax.validation.Valid boolean
shallowContentExists(String site, String path)
This is a faster, but less accurate, version of contentExists.protected void
updateChildrenOnMove(String site, String fromPath, String movePath)
protected org.dom4j.Document
updateContentOnCopy(org.dom4j.Document document, String filename, String folder, Map<String,String> params, String modifier)
protected void
updateContentOnMove(org.dom4j.Element root, String filename, String folder, String modifier)
Updates the XML after a move operation.protected void
updateDatabaseOnMove(String site, String fromPath, String movePath)
protected void
updateDatabaseOnMove(String site, String fromPath, String movePath, Long parentId, String label, String folderLabel)
protected void
updateDependenciesOnMove(String site, String fromPath, String movePath)
@javax.validation.Valid boolean
writeContent(String site, String path, InputStream content)
write contentvoid
writeContent(String site, String path, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock)
write contentvoid
writeContent(String site, String path, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock, boolean skipAuditLogInsert)
write contentvoid
writeContentAndRename(String site, String path, String targetPath, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock, boolean createFolder)
@Valid Map<String,Object>
writeContentAsset(String site, String path, String assetName, InputStream in, String isImage, String allowedWidth, String allowedHeight, String allowLessSize, String draft, String unlock, String systemAsset)
write content asset
-
-
-
Field Detail
-
servicesConfig
protected ServicesConfig servicesConfig
-
dependencyService
protected DependencyService dependencyService
-
contentProcessor
protected ProcessContentExecutor contentProcessor
-
securityService
protected SecurityService securityService
-
dmPageNavigationOrderService
protected DmPageNavigationOrderService dmPageNavigationOrderService
-
dmContentLifeCycleService
protected DmContentLifeCycleService dmContentLifeCycleService
-
siteService
protected SiteService siteService
-
contentItemIdGenerator
protected ContentItemIdGenerator contentItemIdGenerator
-
studioConfiguration
protected StudioConfiguration studioConfiguration
-
dependencyDiffService
protected DependencyDiffService dependencyDiffService
-
contentTypeService
protected ContentTypeService contentTypeService
-
entitlementValidator
protected org.craftercms.commons.entitlements.validator.EntitlementValidator entitlementValidator
-
auditServiceInternal
protected AuditServiceInternal auditServiceInternal
-
itemServiceInternal
protected ItemServiceInternal itemServiceInternal
-
workflowServiceInternal
protected WorkflowServiceInternal workflowServiceInternal
-
userServiceInternal
protected UserServiceInternal userServiceInternal
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext
-
activityStreamServiceInternal
protected ActivityStreamServiceInternal activityStreamServiceInternal
-
contentServiceV2
protected ContentService contentServiceV2
-
COPY_FILE_PATTERN
public static final Pattern COPY_FILE_PATTERN
file and folder name patterns for copied files and folders
-
COPY_FOLDER_PATTERN
public static final Pattern COPY_FOLDER_PATTERN
-
COPY_FILE_MODIFIER_PATTERN
public static final Pattern COPY_FILE_MODIFIER_PATTERN
-
COPY_FILE_MODIFIER_FORMAT
public static final String COPY_FILE_MODIFIER_FORMAT
- See Also:
- Constant Field Values
-
INTERNAL_NAME_MODIFIER_PATTERN
public static final String INTERNAL_NAME_MODIFIER_PATTERN
- See Also:
- Constant Field Values
-
INTERNAL_NAME_MODIFIER_FORMAT
public static final String INTERNAL_NAME_MODIFIER_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
contentExists
@Valid public @javax.validation.Valid boolean contentExists(String site, String path)
Description copied from interface:ContentService
Check if content exists- Specified by:
contentExists
in interfaceContentService
- Parameters:
site
- site identifierpath
- path of the content- Returns:
- true if site has content object at path
-
checkContentExists
public void checkContentExists(String site, String path) throws ServiceLayerException
Description copied from interface:ContentService
Checks if a content exists at a given path and throw an exception if it does not.- Specified by:
checkContentExists
in interfaceContentService
- Parameters:
site
- id of the sitepath
- the content path- Throws:
ServiceLayerException
- if no content is found at the given path
-
shallowContentExists
@Valid public @javax.validation.Valid boolean shallowContentExists(String site, String path)
Description copied from interface:ContentService
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 interfaceContentService
- Returns:
- true if site has content object at path
-
getContent
@Valid public @Valid InputStream getContent(String site, String path) throws ContentNotFoundException
Description copied from interface:ContentService
get document from wcm content- Specified by:
getContent
in interfaceContentService
- Parameters:
site
- site identifierpath
- path of the content- Returns:
- document
- Throws:
ContentNotFoundException
-
getContentSize
@Valid public @javax.validation.Valid long getContentSize(String site, String path)
Description copied from interface:ContentService
get file size- Specified by:
getContentSize
in interfaceContentService
- Parameters:
site
- site id where the operation will be executedpath
- path to content- Returns:
- Size in bytes
-
getContentAsString
@Valid public @Valid String getContentAsString(String site, String path)
Description copied from interface:ContentService
get content as string from repository- Specified by:
getContentAsString
in interfaceContentService
- Parameters:
site
- site identifierpath
- path of the content- Returns:
- document
-
checkWriteAssetPath
@Valid public void checkWriteAssetPath(String path) throws ServiceLayerException
Description copied from interface:ContentService
Check if path is a correct location to write asset content- Specified by:
checkWriteAssetPath
in interfaceContentService
- Parameters:
path
- to write asset- Throws:
ServiceLayerException
- if path is not permitted
-
getContentAsString
@Valid public @Valid String getContentAsString(String site, String path, String encoding)
Description copied from interface:ContentService
get content as string from repository- Specified by:
getContentAsString
in interfaceContentService
- Parameters:
site
- site identifierpath
- path of the contentencoding
- file encoding- Returns:
- document
-
getContentAsDocument
@Valid public @Valid org.dom4j.Document getContentAsDocument(String site, String path) throws org.dom4j.DocumentException
Description copied from interface:ContentService
get document from wcm content- Specified by:
getContentAsDocument
in interfaceContentService
- Parameters:
site
- site identifierpath
- content path- Returns:
- document
- Throws:
org.dom4j.DocumentException
- XML document error
-
getContentAsResource
@Valid public @Valid org.springframework.core.io.Resource getContentAsResource(String site, String path) throws ContentNotFoundException
Description copied from interface:ContentService
Returns content wrapped as aResource
instance- Specified by:
getContentAsResource
in 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
-
writeContent
@Valid public void writeContent(String site, String path, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
write content- Specified by:
writeContent
in interfaceContentService
- Parameters:
site
- site identifierpath
- pathfileName
- file namecontentType
- content typeinput
- contentcreateFolders
- create missing folders in path?edit
- editunlock
- unlock the content upon edit?- Throws:
ServiceLayerException
- general service errorUserNotFoundException
-
writeContent
@Valid public void writeContent(String site, String path, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock, boolean skipAuditLogInsert) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
write content- Specified by:
writeContent
in interfaceContentService
- Parameters:
site
- site identifierpath
- pathfileName
- file namecontentType
- content typeinput
- contentcreateFolders
- create missing folders in path?edit
- editunlock
- unlock the content upon edit?skipAuditLogInsert
- if true do not insert audit log row, otherwise false- Throws:
ServiceLayerException
- general service errorUserNotFoundException
-
writeContentAndRename
@Valid public void writeContentAndRename(String site, String path, String targetPath, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock, boolean createFolder) throws ServiceLayerException
- Specified by:
writeContentAndRename
in interfaceContentService
- Throws:
ServiceLayerException
-
writeContentAsset
@Valid public @Valid Map<String,Object> writeContentAsset(String site, String path, String assetName, InputStream in, String isImage, String allowedWidth, String allowedHeight, String allowLessSize, String draft, String unlock, String systemAsset) throws ServiceLayerException
write content asset- Specified by:
writeContentAsset
in interfaceContentService
- Parameters:
site
-path
-assetName
-in
-isImage
- is this asset an image?allowedWidth
- specifies the allowed image width in pixel if the asset is an imageallowedHeight
- specifies the allowed image height in pixel if the asset is an imageunlock
- unlock the content upon edit?- Returns:
- content asset info
- Throws:
ServiceLayerException
-
writeContent
@Valid public @javax.validation.Valid boolean writeContent(String site, String path, InputStream content) throws ServiceLayerException
Description copied from interface:ContentService
write content- Specified by:
writeContent
in interfaceContentService
- Parameters:
site
- - the project IDpath
- path to contentcontent
- stream of content to write- Returns:
- return true if successful
- Throws:
ServiceLayerException
- general service error
-
notifyContentEvent
@Valid public void notifyContentEvent(String site, String path)
Notify when there is a content update- Specified by:
notifyContentEvent
in interfaceContentService
- Parameters:
site
- site namepath
- path name
-
createFolder
@Valid public @javax.validation.Valid boolean createFolder(String site, String path, String name) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
create a folder- Specified by:
createFolder
in interfaceContentService
- Parameters:
site
- - the project IDpath
- path to create a folder inname
- a folder name to create- Returns:
- return the reference to the folder created
- Throws:
SiteNotFoundException
- site not foundServiceLayerException
UserNotFoundException
-
deleteContent
@Valid public @javax.validation.Valid boolean deleteContent(String site, String path, String approver) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
delete content at the path- Specified by:
deleteContent
in interfaceContentService
- Parameters:
site
- - the project IDpath
- path to content- Returns:
- return true if successful
- Throws:
SiteNotFoundException
- site not foundServiceLayerException
UserNotFoundException
-
deleteContent
@Valid public @javax.validation.Valid boolean deleteContent(String site, String path, boolean generateActivity, String approver) throws ServiceLayerException, UserNotFoundException
- Specified by:
deleteContent
in interfaceContentService
- Throws:
ServiceLayerException
UserNotFoundException
-
generateDeleteActivity
protected void generateDeleteActivity(String site, String path, String approver) throws ServiceLayerException, UserNotFoundException
-
copyContent
@Valid public @Valid String copyContent(String site, String fromPath, String toPath) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
copy content fromPath to toPath- Specified by:
copyContent
in interfaceContentService
- Parameters:
site
- - the project IDfromPath
- the source pathtoPath
- the target path to copy content to- Returns:
- final path if successful, null otherwise
- Throws:
ServiceLayerException
UserNotFoundException
-
copyContent
protected String copyContent(String site, String fromPath, String toPath, Set<String> processedPaths) throws ServiceLayerException, UserNotFoundException
internal method copy that handles Get dependencies is already recursive
-
replaceCopyDependency
protected org.dom4j.Document replaceCopyDependency(org.dom4j.Document document, String depPath, String copyDepPath)
-
moveContent
@Valid public @Valid String moveContent(String site, String fromPath, String toPath)
Description copied from interface:ContentService
move content fromPath to toPath- Specified by:
moveContent
in interfaceContentService
- Parameters:
site
- - the project IDfromPath
- the source pathtoPath
- the target path to copy content to- Returns:
- final path if successful, null otherwise
-
updateDatabaseOnMove
protected void updateDatabaseOnMove(String site, String fromPath, String movePath) throws ServiceLayerException, UserNotFoundException
-
updateDatabaseOnMove
protected void updateDatabaseOnMove(String site, String fromPath, String movePath, Long parentId, String label, String folderLabel) throws ServiceLayerException, UserNotFoundException
-
updateDependenciesOnMove
protected void updateDependenciesOnMove(String site, String fromPath, String movePath)
-
updateChildrenOnMove
protected void updateChildrenOnMove(String site, String fromPath, String movePath) throws ServiceLayerException, UserNotFoundException
-
constructNewPathForCutCopy
protected ContentServiceImpl.PastedPathMap constructNewPathForCutCopy(String site, String fromPath, String toPath, boolean adjustOnCollide) throws ServiceLayerException
- Throws:
ServiceLayerException
-
getItemSpecificDependencies
protected Map<String,String> getItemSpecificDependencies(String site, String path, org.dom4j.Document document, Map<String,String> copyDependencies) throws ServiceLayerException
- Throws:
ServiceLayerException
-
getContentIds
protected Map<String,String> getContentIds(org.dom4j.Document document)
Return the values for PageID and GroupID provided a Document- Parameters:
document
- DOM to search- Returns:
- Map of IDs
-
updateContentOnMove
protected void updateContentOnMove(org.dom4j.Element root, String filename, String folder, String modifier)
Updates the XML after a move operation.- Parameters:
root
- root elementfilename
- new filenamefolder
- new foldermodifier
- numeric modifier used to update the internal-name. e.g.: for modifier 3, the internal-name will set to something like "Initial Name (Copy 3)"
-
updateContentOnCopy
protected org.dom4j.Document updateContentOnCopy(org.dom4j.Document document, String filename, String folder, Map<String,String> params, String modifier)
-
createNewContentItemTO
protected ContentItemTO createNewContentItemTO(String site, String contentPath)
-
populateContentDrivenProperties
protected ContentItemTO populateContentDrivenProperties(String site, ContentItemTO item) throws Exception
- Throws:
Exception
-
addOrderValue
protected void addOrderValue(List<DmOrderTO> orders, String orderName, String orderStr)
add order value to the list of orders- Parameters:
orders
-orderName
-orderStr
-
-
getItemOrders
protected List<DmOrderTO> getItemOrders(List<org.dom4j.Node> nodes)
get WCM content item order metadata- Parameters:
nodes
-- Returns:
- item orders metadata
-
populateItemChildren
protected ContentItemTO populateItemChildren(ContentItemTO item, int depth)
-
getContentItem
@Valid public @Valid ContentItemTO getContentItem(String site, String path)
Description copied from interface:ContentService
get the content item (metadata) at a specific path- Specified by:
getContentItem
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path of the content item- Returns:
- content item representation
-
getContentItem
@Valid public @Valid ContentItemTO getContentItem(String site, String path, int depth)
Description copied from interface:ContentService
get the content item (metadata) at a specific path- Specified by:
getContentItem
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path of the content itemdepth
- - depth to get desendents- Returns:
- content item representation
-
getItemContentType
public String getItemContentType(String site, String path) throws org.dom4j.DocumentException
Description copied from interface:ContentService
Retrieves the content type for a given path- Specified by:
getItemContentType
in interfaceContentService
- Parameters:
site
- the site idpath
- the content path- Returns:
- content type
- Throws:
org.dom4j.DocumentException
- on failure to retrieve the content type from xml (when applicable)
-
loadContentItem
protected ContentItemTO loadContentItem(String site, String path)
-
loadContentTypeProperties
protected void loadContentTypeProperties(String site, ContentItemTO item, String contentType)
-
populateWorkflowProperties
protected void populateWorkflowProperties(String site, ContentItemTO item)
-
populateMetadata
protected void populateMetadata(String site, ContentItemTO item) throws ServiceLayerException, UserNotFoundException
-
getContentItemTree
@Valid public @Valid ContentItemTO getContentItemTree(String site, String path, int depth)
Description copied from interface:ContentService
get the tree of content items (metadata) beginning at a root- Specified by:
getContentItemTree
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path to root at- Returns:
- content item with children tree
-
getContentItemVersionHistory
@Valid public @Valid VersionTO[] getContentItemVersionHistory(String site, String path)
Description copied from interface:ContentService
get the version history for an item- Specified by:
getContentItemVersionHistory
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path of the item- Returns:
- version history
-
revertContentItem
@Valid public @javax.validation.Valid boolean revertContentItem(String site, String path, String version, boolean major, String comment) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
revert a version (create a new version based on an old version)- Specified by:
revertContentItem
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path of the item to "revert"version
- - old version ID to base to version onmajor
- major versioncomment
- comment for revert action- Returns:
- true if success otherwise false
- Throws:
SiteNotFoundException
- site not foundServiceLayerException
UserNotFoundException
-
getContentVersion
@Valid public @Valid Optional<org.springframework.core.io.Resource> getContentVersion(String site, String path, String commitId) throws ContentNotFoundException
Description copied from interface:ContentService
return the content for a given version- Specified by:
getContentVersion
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path itemcommitId
- - version- Returns:
- content
- Throws:
ContentNotFoundException
- content not found
-
getContentVersionAsString
@Valid public @Valid String getContentVersionAsString(String site, String path, String version)
Description copied from interface:ContentService
return the content for a given version- Specified by:
getContentVersionAsString
in interfaceContentService
- Parameters:
site
- - the project IDpath
- - the path itemversion
- - version- Returns:
- version number
-
createDummyDmContentItemForDeletedNode
@Valid public @Valid ContentItemTO createDummyDmContentItemForDeletedNode(String site, String relativePath)
- Specified by:
createDummyDmContentItemForDeletedNode
in interfaceContentService
-
getBrowserUri
protected String getBrowserUri(ContentItemTO item)
-
getBrowserUri
protected static String getBrowserUri(String uri, String replacePattern, boolean isPage)
-
getContentTypeClass
@Valid public @Valid String getContentTypeClass(String site, String uri)
- Specified by:
getContentTypeClass
in interfaceContentService
-
processContent
@Valid public @Valid ResultTO processContent(String id, InputStream input, boolean isXml, Map<String,String> params, String contentChainForm) throws ServiceLayerException, UserNotFoundException
- Specified by:
processContent
in interfaceContentService
- Throws:
ServiceLayerException
UserNotFoundException
-
getNextAvailableName
@Valid public @Valid String getNextAvailableName(String site, String path)
Description copied from interface:ContentService
get the next available of the given content name at the given path (used for paste/duplicate)- Specified by:
getNextAvailableName
in interfaceContentService
- Parameters:
site
- site identifierpath
- path of the item- Returns:
- next available name that avoids a name conflict
-
getDeleteCandidates
@Valid public @Valid GoLiveDeleteCandidates getDeleteCandidates(String site, String relativePath) throws ServiceLayerException
- Specified by:
getDeleteCandidates
in interfaceContentService
- Throws:
ServiceLayerException
-
childDeleteItems
protected void childDeleteItems(String site, ContentItemTO contentItem, GoLiveDeleteCandidates items) throws ServiceLayerException
Iterate over all paths inside the folder- Throws:
ServiceLayerException
-
addDependenciesToDelete
protected void addDependenciesToDelete(String site, String sourceContentPath, GoLiveDeleteCandidates candidates) throws ServiceLayerException
- Throws:
ServiceLayerException
-
addRemovedDependenciesToDelete
protected void addRemovedDependenciesToDelete(String site, String relativePath, GoLiveDeleteCandidates candidates) throws ServiceLayerException
- Throws:
ServiceLayerException
-
getRemovedDependencies
protected List<String> getRemovedDependencies(DependencyDiffService.DiffRequest diffRequest, boolean matchDeletePattern) throws ServiceLayerException
- Throws:
ServiceLayerException
-
filterDependenciesMatchingDeletePattern
protected List<String> filterDependenciesMatchingDeletePattern(String site, String sourcePath, List<String> dependencies)
-
getDeletePatternConfig
protected List<DeleteDependencyConfigTO> getDeletePatternConfig(String site, String relativePath)
-
lockContent
@Valid public void lockContent(String site, String path) throws UserNotFoundException, ServiceLayerException
- Specified by:
lockContent
in interfaceContentService
- Throws:
UserNotFoundException
ServiceLayerException
-
getItemOrders
@Valid public @Valid List<DmOrderTO> getItemOrders(String site, String path)
- Specified by:
getItemOrders
in interfaceContentService
-
reorderItems
@Valid public @javax.validation.Valid double reorderItems(String site, String relativePath, String before, String after, String orderName)
- Specified by:
reorderItems
in interfaceContentService
-
computeReorder
protected double computeReorder(String site, String relativePath, DmOrderTO beforeOrderTO, DmOrderTO afterOrderTO, String orderName)
Will need to include the floating pages as well for orderValue computation Since the beforeOrder and afterOrder in the UI does not include floating pages will need to do special processing
-
renameContent
@Valid public @javax.validation.Valid boolean renameContent(String site, String path, String name) throws ServiceLayerException, UserNotFoundException
Description copied from interface:ContentService
rename a content item- Specified by:
renameContent
in interfaceContentService
- Parameters:
site
- - the project IDpath
- path to a folder to renamename
- a new folder name- Returns:
- return the reference to the folder renamed
- Throws:
ServiceLayerException
- general service errorUserNotFoundException
-
pushToRemote
public boolean pushToRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException, AuthenticationException, org.craftercms.commons.crypto.CryptoException
Description copied from interface:ContentService
Push content to remote repository- Specified by:
pushToRemote
in interfaceContentService
- Parameters:
siteId
- site identifierremoteName
- remote nameremoteBranch
- remote branch- Returns:
- true if operation was successful
- Throws:
ServiceLayerException
- general service errorInvalidRemoteUrlException
- invalid remote urlAuthenticationException
- authentication errororg.craftercms.commons.crypto.CryptoException
- git repository helper error
-
pullFromRemote
public boolean pullFromRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException, AuthenticationException, org.craftercms.commons.crypto.CryptoException
Description copied from interface:ContentService
Pull from remote repository- Specified by:
pullFromRemote
in interfaceContentService
- Parameters:
siteId
- site identifierremoteName
- remote nameremoteBranch
- remote branch- Returns:
- true if operation was successful
- Throws:
ServiceLayerException
- general service errorInvalidRemoteUrlException
- invalid remote urlAuthenticationException
- authentication errororg.craftercms.commons.crypto.CryptoException
- git repository helper error
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
setContentRepository
public void setContentRepository(ContentRepository contentRepository)
-
setServicesConfig
public void setServicesConfig(ServicesConfig servicesConfig)
-
setDependencyService
public void setDependencyService(DependencyService dependencyService)
-
setContentProcessor
public void setContentProcessor(ProcessContentExecutor contentProcessor)
-
setSecurityService
public void setSecurityService(SecurityService securityService)
-
setDmPageNavigationOrderService
public void setDmPageNavigationOrderService(DmPageNavigationOrderService dmPageNavigationOrderService)
-
setDmContentLifeCycleService
public void setDmContentLifeCycleService(DmContentLifeCycleService dmContentLifeCycleService)
-
setSiteService
public void setSiteService(SiteService siteService)
-
setContentItemIdGenerator
public void setContentItemIdGenerator(ContentItemIdGenerator contentItemIdGenerator)
-
setStudioConfiguration
public void setStudioConfiguration(StudioConfiguration studioConfiguration)
-
setDependencyDiffService
public void setDependencyDiffService(DependencyDiffService dependencyDiffService)
-
setContentTypeService
public void setContentTypeService(ContentTypeService contentTypeService)
-
setEntitlementValidator
public void setEntitlementValidator(org.craftercms.commons.entitlements.validator.EntitlementValidator entitlementValidator)
-
setAuditServiceInternal
public void setAuditServiceInternal(AuditServiceInternal auditServiceInternal)
-
setContentRepositoryV2
public void setContentRepositoryV2(ContentRepository contentRepository)
-
setItemServiceInternal
public void setItemServiceInternal(ItemServiceInternal itemServiceInternal)
-
setWorkflowServiceInternal
public void setWorkflowServiceInternal(WorkflowServiceInternal workflowServiceInternal)
-
setUserServiceInternal
public void setUserServiceInternal(UserServiceInternal userServiceInternal)
-
setActivityStreamServiceInternal
public void setActivityStreamServiceInternal(ActivityStreamServiceInternal activityStreamServiceInternal)
-
setContentServiceV2
public void setContentServiceV2(ContentService contentServiceV2)
-
-