Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.QueryObjectModel


    }

    public void testLeftOuterJoin1() throws RepositoryException {
        JoinCondition c = qomFactory.equiJoinCondition(
                LEFT, propertyName1, RIGHT, propertyName2);
        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
        checkResult(qom.execute(), new Node[][]{{n1, n2}, {n2, n2}});
    }
View Full Code Here



    public void testLeftOuterJoin2() throws RepositoryException {
        JoinCondition c = qomFactory.equiJoinCondition(
                LEFT, propertyName2, RIGHT, propertyName1);
        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
        checkResult(qom.execute(), new Node[][]{{n1, null}, {n2, n1}, {n2, n2}});
    }
View Full Code Here

        testRootNode.save();
    }

    public void testInnerJoin() throws RepositoryException {
        JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c);
        checkResult(qom.execute(), new Node[][]{{n2, n1}});
    }
View Full Code Here

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

    public void testRightOuterJoin() throws RepositoryException {
        JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_RIGHT_OUTER, c);
        checkResult(qom.execute(), new Node[][]{{n2, n1}, {null, n2}});
    }
View Full Code Here

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

    public void testLeftOuterJoin() throws RepositoryException {
        JoinCondition c = qomFactory.descendantNodeJoinCondition(LEFT, RIGHT);
        QueryObjectModel qom = createQuery(AbstractJoinTest.JCR_JOIN_TYPE_LEFT_OUTER, c);
        List result = new ArrayList();
        result.add(new Node[]{n2, n1});
        // for each ancestor-or-self of testRootNode check
        // whether it is of type testNodeType and add
        // two matches in that case
        Node n = testRootNode;
        for (;;) {
            if (n.isNodeType(testNodeType)) {
                result.add(new Node[]{n1, n});
                result.add(new Node[]{n2, n});
            }
            if (n.getDepth() == 0) {
                break;
            } else {
                n = n.getParent();
            }
        }
        if (result.size() == 1) {
            // n1 not yet covered
            result.add(new Node[]{n1, null});
        }
        checkResult(qom.execute(), (Node[][]) result.toArray(new Node[result.size()][]));
    }
View Full Code Here

        formatLiteral("CAST(true AS STRING)", "'true'");
    }

    private void formatLiteral(String literal, String cast) throws Exception {
        String s = "SELECT TEST.* FROM TEST WHERE ID=" + literal;
        QueryObjectModel qom = parser.createQueryObjectModel(s);
        String s2 = QOMFormatter.format(qom);
        String cast2 = s2.substring(s2.indexOf('=') + 1).trim();
        assertEquals(cast, cast2);
        qom = parser.createQueryObjectModel(s);
        s2 = QOMFormatter.format(qom);
View Full Code Here

                continue;
            }
            // System.out.println(line);
            String query = line;
            try {
                QueryObjectModel qom = parser.createQueryObjectModel(line);
                String s = QOMFormatter.format(qom);
                qom = parser.createQueryObjectModel(s);
                String s2 = QOMFormatter.format(qom);
                assertEquals(s, s2);
                fuzz(line);
View Full Code Here

        superuser.save();
    }

    public void testInnerJoin() throws RepositoryException {
        JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c);
        checkQOM(qom, new Node[][]{{n2, n1}});
    }
View Full Code Here

        checkQOM(qom, new Node[][]{{n2, n1}});
    }

    public void testRightOuterJoin() throws RepositoryException {
        JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, c);
        checkQOM(qom, new Node[][]{{n2, n1}, {null, n2}});
    }
View Full Code Here

        checkQOM(qom, new Node[][]{{n2, n1}, {null, n2}});
    }

    public void testLeftOuterJoin() throws RepositoryException {
        JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
        QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
        List result = new ArrayList();
        result.add(new Node[]{n2, n1});
        if (testRootNode.isNodeType(testNodeType)) {
            result.add(new Node[]{n1, testRootNode});
        } else {
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.