use of javax.jcr.query.qom.And in project jackrabbit-oak by apache.
the class QomTest method and.
@Test
public void and() throws RepositoryException {
Constraint c0 = f.propertyExistence("x", "c0");
Constraint c1 = f.propertyExistence("x", "c1");
And and = f.and(c0, c1);
assertEquals(and.getConstraint1(), c0);
assertEquals(and.getConstraint2(), c1);
assertEquals("([x].[c0] IS NOT NULL) AND ([x].[c1] IS NOT NULL)", and.toString());
}
use of javax.jcr.query.qom.And in project jackrabbit by apache.
the class ConstraintSplitter method splitNot.
private void splitNot(ConstraintSplitInfo constraintSplitInfo, Not not) throws RepositoryException {
Constraint constraint = not.getConstraint();
if (constraint instanceof Not) {
split(constraintSplitInfo, ((Not) constraint).getConstraint());
} else if (constraint instanceof And) {
And and = (And) constraint;
split(constraintSplitInfo, factory.or(factory.not(and.getConstraint1()), factory.not(and.getConstraint2())));
} else if (constraint instanceof Or) {
Or or = (Or) constraint;
split(constraintSplitInfo, factory.and(factory.not(or.getConstraint1()), factory.not(or.getConstraint2())));
} else {
splitBySelectors(constraintSplitInfo, not, getSelectorNames(constraint));
}
}
use of javax.jcr.query.qom.And 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