@Override public boolean matches(IQueryParameterType theParam) { if (!(theParam instanceof NumberParam)) { return false; } NumberParam number = (NumberParam) theParam; return getValue().equals(number.getValue()); }
private void addPredicateNumber(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamNumber> join = createOrReuseJoin(JoinEnum.NUMBER, theParamName); if (theList.get(0).getMissing() != null) { addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing(), join); return; } List<Predicate> codePredicates = new ArrayList<>(); for (IQueryParameterType nextOr : theList) { if (nextOr instanceof NumberParam) { NumberParam param = (NumberParam) nextOr; BigDecimal value = param.getValue(); if (value == null) { continue; } final Expression<BigDecimal> fromObj = join.get("myValue"); ParamPrefixEnum prefix = ObjectUtils.defaultIfNull(param.getPrefix(), ParamPrefixEnum.EQUAL); String invalidMessageName = "invalidNumberPrefix"; Predicate predicateNumeric = createPredicateNumeric(theResourceName, theParamName, join, myBuilder, nextOr, prefix, value, fromObj, invalidMessageName); Predicate predicateOuter = combineParamIndexPredicateWithParamNamePredicate(theResourceName, theParamName, join, predicateNumeric); codePredicates.add(predicateOuter); } else { throw new IllegalArgumentException("Invalid token type: " + nextOr.getClass()); } } myPredicates.add(myBuilder.or(toArray(codePredicates))); }
private void addPredicateNumber(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamNumber> join = createOrReuseJoin(JoinEnum.NUMBER, theParamName); if (theList.get(0).getMissing() != null) { addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing(), join); return; } List<Predicate> codePredicates = new ArrayList<>(); for (IQueryParameterType nextOr : theList) { if (nextOr instanceof NumberParam) { NumberParam param = (NumberParam) nextOr; BigDecimal value = param.getValue(); if (value == null) { continue; } final Expression<BigDecimal> fromObj = join.get("myValue"); ParamPrefixEnum prefix = ObjectUtils.defaultIfNull(param.getPrefix(), ParamPrefixEnum.EQUAL); String invalidMessageName = "invalidNumberPrefix"; Predicate predicateNumeric = createPredicateNumeric(theResourceName, theParamName, join, myBuilder, nextOr, prefix, value, fromObj, invalidMessageName); Predicate predicateOuter = combineParamIndexPredicateWithParamNamePredicate(theResourceName, theParamName, join, predicateNumeric); codePredicates.add(predicateOuter); } else { throw new IllegalArgumentException("Invalid token type: " + nextOr.getClass()); } } myPredicates.add(myBuilder.or(toArray(codePredicates))); }