use of com.evolveum.midpoint.repo.sql.query.QueryException in project midpoint by Evolveum.
the class ItemValueRestriction method findOperationForFilter.
protected ItemRestrictionOperation findOperationForFilter(ValueFilter filter) throws QueryException {
ItemRestrictionOperation operation;
if (filter instanceof EqualFilter) {
operation = ItemRestrictionOperation.EQ;
} else if (filter instanceof GreaterFilter) {
GreaterFilter gf = (GreaterFilter) filter;
operation = gf.isEquals() ? ItemRestrictionOperation.GE : ItemRestrictionOperation.GT;
} else if (filter instanceof LessFilter) {
LessFilter lf = (LessFilter) filter;
operation = lf.isEquals() ? ItemRestrictionOperation.LE : ItemRestrictionOperation.LT;
} else if (filter instanceof SubstringFilter) {
SubstringFilter substring = (SubstringFilter) filter;
if (substring.isAnchorEnd()) {
operation = ItemRestrictionOperation.ENDS_WITH;
} else if (substring.isAnchorStart()) {
operation = ItemRestrictionOperation.STARTS_WITH;
} else {
operation = ItemRestrictionOperation.SUBSTRING;
}
} else {
throw new QueryException("Can't translate filter '" + filter + "' to operation.");
}
return operation;
}
Aggregations