Package org.apache.jackrabbit.commons.iterator

Examples of org.apache.jackrabbit.commons.iterator.RowIterable


     * @throws RepositoryException
     *         if the {@link QueryResult#getRows()} call fails
     */
    public static Iterable<Row> getRows(QueryResult result)
            throws RepositoryException {
        return new RowIterable(result.getRows());
    }
View Full Code Here


     * @throws RepositoryException
     *         if the {@link QueryResult#getRows()} call fails
     */
    public static Iterable<Row> getRows(QueryResult result)
            throws RepositoryException {
        return new RowIterable(result.getRows());
    }
View Full Code Here

    public QueryResult merge(RowIterator leftRows, RowIterator rightRows)
            throws RepositoryException {
        RowIterator joinRows;

        Map<String, List<Row>> map = new HashMap<String, List<Row>>();
        for (Row row : new RowIterable(rightRows)) {
            for (String value : getRightValues(row)) {
                List<Row> rows = map.get(value);
                if (rows == null) {
                    rows = new ArrayList<Row>();
                    map.put(value, rows);
                }
                rows.add(row);
            }
        }

        if (!map.isEmpty()) {
            List<Row> rows = new ArrayList<Row>();
            for (Row leftRow : new RowIterable(leftRows)) {
                for (String value : getLeftValues(leftRow)) {
                    List<Row> matchingRows = map.get(value);
                    if (matchingRows != null) {
                        for (Row rightRow : matchingRows) {
                            rows.add(mergeRow(leftRow, rightRow));
View Full Code Here

        superuser.save();

        List<String> r1 = new ArrayList<String>();
        QueryResult result = qm.createQuery(testPath + "/*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r1.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r2 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r2.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r3 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r3.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        assertEquals(r1, r2);
        assertEquals(r1, r3);
View Full Code Here

        superuser.save();

        List<String> r1 = new ArrayList<String>();
        QueryResult result = qm.createQuery(testPath + "/*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r1.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r2 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r2.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r3 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r3.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        assertEquals(r1, r2);
        assertEquals(r1, r3);
View Full Code Here

     * @throws RepositoryException
     *         if the {@link QueryResult#getRows()} call fails
     */
    public static Iterable<Row> getRows(QueryResult result)
            throws RepositoryException {
        return new RowIterable(result.getRows());
    }
View Full Code Here

        superuser.save();

        List<String> r1 = new ArrayList<String>();
        QueryResult result = qm.createQuery(testPath + "/*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r1.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r2 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r2.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r3 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r3.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        assertEquals(r1, r2);
        assertEquals(r1, r3);
View Full Code Here

        session.save();

        QueryManager qm = session.getWorkspace().getQueryManager();
        Query q = qm.createQuery("//element(*, nt:folder)", Query.XPATH);
        Set<String> paths = new HashSet<String>();
        for (Row r : new RowIterable(q.execute().getRows())) {
            paths.add(r.getPath());
        }
        assertEquals(new HashSet<String>(Arrays.asList("/folder1", "/folder2", "/folder2/folder3")),
                paths);
    }
View Full Code Here

     * @throws RepositoryException
     *         if the {@link QueryResult#getRows()} call fails
     */
    public static Iterable<Row> getRows(QueryResult result)
            throws RepositoryException {
        return new RowIterable(result.getRows());
    }
View Full Code Here

     * @throws RepositoryException
     *         if the {@link QueryResult#getRows()} call fails
     */
    public static Iterable<Row> getRows(QueryResult result)
            throws RepositoryException {
        return new RowIterable(result.getRows());
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.commons.iterator.RowIterable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.