问题描述
我想用一个查询从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
,您可以从中获取更多信息
Note that in my example i only get cmis:objectId
you can get more from Cmis Query
希望对您有所帮助。
这篇关于如何使用cmis查询过滤子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!