Documentum D2 api ID2Method

vkpandey
edited December 28, 2015 in Documentum #1

Hi,

I am trying to implement a workflow method using D2 api and ID2Method interface. The abstract method:

public D2methodBean execute(IDfSession sessObj, IDfSysObject sysObj,

  Locale locObj, ArgumentParser argParseObj) throws Exception {

uses few parameters. I would like to know significance and use of Locale and Argument parser parameters. Locale as in would be specific to language, but still how it is implemented. Same with ArgParse. Looks like it is similar to Map params of IdmMethod execute method but how will it be used. A standalone example could of very great help.

I am trying to move a workflow autoactivity code earlier using iDmMethod for notification.

Please, any help will be highly appreciated. I am trying to find api documentation for it but all i could get is d2fs classes and not for ID2Method.

Regards

Vivek

Best Answer

Answers

  • Benoit_MITTAU
    edited July 31, 2014 #3

    Hi Vivek,

    Which version of D2 are you using : v3.x or v4.x ?

    Depending on the version, the way to develop D2 server metho doesn't change but the name of D2 Java packages are different: eu.c6.**** within D2-API v3.x (except v3.1 SP1) and com.emc.**** within D2-API v4.x.

    If you need a D2 server method sample, you can download the xCelerator "PDF Form Writer xCelerator for xCP and D2" (https://community.emc.com/docs/DOC-9863). The Java source code if provided and it give you the Java example you request, with comments:

    /**

    * This server method reads the PDF Form and update the metadata of the document.

    * @param paramIDfSession

    *  Documentum sessions, provided by D2.

    * @param paramIDfSysObject

    *  dm_sysobject on which the server method has executed. It should correspond a the PDF form.

    * @param paramLocale

    *  Locale (fr, en, etc) of the current user session within D2 GUI.

    * @param paramArgumentParser

    *  Argument parser, provided by D2, to retrieve all calling parameters.

    * @throws Exception

    *   if an error occurs.

    */

    public D2methodBean execute(IDfSession paramIDfSession, IDfSysObject paramIDfSysObject, Locale paramLocale, ArgumentParser paramArgumentParser) throws Exception {

      // TODO Parse the Documentum method arguments (both standard and custom ones) using paramArgumentParser

      // TODO Add your method logic

      return null;

    }

    I hope it will help you.

    Benoit

  • vkpandey
    edited August 5, 2014 #4

    Thanks Benoit for your reply,

    I went through the link and the accelerator methods. It is clear for me now for the usage of argiment parser. I tried writing  a method code using ID2Method and just used system.out.printlns to see the arg parser values. But now i'm running into a different error altogether..the error i see in server logs is:

    Java class must implement IDmMethod or IDfMethod interface or have a main() method

    Could i pls get some help on this.....

    -Vivek

  • vkpandey
    edited August 5, 2014 #6

    Thanks Benoit,

    I got it working, was able to successfully parse arguments and got the start. I was missing the declaration of verb as you correctly figured.

    Thanks again

  • Benoit_MITTAU
    edited August 5, 2014 #7

    Great

  • RBudida
    edited December 28, 2015 #8

    Hi we are using D2 4.5 and i have written code but the method is not getting invoked. Need your suggestions please. I have put the verb the same way com.emc.d2.api.methods.D2Method -class_name com.package.ExpenseMethod

    @Override 

      public D2methodBean execute(IDfSession session, IDfSysObject sysObject, 

      Locale local, ArgumentParser parser) throws Exception { 

       sysObject.setTitle("Hello");

      DfLogger.info(this, "*********Successfully Entered Document Method*********", null, null);  

      return null; 

      } 

  • Did you made this working?
    I am also trying to invoke the D2 method from inside plugin or from lifecycle but its not invoking. Can you please help.