use of javax.jcr.query.qom.ChildNode in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testChildNodeWithSelector.
/**
* Test case for {@link QueryObjectModelFactory#childNode(String, String)}
*/
public void testChildNodeWithSelector() throws RepositoryException {
ChildNode childNode = qf.childNode(SELECTOR_NAME1, testRootNode.getPath());
assertEquals("Wrong path", testRootNode.getPath(), childNode.getParentPath());
assertEquals("Wrong selector name", SELECTOR_NAME1, childNode.getSelectorName());
}
use of javax.jcr.query.qom.ChildNode in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testChildNode.
/**
* Test case for {@link QueryObjectModelFactory#childNode(String, String)}
*/
public void testChildNode() throws RepositoryException {
ChildNode childNode = qf.childNode(SELECTOR_NAME1, testRootNode.getPath());
assertEquals("Wrong path", testRootNode.getPath(), childNode.getParentPath());
assertEquals("Wrong selector name", SELECTOR_NAME1, childNode.getSelectorName());
}
use of javax.jcr.query.qom.ChildNode in project jackrabbit-oak by apache.
the class QomTest method childNode.
@Test
public void childNode() throws RepositoryException {
ChildNode cn = f.childNode("selectorName", "parentPath");
assertEquals("selectorName", cn.getSelectorName());
assertEquals("parentPath", cn.getParentPath());
assertEquals("ISCHILDNODE([selectorName], [parentPath])", cn.toString());
assertEquals("ISCHILDNODE([p])", f.childNode(null, "p").toString());
}
use of javax.jcr.query.qom.ChildNode in project jackrabbit by apache.
the class LuceneQueryFactory method create.
protected Query create(Constraint constraint, Map<String, NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws RepositoryException, IOException {
if (constraint instanceof And) {
return getAndQuery((And) constraint, selectorMap, searcher);
} else if (constraint instanceof Or) {
return getOrQuery((Or) constraint, selectorMap, searcher);
} else if (constraint instanceof Not) {
return getNotQuery((Not) constraint, selectorMap, searcher);
} else if (constraint instanceof PropertyExistence) {
return getPropertyExistenceQuery((PropertyExistence) constraint);
} else if (constraint instanceof Comparison) {
Comparison c = (Comparison) constraint;
Transform left = new Transform(c.getOperand1());
return getComparisonQuery(left.operand, left.transform, c.getOperator(), c.getOperand2(), selectorMap);
} else if (constraint instanceof FullTextSearch) {
return getFullTextSearchQuery((FullTextSearch) constraint);
} else if (constraint instanceof SameNode) {
SameNode sn = (SameNode) constraint;
return getNodeIdQuery(UUID, sn.getPath());
} else if (constraint instanceof ChildNode) {
ChildNode cn = (ChildNode) constraint;
return getNodeIdQuery(PARENT, cn.getParentPath());
} else if (constraint instanceof DescendantNode) {
DescendantNode dn = (DescendantNode) constraint;
return getDescendantNodeQuery(dn, searcher);
} else {
throw new UnsupportedRepositoryOperationException("Unknown constraint type: " + constraint);
}
}
Aggregations