如何使用 com.filenet.wcm.api 更改 Filenet 文档 MimeType

How to change Filenet document MimeType using com.filenet.wcm.api

我是 FileNet 的新手。我们正在使用 P8 Content Engine - 5.1.0.2 我需要使用 Filenet WCM API 更改现有文档的 MimeType。解决方法是下载文档、更改 MimeType 并重新上传文档,但在这种情况下,documnet Id 将被更改。我更喜欢更新现有文档而不是重新上传文档。

基本上,我需要通过 Filenet WCM API 以编程方式执行 Changing the content element MIME type 中描述的相同操作。

密码是

public boolean changeDocumnetMimeType(String documentId, String docMimeType) throws IOException {

    com.filenet.wcm.api.TransportInputStream in1 = null;
    com.filenet.wcm.api.ObjectStore docObjectStore;
    com.filenet.wcm.api.Session session;

    try {

        session = ObjectFactory.getSession(this.applicationId, null, this.user,this.password);
        session.setRemoteServerUrl(this.remoteServerUrl);
        session.setRemoteServerUploadUrl(this.remoteServerUploadUrl);
        session.setRemoteServerDownloadUrl(this.remoteServerDownloadUrl);

        docObjectStore = ObjectFactory.getObjectStore(this.objectStoreName, session);
        Document doc = (Document) docObjectStore.getObject(BaseObject.TYPE_DOCUMENT, documentId);
        in1 = doc.getContent();
        System.out.println("documnet MIME type is : " + in1.getMimeType());
        //how to Update mimeType for the document???

    } catch (Exception ex) {
        ex.printStackTrace();
    }

    if (in1 != null) {
        in1.close();
    }

    return true;
}

提前谢谢你。

FileNet 是一个 EDMS 系统,它以面向对象的方式构建记录。

FileNet 文档对象是从 FileNet 文档 Class 中实例化的。 无论使用 API,FileNet 都不允许对 MimeType 进行更新。 这是 MimeType 属性.

的约束

IBM FileNet MimeType Properties

上面的 link 定义了 MimeType 属性,并显示其约束: 这里的关键点是:可设置性:SETTABLE_ONLY_BEFORE_CHECKIN

这意味着 MimeType 属性 只能在 Versionable 对象的 RESERVATION 状态期间设置。不可版本控制的对象(如注释)不能有此约束。