use of org.apache.chemistry.opencmis.client.api.OperationContext in project camel by apache.
the class CMISSessionFacade method executeQuery.
public ItemIterable<QueryResult> executeQuery(String query) {
OperationContext operationContext = session.createOperationContext();
operationContext.setMaxItemsPerPage(pageSize);
return session.query(query, false, operationContext);
}
use of org.apache.chemistry.opencmis.client.api.OperationContext in project camel by apache.
the class RecursiveTreeWalker method processFolderRecursively.
int processFolderRecursively(Folder folder) throws Exception {
processFolderNode(folder);
OperationContext operationContext = cmisConsumer.createOperationContext();
operationContext.setMaxItemsPerPage(pageSize);
int count = 0;
int pageNumber = 0;
boolean finished = false;
ItemIterable<CmisObject> itemIterable = folder.getChildren(operationContext);
while (!finished) {
ItemIterable<CmisObject> currentPage = itemIterable.skipTo(count).getPage();
LOG.debug("Processing page {}", pageNumber);
for (CmisObject child : currentPage) {
if (CMISHelper.isFolder(child)) {
Folder childFolder = (Folder) child;
processFolderRecursively(childFolder);
} else {
processNonFolderNode(child, folder);
}
count++;
if (totalPolled == readCount) {
finished = true;
break;
}
}
pageNumber++;
if (!currentPage.getHasMoreItems()) {
finished = true;
}
}
return totalPolled;
}
Aggregations