started to add string filter support
This commit is contained in:
@ -442,13 +442,30 @@ public abstract class CommonAbstractController {
|
|||||||
break;
|
break;
|
||||||
case NOT_EQUAL:
|
case NOT_EQUAL:
|
||||||
predicate = cb.isNotNull(path);
|
predicate = cb.isNotNull(path);
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw new ControllerException(ControllerException.INTERNAL_ERROR, currentFilter.getComparator() + " not supported for searchValue null");
|
throw new ControllerException(ControllerException.INTERNAL_ERROR, currentFilter.getComparator() + " not supported for searchValue null");
|
||||||
}
|
}
|
||||||
returnCondition = addFilterCondition(cb, returnCondition, predicate);
|
returnCondition = addFilterCondition(cb, returnCondition, predicate);
|
||||||
|
} else if (currentFilter.getSearchValue() instanceof String) {
|
||||||
|
String searchValue = (String) currentFilter.getSearchValue();
|
||||||
|
String wildCard = "%";
|
||||||
|
Predicate predicate;
|
||||||
|
switch (currentFilter.getComparator()) {
|
||||||
|
case EQUAL:
|
||||||
|
predicate = cb.equal(path, searchValue);
|
||||||
|
break;
|
||||||
|
case NOT_EQUAL:
|
||||||
|
predicate = cb.notEqual(path, searchValue);
|
||||||
|
break;
|
||||||
|
case CONTAINS:
|
||||||
|
String likeValue = wildCard + searchValue.toUpperCase(Locale.US) + wildCard;
|
||||||
|
predicate = cb.like(cb.upper(path), likeValue, '\\');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ControllerException(ControllerException.INTERNAL_ERROR, currentFilter.getComparator() + "not support for searchValue " + searchValue);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ControllerException (ControllerException.INTERNAL_ERROR, "Not yet implemented");
|
throw new ControllerException(ControllerException.INTERNAL_ERROR, "Not yet implemented");
|
||||||
}
|
}
|
||||||
} // for all filters
|
} // for all filters
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user