Class PrintJob

  • All Implemented Interfaces:
    java.lang.Runnable

    public class PrintJob
    extends java.lang.Object
    implements java.lang.Runnable
    A print job for the Cloud Office Print server containing all the necessary information to generate the adequate JSON for the Cloud Office Print server.
    • Constructor Detail

      • PrintJob

        public PrintJob​(java.util.Hashtable<java.lang.String,​RenderElement> data,
                        Server server,
                        Output output,
                        Resource template,
                        java.util.Hashtable<java.lang.String,​Resource> subTemplates,
                        Resource[] prependFiles,
                        Resource[] appendFiles,
                        java.lang.Boolean copRemoteDebug)
        A print job for the Cloud Office Print server containing all the necessary information to generate the adequate JSON for the Cloud Office Print server. If you don't want to instantiate a variable, use null for this argument.
        Parameters:
        data - Hashtable of (filename, RenderElement) elements. Multiple output files will be produced if the hashtable has more then one element, the Cloud Office Print server will return a zip file containing all of them.
        server - Server to user for this printjob.
        output - object containing the output configuration for this printjob.
        template - for this printjob.
        subTemplates - for this print job. Hashtable(key, subTemplate) Subtemplates are only accessible (in docx). They will replace the `{?include subtemplate_dict_key}` tag in the docx.
        prependFiles - Files to prepend to the output.
        appendFiles - Files to append to the output.
        copRemoteDebug - If set to true the Cloud Office Print server will log your JSON into out database and you can see it when you log into cloudofficeprint.com.
      • PrintJob

        public PrintJob​(ExternalResource externalResource,
                        Server server,
                        Output output,
                        Resource template,
                        java.util.Hashtable<java.lang.String,​Resource> subTemplates,
                        Resource[] prependFiles,
                        Resource[] appendFiles,
                        java.lang.Boolean copRemoteDebug)
        A print job for the Cloud Office Print server containing all the necessary information to generate the adequate JSON for the Cloud Office Print server. If you don't want to instantiate a variable, use null for this argument.
        Parameters:
        externalResource - External resource for the data (REST or graphQL).
        server - Server to user for this printjob.
        output - object containing the output configuration for this printjob.
        template - Template for this printjob. If no template is specified Cloud Office Print will generate a template based on the data. Output type determines the template type generated. Cannot be PDF in this case.
        subTemplates - for this print job. Hashtable(key, subTemplate) Subtemplates are only accessible (in docx). They will replace the `{?include subtemplate_dict_key}` tag in the docx.
        prependFiles - Files to prepend to the output.
        appendFiles - Files to append to the output.
        copRemoteDebug - If set to true the Cloud Office Print server will log your JSON into out database and you can see it when you log into cloudofficeprint.com.
    • Method Detail

      • getServer

        public Server getServer()
        Returns:
        Server to user for this printjob.
      • setServer

        public void setServer​(Server server)
        Parameters:
        server - to use for this printjob.
      • getOutput

        public Output getOutput()
        Returns:
        Output object containing output configuration for this printjob.
      • setOutput

        public void setOutput​(Output output)
        Parameters:
        output - object containing the output configuration for this printjob.
      • getTemplate

        public Resource getTemplate()
        Returns:
        Template for this print job.
      • setTemplate

        public void setTemplate​(Resource template)
        Parameters:
        template - for this printjob.
      • getPrependFiles

        public Resource[] getPrependFiles()
        Returns:
        Files to prepend to the output.
      • setPrependFiles

        public void setPrependFiles​(Resource[] prependFiles)
        Parameters:
        prependFiles - Files to prepend to the output.
      • getAppendFiles

        public Resource[] getAppendFiles()
        Returns:
        Files to append to the output.
      • setAppendFiles

        public void setAppendFiles​(Resource[] appendFiles)
        Parameters:
        appendFiles - Files to append to the output.
      • getSubTemplates

        public java.util.Hashtable<java.lang.String,​Resource> getSubTemplates()
        Subtemplates are only accessible (in docx). They will replace the `{?include subtemplate_dict_key}` tag in the docx.
        Returns:
        Subtemplates for this print job. Hashtable(key, subTemplate).
      • setSubTemplates

        public void setSubTemplates​(java.util.Hashtable<java.lang.String,​Resource> subTemplates)
        Subtemplates are only accessible (in docx). They will replace the `{?include subtemplate_dict_key}` tag in the docx.
        Parameters:
        subTemplates - for this print job. Hashtable(key, subTemplate).
      • getData

        public java.util.Hashtable<java.lang.String,​RenderElement> getData()
        Renderelements will replace their corresponding tag in the template. Multiple output files will be produced if the hashtable has more then one element, the Cloud Office Print server will return a zip file containing all of them.
        Returns:
        Hashtable(filename, RenderElement)
      • setData

        public void setData​(java.util.Hashtable<java.lang.String,​RenderElement> data)
        Renderelements will replace their corresponding tag in the template. Multiple output files will be produced if the hashtable has more then one element, the Cloud Office Print server will return a zip file containing all of them.
        Parameters:
        data - Hashtable(filename, RenderElement)
      • getCopRemoteDebug

        public java.lang.Boolean getCopRemoteDebug()
        Returns:
        If set to true the Cloud Office Print server will log your JSON into out database and you can see it when you log into cloudofficeprint.com.
      • setCopRemoteDebug

        public void setCopRemoteDebug​(java.lang.Boolean copRemoteDebug)
        Parameters:
        copRemoteDebug - If set to true the Cloud Office Print server will log your JSON into out database and you can see it when you log into cloudofficeprint.com.
      • getExternalResource

        public ExternalResource getExternalResource()
        Returns:
        External resource for the data (REST or graphQL).
      • setExternalResource

        public void setExternalResource​(ExternalResource externalResource)
        Parameters:
        externalResource - External resource for the data (REST or graphQL).
      • getResponse

        public Response getResponse()
        For getting to response after asynchronous execution. To used after run() has been called and the thread joined.
        Returns:
        Response of the request to Cloud Office Print.
      • setResponse

        public void setResponse​(Response response)
        For setting to response after asynchronous execution. Call getResponse() after run() has been called and the thread joined to get the response.
        Parameters:
        response - Response of the request to Cloud Office Print.
      • getJSON

        public com.google.gson.JsonObject getJSON()
        Returns:
        Jsonobject containing all the info about the printjob, for the POST request to the Cloud Office Print server.
      • execute

        public Response execute()
                         throws java.lang.Exception
        Creates the adequate JSON and sends it to the Cloud Office Print server.
        Returns:
        The response of the Cloud Office Print server.
        Throws:
        java.lang.Exception - If the server is not reachable.
        COPException - If the server response doesn't have a 200 code.
      • run

        public void run()
        Asynchronous version of execute(). The response can be obtained with the getResponse() function. Creates the adequate JSON and sends it to the Cloud Office Print server.
        Specified by:
        run in interface java.lang.Runnable