简体   繁体   English

如何在 Filenet 中存储 pdf 文档

[英]How to Store a pdf document in Filenet

Im new to IBM filenet.我是 IBM 文件网的新手。 I just got the webservice url of the CMIS filenet.我刚刚得到了 CMIS 文件网的网络服务 URL。

My requirement is to store a PDF document got from one system using apache camel route to filenet.我的要求是将使用 apache 骆驼路由从一个系统获取的 PDF 文档存储到 filenet。 Tried importing the wsdl in SOAP UI and i can see set of APIs like createDocument, createFolder etc., Is there a simple way of testing these APIs.尝试在 SOAP UI 中导入 wsdl,我可以看到一组 API,如 createDocument、createFolder 等,是否有一种简单的方法来测试这些 API。 First at least i want to simple test in java at least to store a document in filenet.首先至少我想在java中进行简单的测试,至少将文档存储在filenet中。 Please help me out in understanding.请帮助我理解。

To add any kind of document you need to check-in that document to any specific folder of FileNet ObjectStore.要添加任何类型的文档,您需要将该文档签入到 FileNet ObjectStore 的任何特定文件夹中。

For this all you need a document path or its byteArray, to create fileinputstream, which you want to insert in ObjectStore.为此,您需要一个文档路径或其 byteArray,以创建要插入 ObjectStore 的文件输入流。

Code to create document,创建文档的代码,

  1. Create Connection to your content engine创建与内容引擎的连接
  2. Ref code may it will help you参考代码可能会帮助你

public static void insertDocument(Connection conn, String domainName) {
    // Get domain.
    Domain domain = Factory.Domain.fetchInstance(conn, domainName, null);
    ObjectStoreSet osColl = domain.get_ObjectStores();

    // Get each object store.
    Iterator iterator = osColl.iterator();
    while (iterator.hasNext()) {
        // Get next object store.
        ObjectStore objStore = (ObjectStore) iterator.next();

        // Get the display name of the object store.
        String objStoreName = objStore.get_DisplayName();
        System.out.println("Object store name = " + objStoreName);

        // Create a document instance.
        Document doc = Factory.Document.createInstance(objStore, ClassNames.DOCUMENT);

        // Set document properties.
        doc.getProperties().putValue("DocumentTitle", "New Document via Java API");
        doc.set_MimeType("text/plain"); // if its your pdf then set mimetype for PDF

        doc.save(RefreshMode.NO_REFRESH);

        // Check in the document.
        doc.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY, CheckinType.MAJOR_VERSION);
        doc.save(RefreshMode.NO_REFRESH);

        // File the document.
        Folder folder = Factory.Folder.getInstance(objStore, ClassNames.FOLDER, new Id("{42A3FC29-D635-4C37-8C86-84BAC73FFA3F}")); // id of folder to which you want to store document.
        ReferentialContainmentRelationship rcr = folder.file(doc, AutoUniqueName.AUTO_UNIQUE, "New Document via Java API",
                DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
        rcr.save(RefreshMode.NO_REFRESH);
    }
}

In order to troubleshoot the CMIS, I usually follow the general steps that I compiled for you below.为了对CMIS进行故障排除,我通常按照下面为您编译的一般步骤进行操作。 saying this, I would highly advise you to create unit tests for each of your operations as you go and I promise it will save you a lot of time and effort说到这里,我强烈建议您在进行时为每个操作创建单元测试,我保证这会为您节省大量时间和精力

  1. Start Fiddler [ a ].启动 Fiddler [ a ]。
  2. Start CMIS Workbench.启动 CMIS 工作台。 0.8.0 [ b ] and later automatically proxies requests, at least on Windows 7. 0.8.0 [ b ] 及更高版本会自动代理请求,至少在 Windows 7 上是这样。
  3. Logon to a repository登录到存储库
  4. Optionally navigate to a folder. (可选)导航到文件夹。
  5. Create Document.创建文档。 Leave the Generate content field at 0 bytes if creating a doc without a content stream.如果创建没有内容流的文档,请将生成内容字段保留为 0 字节。 Select Email or other type.选择电子邮件或其他类型。
  6. Go to Fiddler and find the POST (status code will be 201).转到 Fiddler 并找到 POST(状态代码将为 201)。

The request should have Content-Type: application/atom+xml;type=entry, and the properties, cmis:name and cmis:objectTypeid, in the cmisra:object element.该请求应具有内容类型:application/atom+xml;type=entry,以及 cmisra:object 元素中的属性 cmis:name 和 cmis:objectTypeid。

a.一种。 http://www.fiddler2.com/fiddler2/ b. http://www.fiddler2.com/fiddler2/ b. http://chemistry.apache.org/java/download.html http://chemistry.apache.org/java/download.html

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

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