use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class Parser method parseJoinCondition.
private JoinCondition parseJoinCondition() throws RepositoryException {
boolean identifier = currentTokenType == IDENTIFIER;
String name = readName();
JoinCondition c;
if (identifier && readIf("(")) {
if ("ISSAMENODE".equalsIgnoreCase(name)) {
String selector1 = readName();
read(",");
String selector2 = readName();
if (readIf(",")) {
c = factory.sameNodeJoinCondition(selector1, selector2, readPath());
} else {
c = factory.sameNodeJoinCondition(selector1, selector2, ".");
}
} else if ("ISCHILDNODE".equalsIgnoreCase(name)) {
String childSelector = readName();
read(",");
c = factory.childNodeJoinCondition(childSelector, readName());
} else if ("ISDESCENDANTNODE".equalsIgnoreCase(name)) {
String descendantSelector = readName();
read(",");
c = factory.descendantNodeJoinCondition(descendantSelector, readName());
} else {
throw getSyntaxError("ISSAMENODE, ISCHILDNODE, or ISDESCENDANTNODE");
}
read(")");
return c;
} else {
String selector1 = name;
read(".");
String property1 = readName();
read("=");
String selector2 = readName();
read(".");
return factory.equiJoinCondition(selector1, property1, selector2, readName());
}
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class Parser method parseSource.
private Source parseSource() throws RepositoryException {
Selector selector = parseSelector();
selectors.add(selector);
Source source = selector;
while (true) {
JoinType type;
if (readIf("RIGHT")) {
read("OUTER");
type = JoinType.RIGHT;
} else if (readIf("LEFT")) {
read("OUTER");
type = JoinType.LEFT;
} else if (readIf("INNER")) {
type = JoinType.INNER;
} else {
break;
}
read("JOIN");
selector = parseSelector();
selectors.add(selector);
read("ON");
JoinCondition on = parseJoinCondition();
source = type.join(factory, source, selector, on);
}
return source;
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class ChildNodeJoinConditionTest method testRightOuterJoin.
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 } });
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class EquiJoinConditionTest method testLeftOuterJoin2.
public void testLeftOuterJoin2() throws RepositoryException {
JoinCondition c = qf.equiJoinCondition(LEFT, propertyName2, RIGHT, propertyName1);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
checkQOM(qom, new Node[][] { { n1, null }, { n2, n1 }, { n2, n2 } });
}
use of javax.jcr.query.qom.JoinCondition in project jackrabbit by apache.
the class DescendantNodeJoinConditionTest method testRightOuterJoin.
public void testRightOuterJoin() throws RepositoryException {
JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, c);
checkQOM(qom, new Node[][] { { n2, n1 }, { null, n2 } });
}
Aggregations