Skip to content

Instantly share code, notes, and snippets.

@jpotts

jpotts/query-aspect.groovy

Last active Dec 24, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.