Hi all,I'm working with Alfresco Community 4.0.e through CMIS.In a Java class I have a query that find all documents in a specified folder:
SELECT *
FROM cmis:document
WHERE IN_FOLDER('workspace://SpacesStore/d588e663-7dc4-48b2-be8e-b6044584f769')
this query give mi 28 results and I want to have pagination every 25 results.In my Java class I have:
ItemIterable<QueryResult> risultati = <SOMETHING>.getSession(Security.connectedUser()).query(query,false);
At this point I try to have pagination of my results but I have tried in different ways but with no result.I introduced in the code the OperationContext because I have tried this approach <a>http://forums.alfresco.com/forum/developer-discussions/alfresco-api/opencmis-extension-paging-problem-03162012-0844</a><em>(the code below is extracted from above topic and adapted)</em>
Session session = cmisClient.getSession();
OperationContext operationContext = new OperationContextImpl();
operationContext.setMaxItemsPerPage(25);
String queryString = <MYQUERY>;
ItemIterable<QueryResult> results = session.query(queryString, false,operationContext);
int pageNumber = 0;
boolean finished = false;
int count = 0;
while (!finished) {
ItemIterable<QueryResult> currentPage = results.skipTo(count).getPage();
for (QueryResult qResult : currentPage) {
<SOME LOGIC>
count++;
}
pageNumber++;
if (!currentPage.getHasMoreItems())
finished = true;
}
but in ItemIterable<QueryResult> currentPage = results.skipTo(count).getPage();
after first 25 results I have a CmisRuntimeException because currentaPage have no data …but where are 3 records after 25???Thanks in advance.