09-07-2018 05:39 AM
Hello
There are 300 files inside the folder, 100 files have the P:cm:emailed secondary type property.
Following code takes 30 seconds to run, because Im getting all 300 items, asking each item if you have the P:cm:emailed secondary type property or not.
Would it be possible to return only items with P:cm:emailed secondary type property?
09-07-2018 04:07 PM
How about doing a join on the aspect and then using a contains/path for the folder path:
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:objectId, D.cmis:name FROM cmis:document as D join cm:emailed as E on D.cmis:objectId = E.cmis:objectId where CONTAINS(D, 'PATH:\"/app:company_home/cm:test//*\"')"
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 "--------------------------------------"
Explore our Alfresco products with the links below. Use labels to filter content by product module.