【问题标题】:Fetch absolute or relative path using file object in IBM filenet使用 IBM filenet 中的文件对象获取绝对或相对路径
【发布时间】:2020-01-30 13:56:16
【问题描述】:
String mySQLString = "select * from document where documentTitle like '%test%' ";
SearchSQL sql = new SearchSQL(mySQLString);
IndependentObjectSet s = search.fetchObjects(sql, 10, null, true);
Document doc;
PageIterator iterator = s.pageIterator();
iterator.nextPage();

for (Object object : iterator.getCurrentPage()) {
    doc = (Document) object;
    Properties properties = doc.getProperties();
    //I am trying to get an absolute or relative path here for every document.
    // for eg: /objectstorename/foldername/filename like this.
}

我尝试在 document 中搜索属性和类描述。但无法找到路径。 ?

【问题讨论】:

  • 没有“文档路径”之类的东西。文档可以归档在多个文件夹中,也可以根本无法归档。您应该检查相应的ReferentialContainmentRelationship 对象。
  • 或者,您可以使用FoldersFiledIn 属性和随附的get_FoldersFiledIn() 方法。

标签: filenet-p8 filenet-content-engine


【解决方案1】:

要在一个查询中完成所有操作(就像您在代码中尝试做的那样),您可以创建与ReferentialContainmentRelationship 表的连接。该表的属性Head指向文档,属性Tail指向文档填写的文件夹,属性ContainmentName是文档在文件夹中的名称。使用以下代码构造文档路径:

SearchSQL searchSQL = new SearchSQL("SELECT R.ContainmentName, R.Tail, D.This FROM Document AS D WITH INCLUDESUBCLASSES INNER JOIN ReferentialContainmentRelationship AS R WITH INCLUDESUBCLASSES ON D.This = R.Head WHERE DocumentTitle like '%test%'");
SearchScope searchScope = new SearchScope(objectStore);
RepositoryRowSet objects = searchScope.fetchRows(searchSQL, null, null, null);
Iterator<RepositoryRow> iterator = objects.iterator();

while (iterator.hasNext()) {
    RepositoryRow repositoryRow = iterator.next();
    Properties properties = repositoryRow.getProperties();
    Folder folder = (Folder) properties.get("Tail").getEngineObjectValue();
    String containmentName = properties.get("ContainmentName").getStringValue();

    System.out.println(folder.get_PathName() + "/" + containmentName);
}

以这种方式构造的路径也可用于从对象存储中获取对象。可以通过使用属性过滤器作为fetchRows() 方法的第三个参数来优化查询代码。不知道如果文档被归档在多个文件夹中会如何表现。

【讨论】:

    【解决方案2】:

    我建议您浏览 FileNet 文档的“创建 DynamicReferentialContainmentRelationship 对象”部分:

    https://www.ibm.com/support/knowledgecenter/SSNW2F_5.5.0/com.ibm.p8.ce.dev.ce.doc/containment_procedures.htm#containment_procedures__fldr_creating_a_drcr

    一个 FileNet Ddocument 可以分配给多个文件夹,因此对于给定的文档,您可以有多个逻辑“路径”。

    最后,您应该得到类似“Folder.get_PathName() + DynamicReferentialContainmentRelationship.get_Name()”的东西来显示完整的路径名。

    如 FileNet 文档中的示例所述,关系对象(例如 DynamicReferentialContainmentRelationship)控制文档/文件夹的关系:

    myRelationshipObject.set_Head(myDocument);

    myRelationshipObject.set_Tail(myFolder);

    另外,请记住,FileNet 文档也可以是“未归档”文档,因此没有要检索的实际“路径名”或文件夹“关系”。

    【讨论】:

      【解决方案3】:

      tl;dr 来自FileNet Content Engine - Database Table for Physical path

      文档存储在叶级别的目录中,使用哈希算法在这些叶目录之间均匀分布文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-17
        • 1970-01-01
        • 1970-01-01
        • 2022-06-10
        • 2011-02-07
        • 2012-10-25
        相关资源
        最近更新 更多