Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.Constraint


        }

        if (rightConstraints.size() < 500) {
            Set<Row> rightRows = new TreeSet<Row>(comparator);
            List<Constraint> localRightContraints = rightConstraints;
            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);
            }
            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);
View Full Code Here


    private String format() throws RepositoryException {
        append("SELECT ");
        append(qom.getColumns());
        append(" FROM ");
        append(qom.getSource());
        Constraint c = qom.getConstraint();
        if (c != null) {
            append(" WHERE ");
            append(c);
        }
        Ordering[] orderings = qom.getOrderings();
View Full Code Here

        append(")");
    }

    private void append(Not constraint) throws RepositoryException {
        append("NOT ");
        Constraint c = constraint.getConstraint();
        boolean paren = c instanceof And || c instanceof Or;
        if (paren) {
            append("(");
        }
        append(c);
View Full Code Here

            splitBySelectors(constraint, getSelectorNames(constraint));
        }
    }

    private void splitNot(Not not) throws RepositoryException {
        Constraint constraint = not.getConstraint();
        if (constraint instanceof Not) {
            split(((Not) constraint).getConstraint());
        } else if (constraint instanceof And) {
            And and = (And) constraint;
            split(factory.or(
View Full Code Here

        read("SELECT");
        ArrayList<ColumnOrWildcard> list = parseColumns();
        read("FROM");
        Source source = parseSource();
        Column[] columnArray = resolveColumns(list);
        Constraint constraint = null;
        if (readIf("WHERE")) {
            constraint = parseConstraint();
        }
        Ordering[] orderings = null;
        if (readIf("ORDER")) {
View Full Code Here

            return factory.equiJoinCondition(selector1, property1, selector2, readName());
        }
    }

    private Constraint parseConstraint() throws RepositoryException {
        Constraint a = parseAnd();
        while (readIf("OR")) {
            a = factory.or(a, parseAnd());
        }
        return a;
    }
View Full Code Here

        }
        return a;
    }

    private Constraint parseAnd() throws RepositoryException {
        Constraint a = parseCondition();
        while (readIf("AND")) {
            a = factory.and(a, parseCondition());
        }
        return a;
    }
View Full Code Here

        }
        return a;
    }

    private Constraint parseCondition() throws RepositoryException {
        Constraint a;
        if (readIf("NOT")) {
            a = factory.not(parseConstraint());
        } else if (readIf("(")) {
            a = parseConstraint();
            read(")");
View Full Code Here

        }
        return a;
    }

    private Constraint parseCondition(DynamicOperand left) throws RepositoryException {
        Constraint c;
        if (readIf("=")) {
            c = Operator.EQ.comparison(factory, left, parseStaticOperand());
        } else if (readIf("<>")) {
            c = Operator.NE.comparison(factory, left, parseStaticOperand());
        } else if (readIf("<")) {
View Full Code Here

    private PropertyExistence getPropertyExistence(PropertyValue p) throws InvalidQueryException, RepositoryException {
        return factory.propertyExistence(p.getSelectorName(), p.getPropertyName());
    }

    private Constraint parseConditionFuntionIf(String functionName) throws RepositoryException {
        Constraint c;
        if ("CONTAINS".equalsIgnoreCase(functionName)) {
            String name = readName();
            if (readIf(".")) {
                if (readIf("*")) {
                    read(",");
View Full Code Here

TOP

Related Classes of javax.jcr.query.qom.Constraint

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.