This article provides a java application, it's use format as well as the application's source code to create a URL that, when sent to a browser, will cause downloading and opening of a document from the DMS by DocIntegrate using the default handler for the document file type. Once the document is closed again by the application used for editing, the modified document is again uploaded back to the DMS by DocIntegrate.

The java application is this:

The parameters for the application call are:

$nuxeoUrl

$username

$token

$pathInPatriciaWorkspace

To invoke the applet, cd into the directory where the above applet is stored and call the following command in a shell:

java -jar di_url_generator.jar <nuxeoURL> <username> <token> <pathInPatriciaWorkspace>

 

An example call is as follows:

java -jar di_url_generator.jar localhost:8080 Administrator 01975403-ead4-42ba-8c48-da737beefe3d Documents/2/13483/EP/00/20170727154551-20151222220725-SIGN_ME.doc 

 

The source code for the above java application is as follows:

package com.pi.docintegrate;

import java.io.UnsupportedEncodingException;
import org.apache.commons.codec.binary.Hex;

public class Main {

  public static void main(String[] args) throws UnsupportedEncodingException {
    if (args.length < 4) {
      System.out.println("One of the parameters is not provided. " +
          "Please provide dms url, username, token and document path");
      return;
    }
    String nuxeoServer = args[0];
    String username = args[1];
    String token = args[2];
    String fullDocumentPath = args[3];

    String targetPath = "n:\\Patricia" + fullDocumentPath.replace("/", "\\");
    String targetPathHex = Hex.encodeHexString(targetPath.getBytes("UTF-8"));
    String adminPassHex = Hex.encodeHexString((username + ":" + token).getBytes("UTF-8"));
    String url = String.join("/", new String[]{
        "pinuxeo:/",
        nuxeoServer,
        adminPassHex,
        "",
        targetPathHex});
    System.out.println(url);
  }
}