Class ADMRemoteStore
- java.lang.Object
-
- org.springframework.extensions.webscripts.AbstractWebScript
-
- org.alfresco.repo.web.scripts.bean.BaseRemoteStore
-
- org.alfresco.repo.web.scripts.bean.ADMRemoteStore
-
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
- Direct Known Subclasses:
SurfConfigCleaner
public class ADMRemoteStore extends BaseRemoteStore
ADM Remote Store service.This implementation of the RemoteStore is tied to the current SiteService implementation.
It remaps incoming generic document path requests to the appropriate folder structure in the Sites folder. Dashboard pages and component bindings are remapped to take advantage of inherited permissions in the appropriate root site folder, ensuring that only valid users can write to the appropriate configuration objects.
- Author:
- Kevin Roast
- See Also:
for the available API methods.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.alfresco.service.cmr.repository.ContentServicecontentServiceprotected org.alfresco.service.cmr.model.FileFolderServicefileFolderServiceprotected org.alfresco.repo.model.filefolder.HiddenAspecthiddenAspectprotected org.alfresco.service.namespace.NamespaceServicenamespaceServiceprotected org.alfresco.service.cmr.repository.NodeServicenodeServiceprotected org.alfresco.service.cmr.security.OwnableServiceownableServiceprotected org.alfresco.service.cmr.security.PermissionServicepermissionServiceprotected org.alfresco.service.cmr.site.SiteServicesiteServiceprotected org.alfresco.service.cmr.repository.NodeServiceunprotNodeService-
Fields inherited from class org.alfresco.repo.web.scripts.bean.BaseRemoteStore
defaultStore, mimetypeService, REQUEST_PARAM_STORE, TOKEN_STORE, transformer, TRANSFORMER_FACTORY
-
-
Constructor Summary
Constructors Constructor Description ADMRemoteStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringbuildUserConfigSearchPattern(java.lang.String userName)Generate the search pattern for a Surf config location for a user name.protected voidcreateDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, java.io.InputStream content)Creates a document.protected voidcreateDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.io.InputStream in)Creates multiple XML documents encapsulated in a single one.protected voiddeleteDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path)Deletes an existing document.protected voidgetDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path)Gets a document.protected org.alfresco.query.PagingResults<org.alfresco.service.cmr.model.FileInfo>getFileNodes(org.alfresco.service.cmr.model.FileInfo fileInfo, java.lang.String pattern, boolean recurse)protected org.alfresco.service.cmr.repository.NodeRefgetGlobalComponentsNodeRef()protected org.alfresco.service.cmr.repository.NodeRefgetGlobalUserFolderNodeRef()protected java.lang.StringgetPathRunAsUser(java.lang.String path)Get the RunAs user need to execute a Write operation on the given path.protected org.alfresco.service.cmr.repository.NodeRefgetSurfConfigNodeRef(org.alfresco.service.cmr.repository.NodeRef rootRef, boolean create)Return the "surf-config" noderef under the given root.protected voidhasDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path)Determines if the document exists.protected voidlastModified(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path)Gets the last modified timestamp for the document.protected voidlistDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, boolean recurse)Lists the document paths under a given path.protected voidlistDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, java.lang.String pattern)Lists the document paths matching a file pattern under a given path.voidsetBehaviourFilter(org.alfresco.repo.policy.BehaviourFilter behaviourFilter)voidsetContentService(org.alfresco.service.cmr.repository.ContentService contentService)voidsetFileFolderService(org.alfresco.service.cmr.model.FileFolderService fileFolderService)voidsetHiddenAspect(org.alfresco.repo.model.filefolder.HiddenAspect hiddenAspect)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetOwnableService(org.alfresco.service.cmr.security.OwnableService ownableService)voidsetPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)voidsetSiteService(org.alfresco.service.cmr.site.SiteService siteService)voidsetUnprotectedNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)protected voidupdateDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, java.io.InputStream content)Updates an existing document.protected voidwriteDocument(java.lang.String path, java.io.InputStream content)-
Methods inherited from class org.alfresco.repo.web.scripts.bean.BaseRemoteStore
encodePath, execute, getPathParts, setMimetypeService, setStore
-
Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
-
-
-
-
Field Detail
-
nodeService
protected org.alfresco.service.cmr.repository.NodeService nodeService
-
unprotNodeService
protected org.alfresco.service.cmr.repository.NodeService unprotNodeService
-
fileFolderService
protected org.alfresco.service.cmr.model.FileFolderService fileFolderService
-
namespaceService
protected org.alfresco.service.namespace.NamespaceService namespaceService
-
siteService
protected org.alfresco.service.cmr.site.SiteService siteService
-
contentService
protected org.alfresco.service.cmr.repository.ContentService contentService
-
hiddenAspect
protected org.alfresco.repo.model.filefolder.HiddenAspect hiddenAspect
-
permissionService
protected org.alfresco.service.cmr.security.PermissionService permissionService
-
ownableService
protected org.alfresco.service.cmr.security.OwnableService ownableService
-
-
Method Detail
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
- Parameters:
nodeService- the NodeService to set
-
setUnprotectedNodeService
public void setUnprotectedNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
- Parameters:
nodeService- the NodeService to set
-
setFileFolderService
public void setFileFolderService(org.alfresco.service.cmr.model.FileFolderService fileFolderService)
- Parameters:
fileFolderService- the FileFolderService to set
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
- Parameters:
namespaceService- the NamespaceService to set
-
setSiteService
public void setSiteService(org.alfresco.service.cmr.site.SiteService siteService)
- Parameters:
siteService- the SiteService to set
-
setContentService
public void setContentService(org.alfresco.service.cmr.repository.ContentService contentService)
- Parameters:
contentService- the ContentService to set
-
setHiddenAspect
public void setHiddenAspect(org.alfresco.repo.model.filefolder.HiddenAspect hiddenAspect)
-
setBehaviourFilter
public void setBehaviourFilter(org.alfresco.repo.policy.BehaviourFilter behaviourFilter)
-
setPermissionService
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
-
setOwnableService
public void setOwnableService(org.alfresco.service.cmr.security.OwnableService ownableService)
-
lastModified
protected void lastModified(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path) throws java.io.IOExceptionGets the last modified timestamp for the document.The output will be the last modified date as a long toString().
- Specified by:
lastModifiedin classBaseRemoteStore- Parameters:
path- document path to an existing documentstore- the store id- Throws:
java.io.IOException
-
getDocument
protected void getDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path)Gets a document.The output will be the document content stream.
- Specified by:
getDocumentin classBaseRemoteStore- Parameters:
path- document pathstore- the store id
-
hasDocument
protected void hasDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path) throws java.io.IOExceptionDetermines if the document exists. The output will be either the string "true" or the string "false".- Specified by:
hasDocumentin classBaseRemoteStore- Parameters:
path- document pathstore- the store id- Throws:
java.io.IOException
-
createDocument
protected void createDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, java.io.InputStream content)Creates a document.Create methods are user authenticated, so the creation of site config must be allowed for the current user.
- Specified by:
createDocumentin classBaseRemoteStore- Parameters:
path- document pathcontent- content of the document to writestore- the store id
-
createDocuments
protected void createDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.io.InputStream in)Creates multiple XML documents encapsulated in a single one.- Specified by:
createDocumentsin classBaseRemoteStore- Parameters:
res- WebScriptResponsestore- Stringin- XML document containing multiple document contents to write
-
writeDocument
protected void writeDocument(java.lang.String path, java.io.InputStream content)
-
getPathRunAsUser
protected java.lang.String getPathRunAsUser(java.lang.String path)
Get the RunAs user need to execute a Write operation on the given path.- Parameters:
path- Document path- Returns:
- runas user - will be the Full Authenticated User or System as required
-
updateDocument
protected void updateDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, java.io.InputStream content)Updates an existing document.Update methods are user authenticated, so the modification of site config must be allowed for the current user.
- Specified by:
updateDocumentin classBaseRemoteStore- Parameters:
path- document path to updatecontent- content to update the document withstore- the store id
-
deleteDocument
protected void deleteDocument(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path)Deletes an existing document.Delete methods are user authenticated, so the deletion of the document must be allowed for the current user.
- Specified by:
deleteDocumentin classBaseRemoteStore- Parameters:
path- document pathstore- the store id
-
listDocuments
protected void listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, boolean recurse) throws java.io.IOExceptionLists the document paths under a given path.The output will be the list of relative document paths found under the path. Separated by newline characters.
- Specified by:
listDocumentsin classBaseRemoteStore- Parameters:
path- document pathrecurse- true to peform a recursive list, false for direct children only.store- the store id- Throws:
java.io.IOException- if an error occurs listing the documents
-
listDocuments
protected void listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String store, java.lang.String path, java.lang.String pattern) throws java.io.IOExceptionLists the document paths matching a file pattern under a given path. The output will be the list of relative document paths found under the path that match the given file pattern. Separated by newline characters.- Specified by:
listDocumentsin classBaseRemoteStore- Parameters:
path- document pathpattern- file pattern to match - allows wildcards e.g. page.*.site.xmlstore- the store id- Throws:
java.io.IOException- if an error occurs listing the documents
-
getSurfConfigNodeRef
protected org.alfresco.service.cmr.repository.NodeRef getSurfConfigNodeRef(org.alfresco.service.cmr.repository.NodeRef rootRef, boolean create)Return the "surf-config" noderef under the given root. Optionally create the folder if it does not exist yet. NOTE: must only be set to create if within a WRITE transaction context.Adds the "isIndexed = false" property to the surf-config folder node.
- Parameters:
rootRef- Root node reference where the "surf-config" folder should livecreate- True to create the folder if missing, false otherwise- Returns:
- surf-config folder ref if found, null otherwise if not creating
-
getGlobalComponentsNodeRef
protected org.alfresco.service.cmr.repository.NodeRef getGlobalComponentsNodeRef()
- Returns:
- NodeRef to the shared components config folder
-
getGlobalUserFolderNodeRef
protected org.alfresco.service.cmr.repository.NodeRef getGlobalUserFolderNodeRef()
- Returns:
- NodeRef to the shared user config folder
-
buildUserConfigSearchPattern
protected java.lang.String buildUserConfigSearchPattern(java.lang.String userName)
Generate the search pattern for a Surf config location for a user name.- Parameters:
userName- to build pattern for- Returns:
- the search pattern
-
getFileNodes
protected org.alfresco.query.PagingResults<org.alfresco.service.cmr.model.FileInfo> getFileNodes(org.alfresco.service.cmr.model.FileInfo fileInfo, java.lang.String pattern, boolean recurse)
-
-