use of com.evolveum.midpoint.repo.sql.query2.matcher.Matcher in project midpoint by Evolveum.
the class PolyStringMatcher method match.
@Override
public Condition match(RootHibernateQuery hibernateQuery, ItemRestrictionOperation operation, String propertyName, PolyString value, String matcher) throws QueryException {
boolean ignoreCase = STRICT_IGNORE_CASE.equals(matcher) || ORIG_IGNORE_CASE.equals(matcher) || NORM_IGNORE_CASE.equals(matcher);
if (StringUtils.isEmpty(matcher) || DEFAULT.equals(matcher) || STRICT.equals(matcher) || STRICT_IGNORE_CASE.equals(matcher)) {
AndCondition conjunction = hibernateQuery.createAnd();
conjunction.add(createOrigMatch(hibernateQuery, operation, propertyName, value, ignoreCase));
conjunction.add(createNormMatch(hibernateQuery, operation, propertyName, value, ignoreCase));
return conjunction;
} else if (ORIG.equals(matcher) || ORIG_IGNORE_CASE.equals(matcher)) {
return createOrigMatch(hibernateQuery, operation, propertyName, value, ignoreCase);
} else if (NORM.equals(matcher) || NORM_IGNORE_CASE.equals(matcher)) {
return createNormMatch(hibernateQuery, operation, propertyName, value, ignoreCase);
} else {
throw new QueryException("Unknown matcher '" + matcher + "'.");
}
}
use of com.evolveum.midpoint.repo.sql.query2.matcher.Matcher in project midpoint by Evolveum.
the class ItemValueRestriction method createPropertyVsConstantCondition.
protected Condition createPropertyVsConstantCondition(String hqlPropertyPath, Object value, ValueFilter filter) throws QueryException {
ItemRestrictionOperation operation = findOperationForFilter(filter);
InterpretationContext context = getContext();
QueryInterpreter2 interpreter = context.getInterpreter();
Matcher matcher = interpreter.findMatcher(value);
String matchingRule = filter.getMatchingRule() != null ? filter.getMatchingRule().getLocalPart() : null;
// TODO treat null for multivalued properties (at least throw an exception!)
return matcher.match(context.getHibernateQuery(), operation, hqlPropertyPath, value, matchingRule);
}
Aggregations