Class ADMRemoteStore
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
- Direct Known Subclasses:
SurfConfigCleaner
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentService
protected FileFolderService
protected HiddenAspect
protected org.alfresco.service.namespace.NamespaceService
protected NodeService
protected OwnableService
protected PermissionService
protected SiteService
protected NodeService
Fields inherited from class org.alfresco.repo.web.scripts.bean.BaseRemoteStore
defaultStore, mimetypeService, REQUEST_PARAM_STORE, TOKEN_STORE, transformer, TRANSFORMER_FACTORY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildUserConfigSearchPattern
(String userName) Generate the search pattern for a Surf config location for a user name.protected void
createDocument
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, InputStream content) Creates a document.protected void
createDocuments
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, InputStream in) Creates multiple XML documents encapsulated in a single one.protected void
deleteDocument
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) Deletes an existing document.protected void
getDocument
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) Gets a document.protected org.alfresco.query.PagingResults<FileInfo>
getFileNodes
(FileInfo fileInfo, String pattern, boolean recurse) protected NodeRef
protected NodeRef
protected String
getPathRunAsUser
(String path) Get the RunAs user need to execute a Write operation on the given path.protected NodeRef
getSurfConfigNodeRef
(NodeRef rootRef, boolean create) Return the "surf-config" noderef under the given root.protected void
hasDocument
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) Determines if the document exists.protected void
lastModified
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) Gets the last modified timestamp for the document.protected void
listDocuments
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, boolean recurse) Lists the document paths under a given path.protected void
listDocuments
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, String pattern) Lists the document paths matching a file pattern under a given path.void
setBehaviourFilter
(BehaviourFilter behaviourFilter) void
setContentService
(ContentService contentService) void
setFileFolderService
(FileFolderService fileFolderService) void
setHiddenAspect
(HiddenAspect hiddenAspect) void
setNamespaceService
(org.alfresco.service.namespace.NamespaceService namespaceService) void
setNodeService
(NodeService nodeService) void
setOwnableService
(OwnableService ownableService) void
setPermissionService
(PermissionService permissionService) void
setSiteService
(SiteService siteService) void
setUnprotectedNodeService
(NodeService nodeService) protected void
updateDocument
(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, InputStream content) Updates an existing document.protected void
writeDocument
(String path, 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 Details
-
nodeService
-
unprotNodeService
-
fileFolderService
-
namespaceService
protected org.alfresco.service.namespace.NamespaceService namespaceService -
siteService
-
contentService
-
permissionService
-
ownableService
-
-
Constructor Details
-
ADMRemoteStore
public ADMRemoteStore()
-
-
Method Details
-
setNodeService
- Parameters:
nodeService
- the NodeService to set
-
setUnprotectedNodeService
- Parameters:
nodeService
- the NodeService to set
-
setFileFolderService
- Parameters:
fileFolderService
- the FileFolderService to set
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) - Parameters:
namespaceService
- the NamespaceService to set
-
setSiteService
- Parameters:
siteService
- the SiteService to set
-
setContentService
- Parameters:
contentService
- the ContentService to set
-
setHiddenAspect
-
setBehaviourFilter
-
setPermissionService
-
setOwnableService
-
lastModified
protected void lastModified(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) throws IOException Gets the last modified timestamp for the document.The output will be the last modified date as a long toString().
- Specified by:
lastModified
in classBaseRemoteStore
- Parameters:
path
- document path to an existing documentstore
- the store id- Throws:
IOException
-
getDocument
protected void getDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) Gets a document.The output will be the document content stream.
- Specified by:
getDocument
in classBaseRemoteStore
- Parameters:
path
- document pathstore
- the store id
-
hasDocument
protected void hasDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path) throws IOException Determines if the document exists. The output will be either the string "true" or the string "false".- Specified by:
hasDocument
in classBaseRemoteStore
- Parameters:
path
- document pathstore
- the store id- Throws:
IOException
-
createDocument
protected void createDocument(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, 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:
createDocument
in classBaseRemoteStore
- Parameters:
path
- document pathcontent
- content of the document to writestore
- the store id
-
createDocuments
protected void createDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, String store, InputStream in) Creates multiple XML documents encapsulated in a single one.- Specified by:
createDocuments
in classBaseRemoteStore
- Parameters:
res
- WebScriptResponsestore
- Stringin
- XML document containing multiple document contents to write
-
writeDocument
-
getPathRunAsUser
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, String store, String path, 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:
updateDocument
in 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, String store, 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:
deleteDocument
in classBaseRemoteStore
- Parameters:
path
- document pathstore
- the store id
-
listDocuments
protected void listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, boolean recurse) throws IOException Lists 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:
listDocuments
in classBaseRemoteStore
- Parameters:
path
- document pathrecurse
- true to peform a recursive list, false for direct children only.store
- the store id- Throws:
IOException
- if an error occurs listing the documents
-
listDocuments
protected void listDocuments(org.springframework.extensions.webscripts.WebScriptResponse res, String store, String path, String pattern) throws IOException Lists 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:
listDocuments
in classBaseRemoteStore
- Parameters:
path
- document pathpattern
- file pattern to match - allows wildcards e.g. page.*.site.xmlstore
- the store id- Throws:
IOException
- if an error occurs listing the documents
-
getSurfConfigNodeRef
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
- Returns:
- NodeRef to the shared components config folder
-
getGlobalUserFolderNodeRef
- Returns:
- NodeRef to the shared user config folder
-
buildUserConfigSearchPattern
Generate the search pattern for a Surf config location for a user name.- Parameters:
userName
- to build pattern for- Returns:
- the search pattern
-
getFileNodes
-