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


Java NodeIterator.skip方法代码示例

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


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

示例1: getWrappedNodesFromQuery

import javax.jcr.NodeIterator; //导入方法依赖的package包/类
/**
 * Query news items using JCR SQL2 syntax.
 *
 * @param query         Query string
 * @param maxResultSize Max results returned
 * @param pageNumber    paging number
 * @param nodeTypeName  Node type
 * @return List List of news item nodes
 * @throws javax.jcr.RepositoryException Repository Exceotopn
 */
public static List<Node> getWrappedNodesFromQuery(String query, int maxResultSize, int pageNumber, String nodeTypeName) throws RepositoryException {
    final List<Node> itemsListPaged = new ArrayList<>(0);
    final NodeIterator items = QueryUtil.search(NewsRepositoryConstants.COLLABORATION, query, Query.JCR_SQL2, nodeTypeName);

    // Paging result set
    final int startRow = (maxResultSize * (pageNumber - 1));
    if (startRow > 0) {
        try {
            items.skip(startRow);
        } catch (NoSuchElementException e) {
            LOGGER.error("No more news items found beyond this item number: {}", startRow);
        }
    }

    int count = 1;
    while (items.hasNext() && count <= maxResultSize) {
        itemsListPaged.add(new I18nNodeWrapper(items.nextNode()));
        count++;
    }
    return itemsListPaged;
}
 
开发者ID:tricode,项目名称:magnolia-news,代码行数:32,代码来源:NewsJcrUtils.java

示例2: getWrappedNodesFromQuery

import javax.jcr.NodeIterator; //导入方法依赖的package包/类
private static List<Node> getWrappedNodesFromQuery(String query, int maxResultSize, int pageNumber, String nodeTypeName, String workspace) throws RepositoryException {
    final List<Node> itemsListPaged = new ArrayList<>(0);
    final NodeIterator items = QueryUtil.search(workspace, query, Query.JCR_SQL2, nodeTypeName);

    // Paging result set
    final int startRow = (maxResultSize * (pageNumber - 1));
    if (startRow > 0) {
        try {
            items.skip(startRow);
        } catch (NoSuchElementException e) {
            LOGGER.info("No more blog items found beyond this item number: {}", startRow);
        }
    }

    int count = 1;
    while (items.hasNext() && count <= maxResultSize) {
        itemsListPaged.add(new I18nNodeWrapper(items.nextNode()));
        count++;
    }
    return itemsListPaged;
}
 
开发者ID:tricode,项目名称:magnolia-blog,代码行数:22,代码来源:BlogJcrUtils.java

示例3: getAll

import javax.jcr.NodeIterator; //导入方法依赖的package包/类
@Override
public List<T> getAll(String path, NodeFilter nodeFilter, long startIndex, long resultSize) {
    try {
        NodeIterator nodeIterator = getNodes(path);
        nodeIterator.skip(startIndex);
        return toList(nodeIterator, nodeFilter, resultSize);
    } catch (RepositoryException e) {
        throw new JcrMappingException("Could not get nodes", e);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:11,代码来源:AbstractJcrDAO.java

示例4: findAll

import javax.jcr.NodeIterator; //导入方法依赖的package包/类
@Override
public List<T> findAll(String rootPath, NodeFilter nodeFilter, long startIndex, long resultSize) {
    try {
        NodeIterator nodeIterator = getNode(rootPath).getNodes();
        nodeIterator.skip(startIndex);
        return toList(nodeIterator, nodeFilter, resultSize);
    } catch (RepositoryException e) {
        throw new JcrMappingException("Could not find nodes", e);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:11,代码来源:AbstractJcrDAO.java

示例5: findByXPath

import javax.jcr.NodeIterator; //导入方法依赖的package包/类
/**
 * Find JCR nodes that match the xpath supplied, and map to objects.
 * 
 * @param xpath the XPath for finding the nodes
 * @param nodeFilter the NodeFilter to apply when updating child nodes and references
 * @param startIndex the zero based index of the first item to return
 * @param resultSize the number of items to return
 * @return a list of all objects found
 */
protected List<T> findByXPath(String xpath, NodeFilter nodeFilter, long startIndex, long resultSize) {
    try {
        QueryManager queryManager = getSession().getWorkspace().getQueryManager();
        Query query = queryManager.createQuery(xpath, Query.XPATH);
        QueryResult result = query.execute();
        NodeIterator nodeIterator = result.getNodes();
        nodeIterator.skip(startIndex);
        return toList(nodeIterator, nodeFilter, resultSize);
    } catch (RepositoryException e) {
        throw new JcrMappingException("Could not find nodes by XPath", e);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:22,代码来源:AbstractJcrDAO.java

示例6: findBySql

import javax.jcr.NodeIterator; //导入方法依赖的package包/类
/**
 * Find JCR nodes that match the SQL supplied, and map to objects.
 * 
 * @param sql the SQL for finding the nodes
 * @param nodeFilter the NodeFilter to apply when updating child nodes and references
 * @param startIndex the zero based index of the first item to return
 * @param resultSize the number of items to return
 * @return a list of all objects found
 */
protected List<T> findBySql(String sql, NodeFilter nodeFilter, long startIndex, long resultSize) {
    try {
        QueryManager queryManager = getSession().getWorkspace().getQueryManager();
        Query query = queryManager.createQuery(sql, Query.JCR_SQL2);
        QueryResult result = query.execute();
        NodeIterator nodeIterator = result.getNodes();
        nodeIterator.skip(startIndex);
        return toList(nodeIterator, nodeFilter, resultSize);
    } catch (RepositoryException e) {
        throw new JcrMappingException("Could not find nodes by SQL", e);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:22,代码来源:AbstractJcrDAO.java


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