use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class ChildNodeJoinConditionTest method testLeftOuterJoin.
public void testLeftOuterJoin() throws RepositoryException {
JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
List<Node[]> result = new ArrayList<Node[]>();
result.add(new Node[] { n2, n1 });
if (testRootNode.isNodeType(testNodeType)) {
result.add(new Node[] { n1, testRootNode });
} else {
result.add(new Node[] { n1, null });
}
checkQOM(qom, result.toArray(new Node[result.size()][]));
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class ChildNodeJoinConditionTest method testInnerJoin.
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 } });
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class DescendantNodeJoinConditionTest method testLeftOuterJoin.
public void testLeftOuterJoin() throws RepositoryException {
JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
List<Node[]> result = new ArrayList<Node[]>();
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 });
}
checkQOM(qom, result.toArray(new Node[result.size()][]));
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class DescendantNodeJoinConditionTest method testInnerJoin.
public void testInnerJoin() throws RepositoryException {
JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c);
checkQOM(qom, new Node[][] { { n2, n1 } });
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class OrderingTest method createQuery.
protected QueryObjectModel createQuery(Ordering[] orderings) throws RepositoryException {
JoinCondition c = qf.equiJoinCondition(LEFT, propertyName1, RIGHT, propertyName2);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c);
return qf.createQuery(qom.getSource(), qom.getConstraint(), orderings, qom.getColumns());
}
Aggregations