问题描述
我想通过一个查询从符合 cmis 1.0 的存储库中过滤文件夹的子级.到目前为止,这似乎不可能,所以我已经决定执行两个查询来检索子项(即文件夹和文档),但是仍然想按自定义类型过滤子项,因此我有以下查询:
I would like to filter the children of folders from a cmis 1.0 compliant repository with one query. So far that doesn't seem to be possible so I have settled to execute two queries to retrieve the children (i.e. folders and documents), however would still like to filter children by custom types so I have the following query:
SELECT cmis:objectTypeId, cmis:objectId FROM cmis:folder WHERE cmis:objectTypeId = 'my:custom1' OR cmis:objectTypeId = 'my:custom2' OR cmis:objectTypeId = 'cmis:folder' IN_FOLDER('workspace://SpacesStore/fhj738tw-45hW-659u-9DS1-9cX3Nh95r089')
这不起作用,因为我不断收到有关不匹配输入的错误.
Which doesn't work as I keep getting an error about mismatched input.
推荐答案
我使用这个查询是为了获取特定文件夹
I've used this query in order to get children of a particular folder
String query;
query = "SELECT * FROM cmis:document WHERE IN_FOLDER('" + folderId + "')";
并得到所有的孩子
ItemIterable<QueryResult> resultList = session.query(query, false);// No need to say about session ???
最后
for (QueryResult qr : resultList) {
String idDocument = qr.getPropertyByQueryName("cmis:objectId").getFirstValue().toString();
Document doc = (Document) session.getObject(idDocument);
}
注意,在我的例子中,我只得到 cmis:objectId
你可以从 Cmis 查询
Note that in my example i only get cmis:objectId
you can get more from Cmis Query
希望能帮到你.
这篇关于如何使用cmis查询过滤文件夹子项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!