Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.QueryObjectModel


        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n1, n1}, {n2, n2}});
    }

    public void testInnerJoinWithPath() throws RepositoryException {
        QueryObjectModel qom = createQomQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, nodeName2);
        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n2, n1}});
    }
View Full Code Here


        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n2, n1}});
    }

    public void testLeftOuterJoin() throws RepositoryException {
       QueryObjectModel qom = qomFactory.createQuery(
               qomFactory.join(
                       qomFactory.selector(testNodeType, LEFT),
                       qomFactory.selector(mixReferenceable, RIGHT),
                       AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER,
                       qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
               qomFactory.descendantNode(LEFT, testRoot),
               null, null);

        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n1, null}, {n2, n2}});
    }
View Full Code Here

        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n1, null}, {n2, n2}});
    }

    public void testLeftOuterJoinWithPath() throws RepositoryException {
        QueryObjectModel qom = createQomQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, nodeName2);
        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n1, null}, {n2, n1}});
    }
View Full Code Here

        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n1, null}, {n2, n1}});
    }

    public void testRightOuterJoin() throws RepositoryException {
        QueryObjectModel qom = qomFactory.createQuery(
                qomFactory.join(
                        qomFactory.selector(mixReferenceable, LEFT),
                        qomFactory.selector(testNodeType, RIGHT),
                        AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER,
                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
                qomFactory.descendantNode(RIGHT, testRoot),
                null, null);

        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{null, n1}, {n2, n2}});
    }
View Full Code Here

        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{null, n1}, {n2, n2}});
    }

    public void testRightOuterJoinWithPath() throws RepositoryException {
        QueryObjectModel qom = qomFactory.createQuery(
                qomFactory.join(
                        qomFactory.selector(mixReferenceable, LEFT),
                        qomFactory.selector(testNodeType, RIGHT),
                        AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER,
                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)),
                qomFactory.descendantNode(RIGHT, testRoot),
                null, null);

        QueryResult result = qom.execute();
        checkResult(result, new Node[][]{{n2, n1}, {null, n2}});
    }
View Full Code Here

        }
    }

    public void testCreateQuery() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
        QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertNull("Constraint must be null", qom.getConstraint());
        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }
View Full Code Here

    }

    public void testCreateQueryWithConstraint() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
        QueryObjectModel qom = qomFactory.createQuery(
                selector, propExist, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }
View Full Code Here

    public void testCreateQueryWithConstraintAndOrdering() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering ordering = qomFactory.ascending(propValue);
        QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                new Ordering[]{ordering}, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }
View Full Code Here

        Selector selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
        PropertyExistence propExist = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyValue propValue = qomFactory.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering ordering = qomFactory.ascending(propValue);
        Column column = qomFactory.column(SELECTOR_NAME1, propertyName1, null);
        QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                new Ordering[]{ordering}, new Column[]{column});
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 1, qom.getColumns().length);
    }
View Full Code Here

        assertEquals("Wrong size of columns", 1, qom.getColumns().length);
    }

    public void testCreateQueryFromSource() throws RepositoryException {
        Source selector = qomFactory.selector(testNodeType, SELECTOR_NAME1);
        QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertNull("Constraint must be null", qom.getConstraint());
        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }
View Full Code Here

TOP

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

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.