I want to migrate my website from PF 6 to PF 10.
I have a problem with the DataTable filter.
I do this (filter) by building an SQL query ..
I saw the LazyCustomerDataModel example in the PF showcase (https://www.primefaces.org/showcase/ui/ ... fwid=dbc51) where filtering is done with streams java ..
so .. how can i convert this piece of code to create a sql query?
Code: Select all
private boolean filter(FacesContext context, Collection<FilterMeta> filterBy, Object o) {
boolean matching = true;
for (FilterMeta filter : filterBy) {
FilterConstraint constraint = filter.getConstraint();
Object filterValue = filter.getFilterValue();
try {
Object columnValue = String.valueOf(o.getClass().getField(filter.getField()).get(o));
matching = constraint.isMatching(context, columnValue, filterValue, LocaleUtils.getCurrentLocale());
} catch (ReflectiveOperationException e) {
matching = false;
}
if (!matching) {
break;
}
}
return matching;
}