Search in sources :

Example 1 with LessFilter

use of com.evolveum.midpoint.prism.query.LessFilter 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;
}
Also used : QueryException(com.evolveum.midpoint.repo.sql.query.QueryException) SubstringFilter(com.evolveum.midpoint.prism.query.SubstringFilter) EqualFilter(com.evolveum.midpoint.prism.query.EqualFilter) GreaterFilter(com.evolveum.midpoint.prism.query.GreaterFilter) LessFilter(com.evolveum.midpoint.prism.query.LessFilter)

Aggregations

EqualFilter (com.evolveum.midpoint.prism.query.EqualFilter)1 GreaterFilter (com.evolveum.midpoint.prism.query.GreaterFilter)1 LessFilter (com.evolveum.midpoint.prism.query.LessFilter)1 SubstringFilter (com.evolveum.midpoint.prism.query.SubstringFilter)1 QueryException (com.evolveum.midpoint.repo.sql.query.QueryException)1