Hi all,
i have a simple procedure to perform a deep copy of one folder to anoter. In the source folder there are 1500+ pdf file organized by folder.
Here the code:
public static void main(String args[]) {
String userId = "app_supervisor";
String password = "pass";
String repository = "dmrep";
try {
Login login = new Login();
dfcService = new DFCService(login.login(userId, password, repository));
IDfClientX cx = login.getClientX();
ArrayList<IDfSysObject> objList = new ArrayList<IDfSysObject>();
IDfFolder toFolder = null;
String pathSourceFolder = "/otc/SourceFolder";
String pathDestinationFolder = "/otc/DestinationFolder";
IDfSysObject folderCopy = dfcService.getSession().getFolderByPath(pathSourceFolder);
objList.add(folderCopy);
toFolder = dfcService.getSession().getFolderByPath(pathDestinationFolder);
doCopyOp(objList, toFolder, cx);
} catch (DfIdentityException e) {
e.printStackTrace();
} catch (DfAuthenticationException e) {
e.printStackTrace();
} catch (DfPrincipalException e) {
e.printStackTrace();
} catch (DfServiceException e) {
e.printStackTrace();
} catch (DfException e) {
e.printStackTrace();
}
}
And here the copy operation procedure:
private static void doCopyOp(ArrayList<IDfSysObject> objList, IDfFolder toFolder, IDfClientX cx) {
try {
// #1 - manufacture an operation
IDfCopyOperation copyOpObj = cx.getCopyOperation();
// #2 - add objects to the operation for processing
for (IDfSysObject sObj : objList) {
copyOpObj.add(sObj);
}
// #3 - set copy params
copyOpObj.setCopyPreference(DfCopyOperation.COPY_COPY);
copyOpObj.setDestinationFolderId(toFolder.getObjectId());
// #4 - execute the operation
boolean result = copyOpObj.execute();
// #5 - check for errors
if (!result) {
IDfList errors = copyOpObj.getErrors();
for (int i = 0; i < errors.getCount(); i++) {
IDfOperationError err = (IDfOperationError) errors.get(i);
System.out.println("Error in Copy operation: " + err.getErrorCode() + " - " + err.getMessage());
}
} else {
// #6 - get new obj ids
// IDfList newObjs = copyOpObj.getNewObjects();
// for (int i = 0; i < newObjs.getCount(); i++) {
// IDfSysObject sObj = (IDfSysObject) newObjs.get(i);
// }
}
} catch (Exception e) {
System.out.println("Exception in Copy operation: " + e.getMessage());
e.printStackTrace();
}
}
Result:
Procedure works fine. It creates all folder hierarchy. But for some pdf file (270+ of 1500+ total) there is the fellowing error:
Error in Copy operation: 1015 - Cannot make copy of the document '<namefile>.pdf'.
All folder/files have the same ACL and app_supervisor is a superuser. Does anyone have an idea why this procedure can not make copy of these files?
Thanks all.