How to filter folder children using cmis query?

纵然是瞬间 提交于 2019-12-20 06:06:05

问题


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.


回答1:


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 + "')";

and to get all the children

ItemIterable<QueryResult> resultList = session.query(query, false);// No need to say about session ???

and finally

for (QueryResult qr : resultList) {

String idDocument = qr.getPropertyByQueryName("cmis:objectId").getFirstValue().toString();
Document doc = (Document) session.getObject(idDocument);

}

Note that in my example i only get cmis:objectId you can get more from Cmis Query

Hope that will help you.



来源:https://stackoverflow.com/questions/39458669/how-to-filter-folder-children-using-cmis-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!