Hi,
I'm trying to export a virtual document using DFC . However, only the parent object seems to be getting exported, not the child objects.
I'm using the following code; any help would be appreciated.
public static void doExport(
IDfSession mySession, String docId, String target_local_directory)
throws DfException {
// Create a new client instance.
IDfClientX clientx = new DfClientX();
// Use the factory method to create an IDfExportOperation instance.
IDfExportOperation eo = clientx.getExportOperation();
// Create a document object that represents the document being exported.
IDfSysObject exportObject = (IDfSysObject) mySession
.getObject(new DfId(docId));
eo.setDestinationDirectory(target_local_directory);
// Create an export node, adding the document to the export operation
// object.
/**
* You can also add virtual document to the export operation. In that
* case, all the (immediate and non-immediate) children of the virtual
* document will also be exported.
*/
// yes, it is virtual document
if (exportObject.isVirtualDocument()) {
// To create virtual document from sys object do the following.
IDfVirtualDocument virdoc = exportObject.asVirtualDocument("",
false);
IDfExportNode node1 = (IDfExportNode) eo.add(virdoc);
node1.setFilePath((target_local_directory)+ "\\" + exportObject.getObjectName());
}
else {
IDfExportNode node = (IDfExportNode) eo.add(exportObject);
node.setFilePath(target_local_directory + "\\" + exportObject.getObjectName());
}
try {
if (eo.execute()){
System.out.println("success");
}
else
System.out.println("failure");
} catch (DfException dfe) {
System.out.println(dfe.getMessage());
} catch (Exception e) {
System.out.println(e.getMessage());
}
}