org.alfresco.repo.web.scripts.content
Class StreamACP

java.lang.Object
  extended by org.springframework.extensions.webscripts.AbstractWebScript
      extended by org.alfresco.repo.web.scripts.content.StreamContent
          extended by org.alfresco.repo.web.scripts.content.StreamACP
All Implemented Interfaces:
org.springframework.context.ResourceLoaderAware, 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
 
Field Summary
protected  org.alfresco.service.cmr.view.ExporterService exporterService
           
protected static java.lang.String MULTIPART_FORMDATA
           
protected static java.lang.String PARAM_NODE_REFS
           
protected static java.lang.String TEMP_FILE_PREFIX
           
protected static java.lang.String ZIP_EXTENSION
           
 
Fields inherited from class org.alfresco.repo.web.scripts.content.StreamContent
contentService, mimetypeService, nodeService, permissionService, resourceLoader
 
Constructor Summary
StreamACP()
           
 
Method Summary
protected  java.io.File createACP(org.alfresco.service.cmr.view.ExporterCrawlerParameters params, java.lang.String extension, boolean keepFolderStructure)
          Returns an ACP file containing the nodes represented by the given list of NodeRefs.
 void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res)
           
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.
protected  org.alfresco.service.cmr.repository.NodeRef[] getNodeRefs(java.lang.String nodeRefsParam)
          Converts the given comma delimited string of NodeRefs to an array of NodeRefs.
 void setExporterService(org.alfresco.service.cmr.view.ExporterService exporterService)
          Sets the ExporterService to use
 
Methods inherited from class org.alfresco.repo.web.scripts.content.StreamContent
executeImpl, executeImpl, executeImpl, renderFormatTemplate, setAttachment, setContentService, setMimetypeService, setNodeService, setPermissionService, setResourceLoader, streamContent, streamContent, streamContent, streamContent, streamContent, streamContent, streamContent, streamContentImpl
 
Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEMP_FILE_PREFIX

protected static final java.lang.String TEMP_FILE_PREFIX
See Also:
Constant Field Values

MULTIPART_FORMDATA

protected static final java.lang.String MULTIPART_FORMDATA
See Also:
Constant Field Values

ZIP_EXTENSION

protected static final java.lang.String ZIP_EXTENSION
See Also:
Constant Field Values

PARAM_NODE_REFS

protected static final java.lang.String PARAM_NODE_REFS
See Also:
Constant Field Values

exporterService

protected org.alfresco.service.cmr.view.ExporterService exporterService
Constructor Detail

StreamACP

public StreamACP()
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 java.io.IOException
Specified by:
execute in interface org.springframework.extensions.webscripts.WebScript
Overrides:
execute in class StreamContent
Throws:
java.io.IOException
See Also:
org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)

getNodeRefs

protected org.alfresco.service.cmr.repository.NodeRef[] getNodeRefs(java.lang.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.JSONException
Attempts 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:
nodeRefs - Comma delimited string of NodeRefs
Returns:
Array of NodeRef objects
Throws:
org.json.JSONException

createACP

protected java.io.File createACP(org.alfresco.service.cmr.view.ExporterCrawlerParameters params,
                                 java.lang.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 exporter
extension - The file extenstion to use for the ACP file
keepFolderStructure - Determines whether the folder structure is maintained for the content inside the ACP file
Returns:
File object representing the created ACP


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.