使用 IBM filenet 中的文件对象获取绝对或相对路径


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.
}

我尝试在文档中搜索属性和类描述。 但找不到路径。

若要在单个查询中完成所有操作(就像您在代码中尝试执行的操作一样(,可以使用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()方法的第三个参数,可以优化查询代码。不知道如果文档归档在多个文件夹中,这将如何表现。

我建议您浏览FileNet文档的"创建动态引用包含关系对象"部分:

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 文档中的示例所述,关系对象(例如 DynamicReferentialContainmentRelations(控制文档/文件夹的关系:

myRelationshipObject.set_Head(我的文档(;

myRelationshipObject.set_Tail(我的文件夹(;

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

tl;来自 FileNet 内容引擎的 dr - 物理路径的数据库表

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

最新更新