使用FILENET API在2个filenet服务器之间下载和上传

时间:2015-02-20 13:52:40

标签: java filenet-p8 filenet-content-engine

我有2个filenet Server.i想从第一台服务器下载文件并上传到第二台服务器。是否可以使用FILENET API?

1 个答案:

答案 0 :(得分:1)

这应该是可能的。如果我正确理解你的问题,它应该是这样的:

    ObjectStore os1 = Factory.GetOSForSystem1();//create some function to get the object store for system one and for system two
    ObjectStore os2 = Factory.GetOSForSystem2();
    Document d = Factory.Document.fetchInstance(os1, "guid", null);//fetch the document from the first system

    Document newDoc = Factory.Document.createInstance(os2, "Document");//create the document in the second system
    //create contentlist for reservation object
    ContentElementList cteList = Factory.ContentElement.createList();

    //Create content transfer object and get the content from the current version
    ContentTransfer ctNew = Factory.ContentTransfer.createInstance();
    ContentTransfer ct = (ContentTransfer) d.get_ContentElements().get(0);
    //get the content as a contentstream to prevent reuse and read only error.
    ctNew.setCaptureSource(ct.accessContentStream());
    ctNew.set_RetrievalName(ct.get_RetrievalName());
    //add the new content to the list and add the list to the reservation
    cteList.add(ctNew); 
    newDoc.set_ContentElements(cteList);
    newDoc.save(RefreshMode.NO_REFRESH);//if you do not need the document after the save say no refresh, saves system resources