use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class Parser method parseCondition.
private Constraint parseCondition(DynamicOperand left) throws RepositoryException {
Constraint c;
if (readIf("=")) {
c = Operator.EQ.comparison(factory, left, parseStaticOperand());
} else if (readIf("<>")) {
c = Operator.NE.comparison(factory, left, parseStaticOperand());
} else if (readIf("<")) {
c = Operator.LT.comparison(factory, left, parseStaticOperand());
} else if (readIf(">")) {
c = Operator.GT.comparison(factory, left, parseStaticOperand());
} else if (readIf("<=")) {
c = Operator.LE.comparison(factory, left, parseStaticOperand());
} else if (readIf(">=")) {
c = Operator.GE.comparison(factory, left, parseStaticOperand());
} else if (readIf("LIKE")) {
c = Operator.LIKE.comparison(factory, left, parseStaticOperand());
} else if (readIf("IS")) {
boolean not = readIf("NOT");
read("NULL");
if (!(left instanceof PropertyValue)) {
throw getSyntaxError("propertyName (NOT NULL is only supported for properties)");
}
PropertyValue p = (PropertyValue) left;
c = getPropertyExistence(p);
if (!not) {
c = factory.not(c);
}
} else if (readIf("NOT")) {
if (readIf("IS")) {
read("NULL");
if (!(left instanceof PropertyValue)) {
throw new RepositoryException("Only property values can be tested for NOT IS NULL; got: " + left.getClass().getName());
}
PropertyValue pv = (PropertyValue) left;
c = getPropertyExistence(pv);
} else {
read("LIKE");
c = factory.not(Operator.LIKE.comparison(factory, left, parseStaticOperand()));
}
} else {
throw getSyntaxError();
}
return c;
}
Aggregations