4

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

Sam
  • 2,972
  • 6
  • 34
  • 62

3 Answers3

6

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!

Sam
  • 2,972
  • 6
  • 34
  • 62
1

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

Lista
  • 2,186
  • 1
  • 15
  • 18
  • Thanks for the reply...I will also try to put this in Alfresco forums..... – Sam Jan 12 '18 at 18:20
  • Just to make things clear, there's nothing Alfresco configuration related that can be done; it depends on the client. – Lista Jan 14 '18 at 14:18
0

Instead of creating a new operation context, you can use the default context to configure a session. The following will work as expected.

session.getDefaultContext().setMaxItemsPerPage(1000);
session.query(queryStr); 
Croo
  • 1,301
  • 2
  • 13
  • 32