filenet-p8 - 使用 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()
。如果文档被归档在多个文件夹中,不知道这是如何表现的。
推荐阅读
- amazon-ses - 雅虎拒绝来自 Amazon SES 的邮件并出现 SPF 失败错误,但还在 DMARC 报告中显示 SPF 通过
- javascript - 如何将返回值存储在组件道具vue js中
- marklogic - 如何在 ml-gradle 中配置多个 REST API 服务器?
- php - 我正在使用 Cpanel UAPI,但每当我使用此 api 时,它都会返回一个错误,即无法在电子邮件类别中找到 get_lists_total_disk_usage
- python - 如何在模板中显示存储在 django 数据库中的 youtube url
- webpack - 点燃元素 | 无法将 scss 加载到 lit-element
- python - 神经网络多类分类器会自动做 argmax 吗?
- ios - 如何使用 UITextFields 在同一视图控制器中使用多个 UIPickerViews
- node.js - 如何在发布到我们的消息端点时抑制和/或增加 15 秒超时消息?-- 节点 Js
- c# - 使用 Npgsql Entity Framework Core 创建 Postgres 数据库时连接被拒绝错误