简体   繁体   English

我的文件夹迁移在使用DFC的Documentum中继续失败

[英]My Folder Migration keeps on failing in Documentum using DFCs

I am working on a JavaFx project connected to Documentum data storage . 我正在研究连接到Documentum数据存储的JavaFx项目。 And I am trying to configure how to move a folder (lets call it folder11) placed in a folder (lets call it Folder1) into another folder (lets call it Folder2) . 我正在尝试配置如何将放置在一个文件夹(称为文件夹Folder1)中的文件夹(称为文件夹Folder1)移动到另一个文件夹(称为文件夹Folder2)中。 It's worth mentioning that both of the Folders are in the same cabinet . 值得一提的是,两个文件夹都在同一柜子中。 I have implemented the following 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;


    }


    }

And here is how I call it : 这就是我所说的:

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

But the problem is no matter what mo.execute always return false and the migration always fails . 但是问题是无论mo.execute总是返回false还是迁移总是失败。 Does any one know where my mistake is ? 有人知道我的错误在哪里吗? :) :)

Do you have correct / adequate permissions for that action? 您是否有正确/适当的操作权限? It seems that you don't call setSourceFolderId() . 似乎您没有调用setSourceFolderId() Check it out. 看看这个。

Also, try to use this concept to check for errors: 另外,尝试使用此概念来检查错误:

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();
  }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM