当前位置: 首页>>代码示例>>Java>>正文


Java ItemIterable.getPageNumItems方法代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.client.api.ItemIterable.getPageNumItems方法的典型用法代码示例。如果您正苦于以下问题:Java ItemIterable.getPageNumItems方法的具体用法?Java ItemIterable.getPageNumItems怎么用?Java ItemIterable.getPageNumItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.chemistry.opencmis.client.api.ItemIterable的用法示例。


在下文中一共展示了ItemIterable.getPageNumItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processCMISEvent

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unused")
protected EventResult processCMISEvent(Event event) throws Exception
{
    super.suspendTimer();                           // Timer control
    
    CMISEventData data = (CMISEventData) event.getData();
    // A quick double-check
    if (data == null)
    {
        return new EventResult("Unable to get CMIS root folder; no session provided.", false);
    }
    if (data.getBreadcrumb().isEmpty())
    {
        return new EventResult("Unable to get CMIS folder listing; no folder provided.", false);
    }
    Folder folder = data.getBreadcrumb().getLast();

    // Get details of how to page, etc
    OperationContext ctx = data.getSession().getDefaultContext();
    int pageSize = ctx.getMaxItemsPerPage();
    
    super.resumeTimer();                            // Timer control
    ItemIterable<CmisObject> children = folder.getChildren();
    long totalChildren = children.getTotalNumItems();               // For information only
    int pageCount = 0;
    // We have to iterate using paging
    long skip = 0L;
    ItemIterable<CmisObject> pageOfChildren = children.skipTo(skip);
    while (pageOfChildren.getPageNumItems() > 0L)
    {
        pageCount++;
        for (CmisObject cmisObject : pageOfChildren)
        {
            skip++;
        }
        // Get the next page of children
        pageOfChildren = children.skipTo(skip);
    }
    super.stopTimer();                              // Timer control

    // Done
    Event doneEvent = new Event(eventNameFolderContentsListed, data);
    EventResult result = new EventResult(
            BasicDBObjectBuilder
                .start()
                .append("msg", "Successfully retrieved folder listing.")
                .push("folder")
                    .append("id", folder.getId())
                    .append("name", folder.getName())
                .push("paging")
                    .append("pageSize", pageSize)
                    .append("totalChildren", totalChildren)
                    .append("pageCount", pageCount)
                .pop()
                .get(),
            doneEvent);
    
    // Done
    return result;
}
 
开发者ID:AlfrescoBenchmark,项目名称:benchmark-cmis,代码行数:62,代码来源:ListFolderContents.java

示例2: processCMISEvent

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unused")
protected EventResult processCMISEvent(Event event) throws Exception
{
    super.suspendTimer();                               // Timer control
    
    CMISEventData data = (CMISEventData) event.getData();
    // A quick double-check
    if (data == null)
    {
        return new EventResult("Unable to upload file; no session provided.", false);
    }
    if (data.getBreadcrumb().isEmpty())
    {
        return new EventResult("Unable to upload file; no folder provided.", false);
    }
    Folder folder = data.getBreadcrumb().getLast();
    
    // Get details of how to page, etc
    OperationContext ctx = data.getSession().getDefaultContext();
    int pageSize = ctx.getMaxItemsPerPage();
    
    // Get a random string
    String[] searchStrings = getSearchStrings();
    String searchString = AbstractCMISEventProcessor.getRandomSearchString(searchStrings);
    String query = String.format(
            "SELECT D.* FROM cmis:document D WHERE IN_FOLDER('%s') AND CONTAINS('%s')",
            folder.getId(),
            searchString);

    super.resumeTimer();
    ItemIterable<QueryResult> queryResults = data.getSession().query(query, false);
    long totalResults = queryResults.getTotalNumItems();               // For information only
    int pageCount = 0;
    // We have to iterate using paging
    long skip = 0L;
    ItemIterable<QueryResult> pageOfResults = queryResults.skipTo(skip);
    while (pageOfResults.getPageNumItems() > 0L)
    {
        pageCount++;
        for (QueryResult queryResult : pageOfResults)
        {
            skip++;
        }
        // Get the next page of children
        pageOfResults = queryResults.skipTo(skip);
    }
    super.stopTimer();                              // Timer control
    
    // Done
    Event doneEvent = new Event(eventNameSearchCompleted, data);
    EventResult result = new EventResult(
            BasicDBObjectBuilder
                .start()
                .append("msg", "Successfully searched in folder.")
                .append("query", query)
                .push("folder")
                    .append("id", folder.getId())
                    .append("name", folder.getName())
                .push("paging")
                    .append("pageSize", pageSize)
                    .append("totalResults", totalResults)
                    .append("pageCount", pageCount)
                .pop()
                .get(),
            doneEvent);
    
    // Done
    return result;
}
 
开发者ID:AlfrescoBenchmark,项目名称:benchmark-cmis,代码行数:71,代码来源:SearchInFolder.java


注:本文中的org.apache.chemistry.opencmis.client.api.ItemIterable.getPageNumItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。