Class StreamACP
- java.lang.Object
-
- org.springframework.extensions.webscripts.AbstractWebScript
-
- org.alfresco.repo.web.scripts.content.StreamContent
-
- org.alfresco.repo.web.scripts.content.StreamACP
-
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
public class StreamACP extends StreamContent
Base class for Java backed webscripts that wish to generate an ACP and stream the contents back to the caller.The default implementation generates an ACP file containing the provided NodeRefs and all their respective children.
- Author:
- Gavin Cornwell
-
-
Field Summary
Fields Modifier and Type Field Description protected org.alfresco.service.cmr.view.ExporterServiceexporterServiceprotected static StringMULTIPART_FORMDATAprotected static StringPARAM_NODE_REFSprotected static StringTEMP_FILE_PREFIXprotected static StringZIP_EXTENSION-
Fields inherited from class org.alfresco.repo.web.scripts.content.StreamContent
delegate, mimetypeService, nodeService, permissionService, repository
-
-
Constructor Summary
Constructors Constructor Description StreamACP()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FilecreateACP(org.alfresco.service.cmr.view.ExporterCrawlerParameters params, String extension, boolean keepFolderStructure)Returns an ACP file containing the nodes represented by the given list of NodeRefs.voidexecute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res)protected org.alfresco.service.cmr.repository.NodeRef[]getNodeRefs(String nodeRefsParam)Converts the given comma delimited string of NodeRefs to an array of NodeRefs.protected org.alfresco.service.cmr.repository.NodeRef[]getNodeRefs(org.json.JSONObject json)Attempts to retrieve and convert a JSON array of NodeRefs from the given JSON object.voidsetExporterService(org.alfresco.service.cmr.view.ExporterService exporterService)Sets the ExporterService to use-
Methods inherited from class org.alfresco.repo.web.scripts.content.StreamContent
createObjectReferenceFromUrl, executeImpl, executeImpl, executeImpl, renderFormatTemplate, setAttachment, setDelegate, setMimetypeService, setNodeService, setPermissionService, setRepository, streamContent, streamContent, streamContent, streamContentImpl
-
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
-
TEMP_FILE_PREFIX
protected static final String TEMP_FILE_PREFIX
- See Also:
- Constant Field Values
-
MULTIPART_FORMDATA
protected static final String MULTIPART_FORMDATA
- See Also:
- Constant Field Values
-
ZIP_EXTENSION
protected static final String ZIP_EXTENSION
- See Also:
- Constant Field Values
-
PARAM_NODE_REFS
protected static final String PARAM_NODE_REFS
- See Also:
- Constant Field Values
-
exporterService
protected org.alfresco.service.cmr.view.ExporterService exporterService
-
-
Method Detail
-
setExporterService
public void setExporterService(org.alfresco.service.cmr.view.ExporterService exporterService)
Sets the ExporterService to use- Parameters:
exporterService- The ExporterService
-
execute
public void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res) throws IOException- Specified by:
executein interfaceorg.springframework.extensions.webscripts.WebScript- Overrides:
executein classStreamContent- Throws:
IOException- See Also:
WebScript.execute(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.WebScriptResponse)
-
getNodeRefs
protected org.alfresco.service.cmr.repository.NodeRef[] getNodeRefs(String nodeRefsParam)
Converts the given comma delimited string of NodeRefs to an array of NodeRefs. If the string is null a WebScriptException is thrown.- Parameters:
nodeRefsParam- Comma delimited string of NodeRefs- Returns:
- Array of NodeRef objects
-
getNodeRefs
protected org.alfresco.service.cmr.repository.NodeRef[] getNodeRefs(org.json.JSONObject json) throws org.json.JSONExceptionAttempts to retrieve and convert a JSON array of NodeRefs from the given JSON object. If the nodeRefs property is not present a WebScriptException is thrown.- Parameters:
json- JSONObject- Returns:
- Array of NodeRef objects
- Throws:
org.json.JSONException
-
createACP
protected File createACP(org.alfresco.service.cmr.view.ExporterCrawlerParameters params, String extension, boolean keepFolderStructure)
Returns an ACP file containing the nodes represented by the given list of NodeRefs.- Parameters:
params- The parameters for the ACP exporterextension- The file extenstion to use for the ACP filekeepFolderStructure- Determines whether the folder structure is maintained for the content inside the ACP file- Returns:
- File object representing the created ACP
-
-