當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。