Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.Join


        Selector s1 = qf.selector(ntBase, SELECTOR_NAME1);
        Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1);
        JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
        for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
            String joinType = (String) it.next();
            Join join = qf.join(s1, s2, joinType, cond);
            assertTrue("Not a selector source", join.getLeft() instanceof Selector);
            assertTrue("Not a selector source", join.getRight() instanceof Selector);
            assertEquals("Wrong join type", joinType, join.getJoinType());
            assertTrue("Not an EquiJoinCondition", join.getJoinCondition() instanceof EquiJoinCondition);
        }
    }
View Full Code Here


        // Swap the join sources to normalize all outer joins to left
        if (JCR_JOIN_TYPE_RIGHT_OUTER.equalsIgnoreCase(join.getJoinType())) {
            log.debug(
                    "{} SQL2 RIGHT OUTER JOIN transformed to LEFT OUTER JOIN.",
                    genString(printIndentation));
            Join betterJoin = qomFactory.join(join.getRight(), join.getLeft(),
                    JCR_JOIN_TYPE_LEFT_OUTER, join.getJoinCondition());
            return execute(columns, betterJoin, constraint, orderings, offset,
                    limit, printIndentation);
        }
        JoinMerger merger = JoinMerger.getJoinMerger(join,
View Full Code Here

        if (source instanceof Selector) {
            Selector selector = (Selector) source;
            return Collections.singletonMap(selector.getSelectorName(),
                    getNodeType(selector));
        } else if (source instanceof Join) {
            Join join = (Join) source;
            Map<String, NodeType> map = new LinkedHashMap<String, NodeType>();
            map.putAll(getSelectorNames(join.getLeft()));
            map.putAll(getSelectorNames(join.getRight()));
            return map;
        } else {
            throw new UnsupportedRepositoryOperationException(
                    "Unknown source type: " + source);
        }
View Full Code Here

            throws RepositoryException {
        if (source instanceof Selector) {
            Selector selector = (Selector) source;
            return Collections.singleton(selector.getSelectorName());
        } else if (source instanceof Join) {
            Join join = (Join) source;
            Set<String> set = new LinkedHashSet<String>();
            set.addAll(getSelectorNames(join.getLeft()));
            set.addAll(getSelectorNames(join.getRight()));
            return set;
        } else {
            throw new UnsupportedRepositoryOperationException(
                    "Unknown source type: " + source);
        }
View Full Code Here

        Selector s1 = qf.selector(ntBase, SELECTOR_NAME1);
        Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1);
        JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
        for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
            String joinType = (String) it.next();
            Join join = qf.join(s1, s2, joinType, cond);
            assertTrue("Not a selector source", join.getLeft() instanceof Selector);
            assertTrue("Not a selector source", join.getRight() instanceof Selector);
            assertEquals("Wrong join type", joinType, join.getJoinType());
            assertTrue("Not an EquiJoinCondition", join.getJoinCondition() instanceof EquiJoinCondition);
        }
    }
View Full Code Here

        if (source instanceof Selector) {
            Selector selector = (Selector) source;
            return execute(
                    columns, selector, constraint, orderings, offset, limit);
        } else if (source instanceof Join) {
            Join join = (Join) source;
            if (join.getJoinType() == JCR_JOIN_TYPE_RIGHT_OUTER) {
                // Swap the join sources to normalize all outer joins to left
                join = qomFactory.join(
                        join.getRight(), join.getLeft(),
                        JCR_JOIN_TYPE_LEFT_OUTER, join.getJoinCondition());
            }
            return execute(
                    columns, join, constraint, orderings, offset, limit);
        } else {
            throw new UnsupportedRepositoryOperationException(
View Full Code Here

        if (source instanceof Selector) {
            Selector selector = (Selector) source;
            return Collections.singletonMap(
                    selector.getSelectorName(), getNodeType(selector));
        } else if (source instanceof Join) {
            Join join = (Join) source;
            Map<String, NodeType> map = new LinkedHashMap<String, NodeType>();
            map.putAll(getSelectorNames(join.getLeft()));
            map.putAll(getSelectorNames(join.getRight()));
            return map;
        } else {
            throw new UnsupportedRepositoryOperationException(
                    "Unknown source type: " + source);
        }
View Full Code Here

    @Test
    public void join() throws RepositoryException {
        Source left = f.selector("nodeTypeName", "selectorName");
        Source right = f.selector("nodeTypeName2", "selectorName2");
        ChildNodeJoinCondition jc = f.childNodeJoinCondition("childSelectorName", "parentSelectorName");
        Join j = f.join(left, right, QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, jc);
        assertEquals(left, j.getLeft());
        assertEquals(right, j.getRight());
        assertEquals(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, j.getJoinType());
        assertEquals(jc, j.getJoinCondition());
        assertEquals("ISCHILDNODE([childSelectorName], [parentSelectorName])", jc.toString());
    }
View Full Code Here

    @Test
    public void join() throws RepositoryException {
        Source left = f.selector("nodeTypeName", "selectorName");
        Source right = f.selector("nodeTypeName2", "selectorName2");
        ChildNodeJoinCondition jc = f.childNodeJoinCondition("childSelectorName", "parentSelectorName");
        Join j = f.join(left, right, QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, jc);
        assertEquals(left, j.getLeft());
        assertEquals(right, j.getRight());
        assertEquals(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, j.getJoinType());
        assertEquals(jc, j.getJoinCondition());
    }
View Full Code Here

            constraint = qf.and(constraint, left);
        }
        if (right != null) {
            constraint = qf.and(constraint, right);
        }
        Join join = qf.join(
                qf.selector(testNodeType, LEFT),
                qf.selector(testNodeType, RIGHT),
                joinType,
                condition);
        return qf.createQuery(join, constraint, null, null);
View Full Code Here

TOP

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

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.