Class 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
    • 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 IOException
        Specified by:
        execute in interface org.springframework.extensions.webscripts.WebScript
        Overrides:
        execute in class StreamContent
        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.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:
        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 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