Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase CMIS result limit from 100 to 1000

We are using Alfresco as a repository and querying it using Apache CMIS api.

We use below code to connect it.

parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/atom?maxItems=1000");

Querying alfresco...

OperationContext opCon = session.createOperationContext();
opCon.setLoadSecondaryTypeProperties(true);
opCon.setMaxItemsPerPage(1000);
session.query(queryStr); 

But the CMIS always returns 100 records only. But when I use standalone CMIS workbench program and give the above URL to connect to Alfresco with maxItems=1000, it returns 1000 records.

The maxItems parameter is not working when I use my JAVA CMIS api.

Please help.

Thank you

like image 706
Sam Avatar asked Mar 07 '23 03:03

Sam


2 Answers

I got it working...

While querying to Alfresco, I was not passing the OperationContext where I set the page size.

OperationContext opCon = session.createOperationContext();
opCon.setLoadSecondaryTypeProperties(true);
opCon.setMaxItemsPerPage(1000);
session.query(queryStr, false);  // wrong....
session.query(queryStr, false, opCon);  // right

Now when I iterate to the ItemIterable, I am getting more than 100 results.

Thanks to everyone for their time and help!

like image 184
Sam Avatar answered Mar 11 '23 09:03

Sam


I don't think you can get around this issue.

https://issues.alfresco.com/jira/browse/ALF-20766?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

like image 32
Lista Avatar answered Mar 11 '23 10:03

Lista