Search in sources :

Example 1 with OperationContext

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);
}
Also used : OperationContext(org.apache.chemistry.opencmis.client.api.OperationContext)

Example 2 with 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;
}
Also used : OperationContext(org.apache.chemistry.opencmis.client.api.OperationContext) CmisObject(org.apache.chemistry.opencmis.client.api.CmisObject) Folder(org.apache.chemistry.opencmis.client.api.Folder)

Aggregations

OperationContext (org.apache.chemistry.opencmis.client.api.OperationContext)2 CmisObject (org.apache.chemistry.opencmis.client.api.CmisObject)1 Folder (org.apache.chemistry.opencmis.client.api.Folder)1