gpt4 book ai didi

java - 在使用 DFC 的 Documentum 中,我的文件夹迁移不断失败

转载 作者:行者123 更新时间:2023-12-01 09:23:18 26 4
gpt4 key购买 nike

我正在开发一个连接到 Documentum 数据存储的 JavaFx 项目。我正在尝试配置如何将放置在文件夹(我们称之为Folder1)中的文件夹(我们称之为Folder11)移动到另一个文件夹(我们称之为Folder2)。值得一提的是,这两个文件夹位于同一个柜子中。我已经实现了以下类(class):

package application;

import com.documentum.com.DfClientX;
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.DfClient;
import com.documentum.fc.client.IDfDocument;
import com.documentum.fc.client.IDfFolder;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfId;
import com.documentum.operations.IDfMoveNode;
import com.documentum.operations.IDfMoveOperation;

public class Migrate {
public Migrate(){}
public String move ( IDfSession mySession,String docId, String destination){
String str ="";
try{

IDfClientX clientx = new DfClientX();

IDfMoveOperation mo = clientx . getMoveOperation();


IDfFolder destinationDirectory = mySession . getFolderByPath(destination);


mo.setDestinationFolderId(destinationDirectory . getObjectId());


IDfFolder doc = (IDfFolder) mySession . getObject(new DfId(docId));

//System.out.println(doc); The output is : com.documentum.fc.client.DfFolder___PROXY@ec9178
//System.out.println(mo.execute); output is : true
IDfMoveNode node = (IDfMoveNode)mo.add(doc);
// System.out.println(node); the output : com.documentum.operations.nodes.impl.DfMoveNode@1ad8a67
//System.out.println(mo.execute); output is : false

if (!mo.execute()) {
str= "Move operation faild . ";
}
else {
str = "Move operation success . ";
}
}catch(DfException e){
System.out.println(e.getLocalizedMessage());
}catch(Exception e){

System.out.println(e.getLocalizedMessage());
}


return str;


}


}

我是这样调用它的:

 Migrate test = new Migrate();
System.out.println(test.move(_session, "0b01b66980028599" ,"Cabinet/LEXOPEDIA/Sateri/Hong Kong" ));

但问题是,无论怎样 mo.execute 总是返回 false 并且迁移总是失败。有谁知道我的错误在哪里? :)

最佳答案

您是否拥有执行该操作的正确/足够的权限?您似乎没有调用 setSourceFolderId()。一探究竟。

另外,尝试使用这个concept检查错误:

private void doMoveOp(ArrayList objList, IDfFolder fromFolder, IDfFolder toFolder ) {

try {

// #1 - manufacture an operation
IDfMoveOperation moveOpObj = cx.getMoveOperation();

// #2 - add objects to the operation for processing
for (IDfSysObject sObj : objList) {
moveOpObj.add(sObj);
}

// #3 - set the source and target folder
moveOpObj.setDestinationFolderId(toFolder.getObjectId());
moveOpObj.setSourceFolderId(fromFolder.getObjectId());

// #4 - execute the operation
boolean result = moveOpObj.execute();

// #5 - check for errors
if (!result) {
IDfList errors = moveOpObj.getErrors();
for (int i=0; i<errors.getCount(); i++) {
IDfOperationError err = (IDfOperationError) errors.get(i);
System.out.println("Error in Move operation: " + err.getErrorCode() + " - " + err.getMessage());
}
} else {
// #6 - get new obj ids
IDfList newObjs = moveOpObj.getObjects();
for (int i=0; i<newObjs.getCount(); i++) {
IDfSysObject sObj = (IDfSysObject) newObjs.get(i);
System.out.println("\tmoved object " + sObj.getObjectId().toString());
}
}

} catch(Exception e) {
System.out.println("Exception in Move operation: " + e.getMessage());
e.printStackTrace();
}

}

关于java - 在使用 DFC 的 Documentum 中,我的文件夹迁移不断失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40016931/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com