Thursday, April 18, 2013

Documentum integration with Xenos

Table of contents

1. Overview
2. What is Xenos
3. Implementation


Overview

In a financial organization or in a telecom industry, generally we have a requirement to view statement of our account. These account statement comes to you via email as a form of PDF or you can view as PDF through online whenever it is required. These PDF account statement does not store as a PDF in a ECM repository, rather those documents are stored as different file format like .afp or other format. So, whenever you are requesting for statement through online or you receive over email then system does not keep records in PDF form. It transform those .afp file to PDF which are stored in a ECM repository like Documentum. This is an alternative to DTS(Document Transformation Service) or ADTS( Advanced Document Transformation Service) in Documentum. This is required when you are trying to view statements from an external system. Today will see how it works.

What is Xenos

Xenos is product which is useful for customer communication through different process, transformation etc. It gives the flexibility to interact with different ECM system like EMC Documentum, IBM CMOD. It also has the ability to  integrate with EMC xPression. For my project, I've used Xenos developer studio which is a graphical user interface to configure with Documentum through adapter.

Implementation  

Step 1: First step you need to define afp format(dm_format) in Documentum Administrator(DA).
Step 2: After you need to create transformation project in Xenos developer studio(Picture 1). It will have 3 components i) AFP parser  as input ii) Best viewed rotation to display the document in proper view. iii) PDF generator.
                                                                            Picture 1
Step 3: Next you need to configure the AFP input. AFP input can be a dynamic value. 

 

Step 4: Sometimes it is required to add logo of organization inside the generated PDF file. For that you need to add resource file - 
Step 5: Now you are done with d2e project. Next step is to create a process which will call this d2e project. 
Xenos developer studio will generate xml file for this configuration. click on view source to see xml file.

Step 6: Next step we need to configure is to create adapter for Documentum. Fill in the necessary info as below - 

Step 7: Once you are done with setting up adapter, after you need to specify dfc.properties, repository name and object type( custom or default). In my case, I have used my_document which is a subtype of dm_document. You can add multiple Alias based on your object model. 

Step 8: Create the jar file of Xenos project that you have created and deploy it in a J2EE server. 

Step 9: Once you are done with deployment, now you need to test the application though standalone java program. It will generate PDF file from afp. This java class will invoke Xenos Repository service 

import com.xenos.repository.api.HitItem;
import com.xenos.repository.api.HitList;
import com.xenos.repository.api.SearchCriteria;
import com.xenos.repository.api.SearchItem;
import com.xenos.repository.util.NameValuePair;
import com.xenos.repository.webservice.client.RepositoryServiceClientHelper;

public class  TestRetrival extends Thread
{
public static void main(String[] args) throws Exception
{
String URL = null;
String docID = null;
final String userName = "dmadmin"; 
final String password = "****";
String adapter = "dctmadapter:Sales";// Adapter name which you define in Xenos DCTM adapter
String objectID = "09012a5b80075dc2"; // Any Document id in Documentum

url = "someaddredd:port/repo/services/RepositoryServices?wsdl";
RepositoryServicesClientHelper rsc = null; 
rsc = new RepositoryServicesClientHelper(url,RepositoryServicesClientHelper.REPO_API_URL,System.out); 

List failed = new ArrayList(); 

try{
SearchCriteria sc = SearchCriteria();
sc.addCriteria("r_object_id",SearchCriteria.OP_EQUAL,objectID); 

HitList hitlist  = null;
hitlist = rsc.retriveHitlist(adapter, userName, password, sc); 
HitItem[] itemArray = hitlist.getAllHits();
HitItem item = itemArray[0];
System.out.println("Document ID : "+item.getDocumentId();

NameValuePair[] jobVars = new NameValuePair[1];
jobVars[0] = new NameValuePair();
jobVars[0].setName("iw.Compressed");
jobVars[0].setValue("G");

String postProcess = "myprocess"; // Process that you define in Xenos

byte[] buf = rsc.retriveDocument(adapter,userName,password,item.getDocumentId(),postProcess,jobVars); 

File file = new File("TestDoc.pdf");
FileOutputStream fos = new FileOutputStream(file);
fos.write(buf);
foc.close();

}catch(Exception e){
e.printStackTrace();
}finally{
System.out.println("Done!");
}
}

}
}


Please feel free to write to me at sumantapakira@gmail.com