You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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:di_url_generator.jar

 

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>

The parameters for the commandl are:

  • nuxeoUrl: <serveraddress>:<port>

Example: "nuxeo.server.tld:8080"

  • username: DMS username

Example: "Administrator"

  • token: a valid DMS token for the user username as can be taken from the Patricia db table PAT_DMS_TOKEN

Note: DMS tokens expire and are regenerated automatically by the DMS at least every 2 weeks for each user session.

Example: "01975403-ead4-42ba-8c48-da737beefe3d"

  • pathInPatriciaWorkspace: the path to the document that you which to open. This pat can be taken from the PAT_DOC_LOG table with left trimming of the path to remove "n:\\Patricia".

Example: "Documents/2/13483/EP/00/20170727154551-20151222220725-SIGN_ME.doc"

 

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);
  }
}
  • No labels