Examples of QueryResult


Examples of javax.jcr.query.QueryResult

       
        MockControl queryCtrl = MockControl.createControl(Query.class);
        Query query = (Query) queryCtrl.getMock();

        MockControl resultCtrl = MockControl.createControl(QueryResult.class);
        QueryResult result = (QueryResult) resultCtrl.getMock();

        sessionControl.expectAndReturn(session.getWorkspace(), ws);
        wsCtrl.expectAndReturn(ws.getQueryManager(), qm);
        qmCtrl.expectAndReturn(qm.createQuery(stmt1, language), query);
        qmCtrl.expectAndReturn(qm.createQuery(stmt2, language), query);
View Full Code Here

Examples of javax.jcr.query.QueryResult

          Query query = manager.createQuery(statement, lang);
          if (debug)
            logger.debug("created query " + query);

          QueryResult result;
          try {
            result = query.execute();
            map.put(statement, result);
          }
          catch (RepositoryException e) {
View Full Code Here

Examples of javax.jcr.query.QueryResult

     * {@inheritDoc}
     */
    public QueryResult execute() throws RepositoryException {
        checkInitialized();
        long time = System.nanoTime();
        QueryResult result = sessionContext.getSessionState().perform(
                new SessionOperation<QueryResult>() {
                    public QueryResult perform(SessionContext context)
                            throws RepositoryException {
                        return query.execute(offset, limit);
                    }
View Full Code Here

Examples of javax.jcr.query.QueryResult

        setInitialized();
    }

    public QueryResult execute() throws RepositoryException {
        long time = System.nanoTime();
        final QueryResult result = sessionContext.getSessionState().perform(
                new SessionOperation<QueryResult>() {
                    public QueryResult perform(SessionContext context)
                            throws RepositoryException {
                        final QueryEngine engine = new QueryEngine(
                                sessionContext.getSessionImpl(), lqf, variables);
View Full Code Here

Examples of javax.jcr.query.QueryResult

            StringBuilder stmt = new StringBuilder();
            stmt.append("//*[@").append(ISO9075.encode(name));
            stmt.append(" = '").append(data.getId()).append("']");
            Query q = session.getWorkspace().getQueryManager().createQuery(
                    stmt.toString(), Query.XPATH);
            QueryResult result = q.execute();
            ArrayList<Property> l = new ArrayList<Property>();
            for (NodeIterator nit = result.getNodes(); nit.hasNext();) {
                Node n = nit.nextNode();
                l.add(n.getProperty(name));
            }
            if (l.isEmpty()) {
                return PropertyIteratorAdapter.EMPTY;
View Full Code Here

Examples of javax.jcr.query.QueryResult

    public QueryResult execute(Column[] columns, Source source,
            Constraint constraint, Ordering[] orderings, long offset, long limit)
            throws RepositoryException {
        long time = System.currentTimeMillis();
        QueryResult qr = execute(columns, source, constraint, orderings,
                offset, limit, 2);
        log.debug("SQL2 QUERY execute took {} ms. native sort is {}.",
                System.currentTimeMillis() - time, NATIVE_SORT);
        return qr;
    }
View Full Code Here

Examples of javax.jcr.query.QueryResult

        logQueryAnalysis(csInfo, printIndentation);

        boolean isOuterJoin = JCR_JOIN_TYPE_LEFT_OUTER.equalsIgnoreCase(join
                .getJoinType());
        QueryResult result = execute(merger, csInfo, isOuterJoin,
                printIndentation);

        long sort = System.currentTimeMillis();
        QueryResult sortedResult = sort(result, orderings, evaluator, offset,
                limit);
        log.debug(" {} SQL2 SORT took {} ms.", genString(printIndentation),
                System.currentTimeMillis() - sort);
        return sortedResult;
    }
View Full Code Here

Examples of javax.jcr.query.QueryResult

            log.debug("{} SQL2 JOIN execute: there are multiple inner splits.",
                    genString(printIndentation));

            // first branch
            long bTime = System.currentTimeMillis();
            QueryResult branch1 = execute(merger,
                    csInfo.getLeftInnerConstraints(), isOuterJoin,
                    printIndentation + printIndentStep);
            Set<Row> allRows = new TreeSet<Row>(new RowPathComparator(
                    Arrays.asList(merger.getSelectorNames())));
            RowIterator ri1 = branch1.getRows();
            while (ri1.hasNext()) {
                Row r = ri1.nextRow();
                allRows.add(r);
            }
            log.debug("{} SQL2 JOIN executed first branch, took {} ms.",
                    genString(printIndentation), System.currentTimeMillis()
                            - bTime);

            // second branch
            bTime = System.currentTimeMillis();
            QueryResult branch2 = execute(merger,
                    csInfo.getRightInnerConstraints(), isOuterJoin,
                    printIndentation + printIndentStep);
            RowIterator ri2 = branch2.getRows();
            while (ri2.hasNext()) {
                Row r = ri2.nextRow();
                allRows.add(r);
            }
            log.debug("{} SQL2 JOIN executed second branch, took {} ms.",
View Full Code Here

Examples of javax.jcr.query.QueryResult

                    comparator, printIndentation + printIndentStep));
            return leftRows;
        }

        Set<Row> leftRows = new TreeSet<Row>(comparator);
        QueryResult leftResult = execute(null, csi.getSource().getLeft(),
                csi.getLeftConstraint(), null, 0, -1, printIndentation);
        for (Row row : JcrUtils.getRows(leftResult)) {
            leftRows.add(row);
        }
        return leftRows;
View Full Code Here

Examples of javax.jcr.query.QueryResult

                    csi.getRightConstraint());
            if (ignoreWhereConstraints) {
                rightConstraint = Constraints.or(qomFactory,
                        localRightContraints);
            }
            QueryResult rightResult = execute(null, csi.getSource().getRight(),
                    rightConstraint, null, 0, -1, printIndentation);
            for (Row row : JcrUtils.getRows(rightResult)) {
                rightRows.add(row);
            }
            return rightRows;
        }

        // the 'batch by 500' approach
        Set<Row> rightRows = new TreeSet<Row>(comparator);
        for (int i = 0; i < rightConstraints.size(); i += 500) {
            if (log.isDebugEnabled()) {
                log.debug(genString(printIndentation)
                        + "SQL2 JOIN RIGHT SIDE executing batch # " + i + ".");
            }
            List<Constraint> localRightContraints = rightConstraints.subList(i,
                    Math.min(i + 500, rightConstraints.size()));
            Constraint rightConstraint = Constraints.and(qomFactory,
                    Constraints.or(qomFactory, localRightContraints),
                    csi.getRightConstraint());
            if (ignoreWhereConstraints) {
                rightConstraint = Constraints.or(qomFactory,
                        localRightContraints);
            }

            QueryResult rightResult = execute(null, csi.getSource().getRight(),
                    rightConstraint, null, 0, -1, printIndentation);
            for (Row row : JcrUtils.getRows(rightResult)) {
                rightRows.add(row);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.