protected JoinMerger( Join join, Map<String, PropertyValue> columns, OperandEvaluator evaluator, QueryObjectModelFactory factory) throws RepositoryException { this.type = join.getJoinType(); this.leftSelectors = getSelectorNames(join.getLeft()); this.rightSelectors = getSelectorNames(join.getRight()); Set<String> selectors = new LinkedHashSet<String>(); selectors.addAll(leftSelectors); selectors.addAll(rightSelectors); this.selectorNames = selectors.toArray(new String[selectors.size()]); this.columns = columns; this.columnNames = columns.keySet().toArray(new String[columns.size()]); this.evaluator = evaluator; this.factory = factory; }
protected JoinMerger( Join join, Map<String, PropertyValue> columns, OperandEvaluator evaluator, QueryObjectModelFactory factory) throws RepositoryException { this.type = join.getJoinType(); this.leftSelectors = getSelectorNames(join.getLeft()); this.rightSelectors = getSelectorNames(join.getRight()); Set<String> selectors = new LinkedHashSet<String>(); selectors.addAll(leftSelectors); selectors.addAll(rightSelectors); this.selectorNames = selectors.toArray(new String[selectors.size()]); this.columns = columns; this.columnNames = columns.keySet().toArray(new String[columns.size()]); this.evaluator = evaluator; this.factory = factory; }
/** * Test case for {@link QueryObjectModelFactory#join(Source, Source, String, JoinCondition)} */ public void testJoin() throws RepositoryException { Selector s1 = qf.selector(ntBase, SELECTOR_NAME1); Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1); JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType); for (Iterator<String> it = JOIN_TYPES.iterator(); it.hasNext(); ) { String joinType = 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); } }
long limit, int printIndentation) throws RepositoryException { if (JCR_JOIN_TYPE_RIGHT_OUTER.equalsIgnoreCase(join.getJoinType())) { log.debug( "{} SQL2 RIGHT OUTER JOIN transformed to LEFT OUTER JOIN.", .getJoinType()); QueryResult result = execute(merger, csInfo, isOuterJoin, printIndentation);
long limit, int printIndentation) throws RepositoryException { if (JCR_JOIN_TYPE_RIGHT_OUTER.equalsIgnoreCase(join.getJoinType())) { log.debug( "{} SQL2 RIGHT OUTER JOIN transformed to LEFT OUTER JOIN.", .getJoinType()); QueryResult result = execute(merger, csInfo, isOuterJoin, printIndentation);
private void append(Join join) { append(join.getLeft()); append(" "); appendJoinType(join.getJoinType()); append(" JOIN "); append(join.getRight()); append(" ON "); append(join.getJoinCondition()); }
private void append(Join join) { append(join.getLeft()); append(" "); appendJoinType(join.getJoinType()); append(" JOIN "); append(join.getRight()); append(" ON "); append(join.getJoinCondition()); }
private void append(Join join) { append(join.getLeft()); append(" "); appendJoinType(join.getJoinType()); append(" JOIN "); append(join.getRight()); append(" ON "); append(join.getJoinCondition()); }
@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()); }