/** * Compute the parameter value/name pairings. * @return the filter parameters for this predicate */ public List<FilterParameter> getParameters() { String baseName = String.format("%s_%s_", getFieldPath().replace(PERIOD, UNDERSCORE), Integer.toHexString(hashCode())); return IntStream.range(0, values.size()) .mapToObj(idx -> new FilterParameter(String.format("%s%d", baseName, idx), values.get(idx))) .collect(Collectors.toList()); }
String firstParam = params.size() > 0 ? params.get(0).getPlaceholder() : null; switch (filterPredicate.getOperator()) { case IN:
/** * Given a collection of filter predicates and a Hibernate query, populates the named parameters in the * Hibernate query. * * @param query The HQL query * @param predicates The predicates to extract named parameter values from */ protected void supplyFilterQueryParameters(Query query, Collection<FilterPredicate> predicates) { for (FilterPredicate filterPredicate : predicates) { if (filterPredicate.getOperator().isParameterized()) { boolean shouldEscape = filterPredicate.isMatchingOperator(); filterPredicate.getParameters().forEach(param -> { query.setParameter(param.getName(), shouldEscape ? param.escapeMatching() : param.getValue()); }); } } }
/** * Compute the parameter value/name pairings. * @return the filter parameters for this predicate */ public List<FilterParameter> getParameters() { String baseName = String.format("%s_%s_", getFieldPath().replace(PERIOD, UNDERSCORE), Integer.toHexString(hashCode())); return IntStream.range(0, values.size()) .mapToObj(idx -> new FilterParameter(String.format("%s%d", baseName, idx), values.get(idx))) .collect(Collectors.toList()); }