Export operation using DFC

Options
ro3er
edited October 2, 2008 in Documentum #1

Hi,

I am using documentum 6.0 and I would like to export a docx document from the content server to my local harddrive. The following is my code:

-


private void doExport( IDfId docId, String destDir, String exportName, String exportFormat, IDfSession session ) throws DfException {

try {

System.out.println("ServiceRequestMsgBody.java: start doExport 1 - docId: " + docId.toString());

IDfClientX clientx = new DfClientX();

IDfSysObject sysObj = (IDfSysObject) session.getObject( docId );

System.out.println("ServiceRequestMsgBody.java: start doExport 2");

if( sysObj == null ) {

System.out.println("Object " + docId + " can not be found.");

return;

}

//System.out.println("ServiceRequestMsgBody.java: start doExport 2");

sysObj.setObjectName(exportName);

IDfExportOperation operation = clientx.getExportOperation();

operation.setDestinationDirectory( destDir );

IDfExportNode node = (IDfExportNode)operation.add( sysObj );

node.setFormat( exportFormat );

  • operation.execute();*

System.out.println( "exported file path: " + node.getFilePath() );

} catch (DfException e) {

e.printStackTrace();

} catch (Exception e2) {

e2.printStackTrace();

} finally {

System.out.println("export finished.");

}

}

-


this is how I invoke the method

this.doExport(docId, "C:/dll", "new_report", "docx", workitem.getSession());

Whenever I call this export method, an exception will be thrown at the execution line in bold:

operation.execute();

The error thrown is as follows:

java.lang.NullPointerException

at com.documentum.operations.impl.DfOperation.getFileExtensionToUse(DfOperation.java:2022)

at com.documentum.operations.nodeactions.outbound.impl.DfGetContentFile.getDefaultOutputFile(DfGetContentFile.java:101)

at com.documentum.operations.nodeactions.outbound.impl.DfGetContentFile.getContentFile(DfGetContentFile.java:862)

at com.documentum.operations.nodeactions.outbound.impl.DfGetContentFile.execute(DfGetContentFile.java:73)

at com.documentum.operations.steps.impl.DfOperationStep.execute(DfOperationStep.java:130)

at com.documentum.operations.impl.DfOperation.execute(DfOperation.java:437)

at com.pcs.inbox.ServiceRequestMsgBody.doExport(ServiceRequestMsgBody.java:1600)

at com.pcs.inbox.ServiceRequestMsgBody.doProcessCall(ServiceRequestMsgBody.java:875)

at com.pcs.inbox.ServiceRequestMsgBody.genTemplate(ServiceRequestMsgBody.java:827)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.documentum.web.form.FormProcessor.invokeMethod(FormProcessor.java:1562)

at com.documentum.web.form.FormProcessor.fireActionEvent(FormProcessor.java:1271)

at com.documentum.web.form.RecallOperation.execute(RecallOperation.java:101)

at com.documentum.web.form.FormProcessor.processAction(FormProcessor.java:107)

at com.documentum.web.form.FormAction.processAction(FormAction.java:107)

at com.documentum.web.env.WDKController.doStartRequest(WDKController.java:191)

at com.documentum.web.env.WDKController.processRequest(WDKController.java:92)

at com.documentum.web.env.WDKController.doFilter(WDKController.java:83)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)

at java.lang.Thread.run(Unknown Source)

Any idea what went wrong here? Is exporting of docx document type supported in documentum 6.0? And if not, are there any recommended workaround?

PS: I am not able to change the file type to a doc file due to some requirements stated by my users. So I have to work with the docx file format. Any help is greatly appreciated. Thanks in advance.

Best Answer

  • mszurap
    edited October 2, 2008 #2 Answer ✓
    Options

    Hi,

    You should call it with

    <![CDATA[<span class="jive-thread-reply-body-container">]]>this.doExport(docId, "C:/dll", "new_report", "msw12", workitem.getSession());

    Insted of "docx", "msw12" represents the format which have "docx" extension. Do not mix a format's name with it's DOS extension.

    Mike

Answers

  • mszurap
    edited October 2, 2008 #3 Answer ✓
    Options

    Hi,

    You should call it with

    <![CDATA[<span class="jive-thread-reply-body-container">]]>this.doExport(docId, "C:/dll", "new_report", "msw12", workitem.getSession());

    Insted of "docx", "msw12" represents the format which have "docx" extension. Do not mix a format's name with it's DOS extension.

    Mike

  • ro3er
    edited October 2, 2008 #4
    Options

    Hi,

    I've tried you method and it works! Thanks a lot man. Anyway, is there any place where can I find out more about the format's name for each file type?

  • mszurap
    edited October 2, 2008 #5
    Options

    I'm glad it's working.

    Documentum Administrator -&gt; Formats

    It displays the format's name and description. The DOS extension is not showed, but you can see it on it's Info page.

    Or you run a query like this:

    SELECT name, dos_extension FROM dm_format WHERE dos_extension='docx'

  • ro3er
    edited October 2, 2008 #6
    Options

    I see. Thanks a million.