use of com.evolveum.midpoint.repo.sqlbase.filtering.ValueFilterValues in project midpoint by Evolveum.
the class JsonbPolysPathItemFilterProcessor method process.
@Override
public Predicate process(PropertyValueFilter<T> filter) throws RepositoryException {
String matchingRule = filter.getMatchingRule() != null ? filter.getMatchingRule().getLocalPart() : null;
if (!(filter instanceof EqualFilter) || STRICT_IGNORE_CASE.equals(matchingRule) || ORIG_IGNORE_CASE.equals(matchingRule) || NORM_IGNORE_CASE.equals(matchingRule)) {
throw new QueryException("Can't translate filter '" + filter + "' to operation." + " JSONB stored poly strings support only equals with no IC matching rule.");
}
List<?> filterValues = filter.getValues();
if (filterValues == null || filterValues.isEmpty()) {
return path.isNull();
}
ValueFilterValues<?, ?> values = ValueFilterValues.from(filter);
if (Strings.isNullOrEmpty(matchingRule) || DEFAULT.equals(matchingRule) || STRICT.equals(matchingRule)) {
// The value here should be poly-string, otherwise it never matches both orig and norm.
return processPolyStringBoth(values);
} else if (ORIG.equals(matchingRule)) {
return processPolyStringComponent(convertPolyValuesToString(values, filter, p -> p.getOrig()), JSONB_POLY_ORIG_KEY);
} else if (NORM.equals(matchingRule)) {
return processPolyStringComponent(convertPolyValuesToString(values, filter, p -> p.getNorm()), JSONB_POLY_NORM_KEY);
} else {
throw new QueryException("Unknown matching rule '" + matchingRule + "'.");
}
}
Aggregations