Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains the format that a URL must have so provides a java application, it's use format as well as the application's source code to create a URL that, when sent to the a browser, will cause downloading and opening of a document from within the DMS will be opened by DocIntegrate using the default handler for the document file type and, once . 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:

View file
namedi_url_generator.jar
height250

 

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

Code Block
languagebash
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

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

Note: DMS tokens expire and are regenerated automatically by the DMS at least every 2 weeks for each user session. You must use the currently valid token.

  • 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"

Note: If your filename contains spaces (blanks) you will need to put it in double quotes.

 

An example call is as follows:

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

which will return:

Code Block
languagebash
pinuxeo://localhost:8080/41646d696e6973747261746f723a30313937353430332d656164342d343262612d386334382d646137333762656566653364//6e3a5c5061747269636961446f63756d656e74735c325c31333438335c45505c30305c32303137303732373135343535312d32303135313232323232303732352d5349474e5f4d452e646f63

You can paste this URL in a browser (or send it to the server otherwise) to open your document.

 

The source code for the above java application The logic for generating the URL to open a document is as follows:

Code Block
languagejava
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);
  }
}

...