Interface ContentService
-
- All Known Implementing Classes:
ContentServiceImpl
public interface ContentService
Content Services that other services may use- Author:
- russdanner
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
contentExists(String site, String path)
Check if content existsString
copyContent(String site, String fromPath, String toPath)
copy content fromPath to toPathContentItemTO
createDummyDmContentItemForDeletedNode(String site, String relativePath)
boolean
createFolder(String site, String path, String name)
create a folderboolean
deleteContent(String site, String path, boolean generateActivity, String approver)
boolean
deleteContent(String site, String path, String approver)
delete content at the pathInputStream
getContent(String site, String path)
get document from wcm contentorg.dom4j.Document
getContentAsDocument(String site, String path)
get document from wcm contentorg.springframework.core.io.Resource
getContentAsResource(String site, String path)
Returns content wrapped as aResource
instanceString
getContentAsString(String site, String path)
get content as string from repositoryString
getContentAsString(String site, String path, String encoding)
get content as string from repositoryContentItemTO
getContentItem(String site, String path)
get the content item (metadata) at a specific pathContentItemTO
getContentItem(String site, String path, int depth)
get the content item (metadata) at a specific pathContentItemTO
getContentItemTree(String site, String path, int depth)
get the tree of content items (metadata) beginning at a rootVersionTO[]
getContentItemVersionHistory(String site, String path)
get the version history for an itemlong
getContentSize(String site, String path)
get file sizeString
getContentTypeClass(String site, String uri)
InputStream
getContentVersion(String site, String path, String version)
return the content for a given versionString
getContentVersionAsString(String site, String path, String version)
return the content for a given versionGoLiveDeleteCandidates
getDeleteCandidates(String site, String uri)
List<DmOrderTO>
getItemOrders(String site, String path)
String
getNextAvailableName(String site, String path)
get the next available of the given content name at the given path (used for paste/duplicate)void
lockContent(String site, String path)
String
moveContent(String site, String fromPath, String toPath)
move content fromPath to toPathResultTO
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 repositoryboolean
renameFolder(String site, String path, String name)
rename a folderdouble
reorderItems(String site, String relativePath, String before, String after, String orderName)
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
unLockContent(String site, String path)
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)
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)
-
-
-
Method Detail
-
contentExists
boolean contentExists(String site, String path)
Check if content exists- Parameters:
site
- site identifierpath
- path of the content- Returns:
- true if site has content object at path
-
getContent
InputStream getContent(String site, String path) throws ContentNotFoundException
get document from wcm content- Parameters:
site
- site identifierpath
- path of the content- Returns:
- document
- Throws:
ContentNotFoundException
-
getContentSize
long getContentSize(String site, String path)
get file size- Parameters:
site
- site id where the operation will be executedpath
- path to content- Returns:
- Size in bytes
-
getContentAsString
String getContentAsString(String site, String path)
get content as string from repository- Parameters:
site
- site identifierpath
- path of the content- Returns:
- document
-
getContentAsString
String getContentAsString(String site, String path, String encoding)
get content as string from repository- Parameters:
site
- site identifierpath
- path of the contentencoding
- file encoding- Returns:
- document
-
getContentAsDocument
org.dom4j.Document getContentAsDocument(String site, String path) throws org.dom4j.DocumentException
get document from wcm content- Parameters:
site
- site identifierpath
- content path- Returns:
- document
- Throws:
org.dom4j.DocumentException
- XML document 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- Since:
- 3.1.1
-
writeContent
boolean writeContent(String site, String path, InputStream content) throws ServiceLayerException
write content- Parameters:
site
- - the project IDpath
- path to contentcontent
- stream of content to write- Returns:
- return true if successful
- Throws:
ServiceLayerException
- general service error
-
createFolder
boolean createFolder(String site, String path, String name) throws ServiceLayerException, UserNotFoundException
create a folder- 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
boolean deleteContent(String site, String path, String approver) throws SiteNotFoundException
delete content at the path- Parameters:
site
- - the project IDpath
- path to content- Returns:
- return true if successful
- Throws:
SiteNotFoundException
- site not found
-
deleteContent
boolean deleteContent(String site, String path, boolean generateActivity, String approver) throws SiteNotFoundException
- Throws:
SiteNotFoundException
-
copyContent
String copyContent(String site, String fromPath, String toPath) throws ServiceLayerException, UserNotFoundException
copy content fromPath to toPath- 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
-
moveContent
String moveContent(String site, String fromPath, String toPath)
move content fromPath to toPath- Parameters:
site
- - the project IDfromPath
- the source pathtoPath
- the target path to copy content to- Returns:
- final path if successful, null otherwise
-
getContentItemTree
ContentItemTO getContentItemTree(String site, String path, int depth)
get the tree of content items (metadata) beginning at a root- Parameters:
site
- - the project IDpath
- - the path to root at- Returns:
- content item with children tree
-
getContentItem
ContentItemTO getContentItem(String site, String path)
get the content item (metadata) at a specific path- Parameters:
site
- - the project IDpath
- - the path of the content item- Returns:
- content item representation
-
getContentItem
ContentItemTO getContentItem(String site, String path, int depth)
get the content item (metadata) at a specific path- Parameters:
site
- - the project IDpath
- - the path of the content itemdepth
- - depth to get desendents- Returns:
- content item representation
-
getContentItemVersionHistory
VersionTO[] getContentItemVersionHistory(String site, String path)
get the version history for an item- Parameters:
site
- - the project IDpath
- - the path of the item- Returns:
- version history
-
revertContentItem
boolean revertContentItem(String site, String path, String version, boolean major, String comment) throws SiteNotFoundException
revert a version (create a new version based on an old version)- 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 found
-
getContentVersion
InputStream getContentVersion(String site, String path, String version) throws ContentNotFoundException
return the content for a given version- Parameters:
site
- - the project IDpath
- - the path itemversion
- - version- Returns:
- content
- Throws:
ContentNotFoundException
- content not found
-
getContentVersionAsString
String getContentVersionAsString(String site, String path, String version) throws ContentNotFoundException
return the content for a given version- Parameters:
site
- - the project IDpath
- - the path itemversion
- - version- Returns:
- version number
- Throws:
ContentNotFoundException
- content not found
-
writeContent
void writeContent(String site, String path, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock) throws ServiceLayerException
write content- 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 error
-
writeContent
void writeContent(String site, String path, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock, boolean skipAuditLogInsert) throws ServiceLayerException
write content- 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 error
-
writeContentAndRename
void writeContentAndRename(String site, String path, String targetPath, String fileName, String contentType, InputStream input, String createFolders, String edit, String unlock, boolean createFolder) throws ServiceLayerException
- Throws:
ServiceLayerException
-
writeContentAsset
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
- Throws:
ServiceLayerException
-
getNextAvailableName
String getNextAvailableName(String site, String path)
get the next available of the given content name at the given path (used for paste/duplicate)- Parameters:
site
- site identifierpath
- path of the item- Returns:
- next available name that avoids a name conflict
-
createDummyDmContentItemForDeletedNode
ContentItemTO createDummyDmContentItemForDeletedNode(String site, String relativePath)
-
processContent
ResultTO processContent(String id, InputStream input, boolean isXml, Map<String,String> params, String contentChainForm) throws ServiceLayerException
- Throws:
ServiceLayerException
-
getDeleteCandidates
GoLiveDeleteCandidates getDeleteCandidates(String site, String uri) throws ServiceLayerException
- Throws:
ServiceLayerException
-
lockContent
void lockContent(String site, String path) throws UserNotFoundException, ServiceLayerException
-
getItemOrders
List<DmOrderTO> getItemOrders(String site, String path) throws ContentNotFoundException
- Throws:
ContentNotFoundException
-
reorderItems
double reorderItems(String site, String relativePath, String before, String after, String orderName) throws ServiceLayerException
- Throws:
ServiceLayerException
-
renameFolder
boolean renameFolder(String site, String path, String name) throws ServiceLayerException, UserNotFoundException
rename a folder- 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
boolean pushToRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException, AuthenticationException, org.craftercms.commons.crypto.CryptoException
Push content to remote repository- 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
boolean pullFromRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException, AuthenticationException, org.craftercms.commons.crypto.CryptoException
Pull from remote repository- 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
-
-