Documentum D2 api ID2Method
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
-
Did you implemented IDmMethod interface like in the example provided ?
PdfFormWriterMethod:
[...]
public final class PdfFormWriterMethod extends AbstractD2Method [...]
AbstractD2Method:
[...]
import eu.c6.d2.api.methods.ID2Method;
[...]
public abstract class AbstractD2Method implements ID2Method [...]
So, you can see that PdfFormWriterMethod implements ID2Method.
You don't have to implement IDfMethod, this is done by D2Method:
public final class D2Method implements IDfMethod
{
public D2Method()
{
}
[...]
}
In your development environment, as soon as your class imports and implements ID2Method, you should have errors if some methods are not implemented.
I think taht the source of your mistake resides in your dm_method definition.
What is the method_verb of your dm_method?
You have probably tried to call directly your own class. But to implement a D2 server method, you should call the "class eu.c6.d2.api.methods.D2Method" with a parameter "-class_name" (which points to you custom class).
Example:
eu.c6.d2.api.methods.D2Method -class_name com.xcelerator.methods.PdfFormWriterMethod
One again, there is an example in the xCelerator "PDF Form Writer" (): see the dm_method articfact "PdfFormWriterMethod" in the file "PDF_Form_Writer_DAR_files.zip".
Benoit
5
Answers
-
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
0 -
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
0 -
Did you implemented IDmMethod interface like in the example provided ?
PdfFormWriterMethod:
[...]
public final class PdfFormWriterMethod extends AbstractD2Method [...]
AbstractD2Method:
[...]
import eu.c6.d2.api.methods.ID2Method;
[...]
public abstract class AbstractD2Method implements ID2Method [...]
So, you can see that PdfFormWriterMethod implements ID2Method.
You don't have to implement IDfMethod, this is done by D2Method:
public final class D2Method implements IDfMethod
{
public D2Method()
{
}
[...]
}
In your development environment, as soon as your class imports and implements ID2Method, you should have errors if some methods are not implemented.
I think taht the source of your mistake resides in your dm_method definition.
What is the method_verb of your dm_method?
You have probably tried to call directly your own class. But to implement a D2 server method, you should call the "class eu.c6.d2.api.methods.D2Method" with a parameter "-class_name" (which points to you custom class).
Example:
eu.c6.d2.api.methods.D2Method -class_name com.xcelerator.methods.PdfFormWriterMethod
One again, there is an example in the xCelerator "PDF Form Writer" (): see the dm_method articfact "PdfFormWriterMethod" in the file "PDF_Form_Writer_DAR_files.zip".
Benoit
5 -
Great
0 -
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
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;
}
0 -
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.0
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 122 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management