Hi All,
I am facing performance issue with DFC import operation. It is taking around 20 Sec to import a 300KB pdf document. Below is the code -
public String doDDFSImport(IDfSession session, String docPath, String destFolderPath, String objectType) throws Exception {
DfLogger.debug(this, "Method Start doImport", null, null);
String newObjectId = null;
try {
IDfClientX clientx = new DfClientX();
DfLogger.debug(this, "destFolderPath: "+destFolderPath, null, null);
IDfImportOperation operation = clientx.getImportOperation();
operation.setSession(session);
IDfFolder folder = null;
folder = session.getFolderByPath(destFolderPath);
if (folder == null) {
DfLogger.debug(this, "Folder or cabinet " + destFolderPath+ " does not exist in the Docbase!", null, null);
throw new SystemException("Folder or cabinet " + destFolderPath+ " does not exist in the Docbase!");
}
operation.setDestinationFolderId(folder.getObjectId());
// check if file or directory on file system exists
IDfFile fileObj = clientx.getFile(docPath);
if (fileObj.exists() == false) {
DfLogger.debug(this, "File or directory "+docPath+" does not exist in the file system!", null, null);
throw new SystemException("File or directory "+docPath+" does not exist in the file system! for object type : "+objectType);
}
// add the file or directory to the operation
IDfImportNode node = (IDfImportNode) operation.add(docPath);
node.setDocbaseObjectType(objectType);
node.setNewObjectName(fileObj.getName());
boolean importResult = operation.execute();
DfLogger.debug(this, "importResult: "+importResult, null, null);
String errorMessage = null;
StringBuffer sb = new StringBuffer();
sb.append("Operation failed: ");
sb.append(errorMessage);
sb.append("; Errors are: (");
try {
IDfList errors = operation.getErrors();
for (int i = 0; i < errors.getCount(); i++) {
if (i > 0) {
sb.append(", ");
}
sb.append("[" + i + "] ");
IDfOperationError error = (IDfOperationError) errors.get(i);
sb.append(error.getMessage());
}
} catch (DfException ex) {
sb.append("UNABLE TO GET ERROR MESSAGES ("+ ex.getStackTraceAsString() + ")");
}
sb.append(")");
DfLogger.debug(this, "error: "+sb.toString(), null, null);
IDfList myNodes = operation.getNodes();
int iCount = myNodes.getCount();
DfLogger.debug(this, "Number of nodes after operation: " + iCount, null, null);
for (int i = 0; i < iCount; ++i) {
IDfImportNode aNode = (IDfImportNode) myNodes.get(i);
DfLogger.debug(this, "Object ID " + i + ": "+ aNode.getNewObjectId().toString() + " " + iCount, null, null);
newObjectId = aNode.getNewObjectId().toString();
DfLogger.debug(this, "Object name: "+aNode.getNewObjectName(), null, null);
}
}catch(Exception de) {
DfLogger.error(this, "Error during import", null, de);
throw new Exception(de);
}
DfLogger.debug(this, "Method End doImport", null, null);
return newObjectId;
}
Can you please suggest how can I improve this performence. Thnaks for your help!
Kind regards,
Sumanta Pakira