cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS WORKBENCH QUERY LIMIT

cyrose22
Star Contributor
Star Contributor

Hi All,

Is there a possible way to get all data using the CMIS Workbench QUERY?

based on my testing I've just get only 100 data instead of 100,000+ data in our production.

How?

Thanks,

Cyrus Nhiel

8 REPLIES 8

cyrose22
Star Contributor
Star Contributor

any ideas?

Simple answer is: NO

Alternatives: https://angelborroy.wordpress.com/2018/05/30/alfresco-counting-more-than-1000-elements/

Hyland Developer Evangelist

Angel Borroy‌ Hi borry I've already found a solution for this and I've gather more than 100,000 data from my query. Thanks for the response

And can you share your findings with us?

Hyland Developer Evangelist

Angel Borroy‌ Sure, First before entering the WORKBENCH , in the url http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom?maxItems=100000 add the maxItems you want , then in the  groovy script

just add

String cql = "SELECT * FROM cmis:document"

OperationContext opCon = session.createOperationContext();
opCon.setLoadSecondaryTypeProperties(true);
opCon.setMaxItemsPerPage(100000);

ItemIterable<QueryResult> results = session.query(cql, false, opCon)

Then u can get the data you want

No more configurations?

This does not work for me.

Hyland Developer Evangelist

Angel Borroy‌ in our case there's no configuration and we're using modified db table.

Angel Borroy‌ in our case here's my full code, I've extracted it and download it to csv file

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.*
import org.apache.chemistry.opencmis.client.util.*   

   String cql = "SELECT ap:apXxX FROM ap:apXXX where ap:apxxx <> 'POSTED'"
   

  OperationContext opCon = session.createOperationContext();
  opCon.setLoadSecondaryTypeProperties(true);
  opCon.setMaxItemsPerPage(100000);

      ItemIterable<QueryResult> results = session.query(cql, false, opCon)

      File file = new File("C:/xxx/xxx/xxx/xxx/PONum.csv");

      for(QueryResult hit: results) {
            for(PropertyData<?> property: hit.getProperties()) {
           String queryName = property.getQueryName();
           Object value = property.getFirstValue();
           file.append(value+"\n");
      }
}