【问题标题】:How to change Filenet document MimeType using com.filenet.wcm.api如何使用 com.filenet.wcm.api 更改 Filenet 文档 MimeType
【发布时间】:2019-04-12 06:11:03
【问题描述】:

我是 FileNet 的新手。我们正在使用 P8 内容引擎 - 5.1.0.2 我需要使用 Filenet WCM API 更改现有文档的 MimeType。 Workuround 是下载文档,更改 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;
}

提前谢谢你。

【问题讨论】:

  • 您所要求的无法完成。文档对象无法更新 contentElements,除非它们是保留的。 MimeType(称为 ContentType)是 ContentTransfer 对象的一个​​属性。 ContentTransfer 对象保存在 ContentElementList 中。
  • @Christopher Powell 不确定我是否理解您的评论。它不能使用 Document 对象完成还是不能通过 WCM API 完成?该代码只是我尝试为该任务实现的测试示例。
  • 无论您使用哪个 API,FileNet 系统都不会让 Document Object(或 Document 的子类)更改已签入的内容。这是(FileNet)文档类的一个约束。然而,注释类将允许在没有保留的情况下更改内容。 FileNet 的结构很像 OOP 语言。您基于文档类创建文档对象。
  • @ChristopherPowell 所以,唯一的选择是创建具有相同内容和新 MimeType 的新文档网并删除旧文档网?谢谢
  • 是的。您需要新的预订,因此您需要签出,将内容替换为不同的 MimeType,然后签入。

标签: mime-types filenet-p8 filenet-content-engine


【解决方案1】:

FileNet 是一个 EDMS 系统,它以 OOP 方式构造其记录。

FileNet Document 对象从 FileNet Document Class 实例化。 无论使用何种 API,FileNet 都不允许对 MimeType 进行更新。 这是 MimeType 属性的约束。

IBM FileNet MimeType Properties

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

这意味着 MimeType 属性只能在 Versionable 对象的 RESERVATION 状态期间设置。 Non-Versionable 对象(如 Annotations)不能有这个约束。

【讨论】:

  • 简单地说,这是不可能的,因为版本控制假定任何持久文档版本的内容都是只读的。而 MIME 类型是内容的固有属性。 PS“FileNet”不是一个系统。这是被 IBM 收购的公司的名称。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多