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.
}我已经尝试在文档中搜索属性和类描述。但是找不到路径。?
发布于 2020-02-01 03:26:14
我建议您浏览一下FileNet文档中的“创建DynamicReferentialContainmentRelationship对象”部分:
一个FileNet文档可以被分配到多个文件夹中,因此对于一个给定的文档,您可以有几个逻辑“路径”。
最后,您应该得到类似于"Folder.get_PathName() + DynamicReferentialContainmentRelationship.get_Name()“”的内容来显示完整的路径名。
如FileNet文档中的示例所述,关系对象(例如DynamicReferentialContainmentRelationship)控制文档/文件夹的关系:
myRelationshipObject.set_Head(myDocument);
myRelationshipObject.set_Tail(myFolder);
发布于 2020-02-05 20:24:34
要在一个查询中完成所有这些操作(就像您在代码中尝试做的那样),您可以创建一个与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()方法的第三个参数,可以优化查询代码。如果文档被归档在多个文件夹中,我不知道这是如何表现的。
发布于 2020-01-30 22:53:50
来自FileNet Content Engine - Database Table for Physical path的tl;dr
使用散列算法将
文档存储在叶级别的目录中,以便在这些叶目录中均匀分布文件。
https://stackoverflow.com/questions/59987653
复制相似问题