newFolderProps.put(PropertyIds.NAME, "ADGFolderPaging");
Folder folderPaging = root.createFolder(newFolderProps);
createFolders(folderPaging, 10);
System.out.println("Getting page of length 3 from item 5");
OperationContext operationContext = new OperationContextImpl();
operationContext.setMaxItemsPerPage(3);
ItemIterable<CmisObject> children1 = folderPaging.getChildren(operationContext);
int count = 0;
for (CmisObject child : children1.skipTo(5).getPage()) {
System.out.println("object " + count + " in page of " + children1.getPageNumItems()
+ " is " + child.getName());
count++;
}
// operationContext = new OperationContextImpl();
// operationContext.setMaxItemsPerPage(3);
// children1 = folderPaging.getChildren(operationContext);
// int pageNumber = 0;
// count = 1;
// while (count > 0) {
// count = 0;
// for (CmisObject child : children1.skipTo(
// pageNumber * operationContext.getMaxItemsPerPage()).getPage()) {
// System.out.println("object " + count + " in page" + pageNumber +
// " is "
// + child.getName());
// count++;
// }
// pageNumber++;
// }
System.out.println("Getting complete result set in pages of 3");
operationContext = new OperationContextImpl();
operationContext.setMaxItemsPerPage(3);
children1 = folderPaging.getChildren(operationContext);
int pageNumber = 0;
boolean finished = false;
while (!finished) {
count = 0;
ItemIterable<CmisObject> currentPage = children1.skipTo(
pageNumber * operationContext.getMaxItemsPerPage()).getPage();
for (CmisObject item : currentPage) {
System.out.println("object " + count + " in page" + pageNumber + " is "
+ item.getName());
count++;
}