use of com.evolveum.midpoint.prism.query.NaryLogicalFilter in project midpoint by Evolveum.
the class LogicalOperation method interpret.
@Override
public <T> Filter interpret(ObjectFilter objectFilter, ConnIdNameMapper icfNameMapper) throws SchemaException {
if (objectFilter instanceof NotFilter) {
NotFilter not = (NotFilter) objectFilter;
if (not.getFilter() == null) {
LOGGER.debug("Not filter does not contain any condition. Skipping processing not filter.");
return null;
}
Filter f = getInterpreter().interpret(objectFilter, icfNameMapper);
return FilterBuilder.not(f);
} else {
NaryLogicalFilter nAry = (NaryLogicalFilter) objectFilter;
List<? extends ObjectFilter> conditions = nAry.getConditions();
if (conditions == null || conditions.isEmpty()) {
LOGGER.debug("No conditions sepcified for logical filter. Skipping processing logical filter.");
return null;
}
if (conditions.size() < 2) {
LOGGER.debug("Logical filter contains only one condition. Skipping processing logical filter and process simple operation of type {}.", conditions.get(0).getClass().getSimpleName());
return getInterpreter().interpret(conditions.get(0), icfNameMapper);
}
List<Filter> filters = new ArrayList<Filter>();
for (ObjectFilter objFilter : nAry.getConditions()) {
Filter f = getInterpreter().interpret(objFilter, icfNameMapper);
filters.add(f);
}
Filter nAryFilter = null;
if (filters.size() >= 2) {
if (nAry instanceof AndFilter) {
nAryFilter = interpretAnd(filters.get(0), filters.subList(1, filters.size()));
} else if (nAry instanceof OrFilter) {
nAryFilter = interpretOr(filters.get(0), filters.subList(1, filters.size()));
}
}
return nAryFilter;
}
}
Aggregations