Package org.apache.jackrabbit.spi.commons.query.jsr283.qom

Examples of org.apache.jackrabbit.spi.commons.query.jsr283.qom.Constraint


    public void testComparison() throws RepositoryException {
        PropertyValue op1 = qomFactory.propertyValue(propertyName1);
        BindVariableValue op2 = qomFactory.bindVariable(VARIABLE_NAME);
        for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
            int operator = ((Integer) it.next()).intValue();
            Comparison comp = qomFactory.comparison(op1, operator, op2);
            assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
            assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
            assertEquals("Wrong operator", operator, comp.getOperator());
        }
    }
View Full Code Here


        read("SELECT");
        ArrayList 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

        }
    }

    // Page 136
    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;
    }

    // Page 138
    private Constraint parseCondition() throws RepositoryException {
        Constraint a;
        if (readIf("NOT")) {
            a = parseConstraint();
        } else if (readIf("(")) {
            a = parseConstraint();
            read(")");
View Full Code Here

        return a;
    }

    // Page 141
    private Constraint parseCondition(DynamicOperand left) throws RepositoryException {
        Constraint c;
        if (readIf("=")) {
            c = factory.comparison(left,
                    QueryObjectModelConstants.OPERATOR_EQUAL_TO,
                    parseStaticOperand());
        } else if (readIf("<>")) {
View Full Code Here

        }
    }

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

                                           JoinCondition condition,
                                           Constraint left,
                                           Constraint right)
            throws RepositoryException {
        // only consider nodes under test root
        Constraint constraint;
        if (joinType == JOIN_TYPE_LEFT_OUTER) {
            constraint = qomFactory.descendantNode(LEFT, testRoot);
        } else {
            constraint = qomFactory.descendantNode(RIGHT, testRoot);
        }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#descendantNode(String)}
     */
    public void testDescendantNode() throws RepositoryException {
        DescendantNode descNode = qomFactory.descendantNode(testRootNode.getPath());
        assertNull("Selector must be null", descNode.getSelectorName());
        assertEquals("Wrong path", testRootNode.getPath(), descNode.getPath());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#descendantNode(String, String)}
     */
    public void testDescendantNodeWithSelector() throws RepositoryException {
        DescendantNode descNode = qomFactory.descendantNode(SELECTOR_NAME1, testRootNode.getPath());
        assertEquals("Wrong selector name", SELECTOR_NAME1, descNode.getSelectorName());
        assertEquals("Wrong path", testRootNode.getPath(), descNode.getPath());
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.commons.query.jsr283.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.