Skip to content

Instantly share code, notes, and snippets.

@jpotts
Last active December 24, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpotts/6810785 to your computer and use it in GitHub Desktop.
Save jpotts/6810785 to your computer and use it in GitHub Desktop.
This is the query example from the OpenCMIS Workbench modified with a query string that shows how to query for properties defined in an Alfresco aspect using a join.
import org.apache.chemistry.opencmis.commons.*
import org.apache.chemistry.opencmis.commons.data.*
import org.apache.chemistry.opencmis.commons.enums.*
import org.apache.chemistry.opencmis.client.api.*
String cql = "SELECT D.cmis:name, T.cm:title FROM cmis:document as D join cm:titled as T on D.cmis:objectId = T.cmis:objectId"
ItemIterable<QueryResult> results = session.query(cql, false)
results.each { hit ->
hit.properties.each { println "${it.queryName}: ${it.firstValue}" }
println "--------------------------------------"
}
println "--------------------------------------"
println "Total number: ${results.totalNumItems}"
println "Has more: ${results.hasMoreItems}"
println "--------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment