Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.Constraint


        ConstraintSplitter splitter = new ConstraintSplitter(
                constraint, qomFactory,
                merger.getLeftSelectors(), merger.getRightSelectors());

        Source left = join.getLeft();
        Constraint leftConstraint = splitter.getLeftConstraint();
        QueryResult leftResult =
            execute(null, left, leftConstraint, null, 0, -1);
        List<Row> leftRows = new ArrayList<Row>();
        for (Row row : JcrUtils.getRows(leftResult)) {
            leftRows.add(row);
        }

        RowIterator rightRows;
        Source right = join.getRight();
        List<Constraint> rightConstraints =
            merger.getRightJoinConstraints(leftRows);
        if (rightConstraints.size() < 500) {
            Constraint rightConstraint = Constraints.and(
                    qomFactory,
                    Constraints.or(qomFactory, rightConstraints),
                    splitter.getRightConstraint());
            rightRows =
                execute(null, right, rightConstraint, null, 0, -1).getRows();
        } else {
            List<Row> list = new ArrayList<Row>();
            for (int i = 0; i < rightConstraints.size(); i += 500) {
                Constraint rightConstraint = Constraints.and(
                        qomFactory,
                        Constraints.or(qomFactory, rightConstraints.subList(
                                i, Math.min(i + 500, rightConstraints.size()))),
                        splitter.getRightConstraint());
                QueryResult rigthResult =
View Full Code Here


        int columnParseIndex = parseIndex;
        ArrayList<ColumnOrWildcard> list = parseColumns();
        read("FROM");
        Source source = parseSource();
        Column[] columnArray = resolveColumns(columnParseIndex, 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

        assertEquals("[nt:base]",
                f.selector(NodeType.NT_BASE, null).toString());
       
        Source source1 = f.selector(NodeType.NT_BASE, "selector");
        Column[] columns = new Column[] { f.column("selector", null, null) };
        Constraint constraint2 = f.childNode("selector", "/");
        QueryObjectModel qom = f.createQuery(source1, constraint2, null,
                columns);
        assertEquals("select [selector].* from " +
                "[nt:base] AS [selector] " +
                "where ISCHILDNODE([selector], [/])", qom.toString());
View Full Code Here

                "where ISCHILDNODE([selector], [/])", qom.toString());
    }

    @Test
    public void and() throws RepositoryException {
        Constraint c0 = f.propertyExistence("x", "c0");
        Constraint c1 = f.propertyExistence("x", "c1");
        And and = f.and(c0, c1);
        assertEquals(and.getConstraint1(), c0);
        assertEquals(and.getConstraint2(), c1);
        assertEquals("([x].[c0] IS NOT NULL) AND ([x].[c1] IS NOT NULL)", and.toString());
    }
View Full Code Here

        assertEquals("NAME()", f.nodeName(null).toString());
    }

    @Test
    public void not() throws RepositoryException {
        Constraint c = f.propertyExistence("x", "c0");
        Not n = f.not(c);
        assertEquals(c, n.getConstraint());
        assertEquals("[x].[c0] IS NOT NULL", c.toString());
       
        assertEquals("* IS NOT NULL", f.propertyExistence(null, null).toString());
        assertEquals("[s].* IS NOT NULL", f.propertyExistence("s", null).toString());
        assertEquals("[p] IS NOT NULL", f.propertyExistence(null, "p").toString());
        assertEquals("[s].[p] IS NOT NULL", f.propertyExistence("s", "p").toString());
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.