AnsweredAssumed Answered

Help on CMIS Query using IN_TREE condition

Question asked by sepgs2004 on Jun 14, 2016
Latest reply on Jun 22, 2016 by sepgs2004
Using Alfresco Community edition 5.0.d

I am using CMIS 1.1 Atom Pub URL: http://test-alfresco:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom

My libraries
<code language="xml">
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-api</artifactId>
<version>0.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.13.0</version>
</dependency>
</code>

In Alfresco Share, I verified the id of the folder. The folder that I am talking about is the documentLibrary folder under a specific site. On the documentLibrary folder, if I see view properties, or even if I see the browser URL, I see this below.

http://test-alfresco:8080/share/page/context/mine/folder-details?nodeRef=workspace://SpacesStore/6c3fd5c2-1a69-48a6-8d04-d39339ba53ec

Also, in my code using CMIS API, if I get the CmisObject of this documentLibrary folder, it has this id 6c3fd5c2-1a69-48a6-8d04-d39339ba53ec

Using the Share App, I see all the documents under this folder, but under some sub folders.

However, if I construct my query using the above id with the IN_TREE clause, I do not get these documents (images) in the results.
I tried CMIS workbench to cross check. I am glad it behaves the same way as my code.

My CMIS workbench query is
<code language="sql">
SELECT doc.*, salo.* FROM cmis:document AS doc JOIN salo:documentProperties AS salo ON doc.cmis:objectId = salo.cmis:objectId 
WHERE IN_TREE(doc, 'workspace://SpacesStore/6c3fd5c2-1a69-48a6-8d04-d39339ba53ec') 
AND (salo.salo:lo_key = 163) AND (salo.salo:lo_category = 'Test')
</code>

If I remove the IN_TREE clause, query brings all the documents. All these documents are under one of the folders under this documentLibrary folder. I verified this using Alfresco Share.

Appreciate your help

Outcomes