IDfSession session = null;
IDfSessionManager sessMgr = null;
try
IDfClientX clientX = new DfClientX();
sessMgr=createSessionManager( "user","password","repost");
System.out.println("--sessionmanager is created in the method----" );
session=createSession(sessMgr, "repost");
IDfImportOperation impOper = clientX.getImportOperation();IDfFile localFile = clientX.getFile( "Memo Approval/company/other/BMN-templete.xls");IDfImportNode impNode = (IDfImportNode) impOper.add(localFile);
System. out.println("---------- The file is obtained ---------- ");
impOper.setSession(session);IDfId destId = new DfId("<folder id >");
impOper.setDestinationFolderId(destId);
if
(impOper.execute()){
System.
out.println("Import Operation Succeeded");
IDfDocument newObj = (IDfDocument)impNode.getNewObject();
// you can set any custom attr values on the document now
newObj.setString( "my_attr","someValue");
newObj.save();
System.out.println("Created Object: "+ newObj.getObjectId());
}
else{System.IDfList errList = impOper.getErrors();out.println("Import Operation Failed.........");
for(int
i=0;i<errList.getCount();i++)
{
System. out.println(errList.getString(i));}
}
}
//try block
catch
(Exception e){
e.printStackTrace();
}
finally
{
releaseSession(sessMgr,session);
System. out.println("--- session is released----");}
I had written a method that should import the document from one of the folder to another folder.I have placed that document in a particular folder.
I am getting an error like.
com.documentum.operations.impl.DfFile cannot be cast to java.lang.String