private void addPredicateQuantity(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamQuantity> join = createOrReuseJoin(JoinEnum.QUANTITY, 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) { Predicate singleCode = createPredicateQuantity(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(singleCode); } myPredicates.add(myBuilder.or(toArray(codePredicates))); }
private void clean(String theParamName, List<List<? extends IQueryParameterType>> theAndOrParams) { for (int andListIdx = 0; andListIdx < theAndOrParams.size(); andListIdx++) { List<? extends IQueryParameterType> nextOrList = theAndOrParams.get(andListIdx); for (int orListIdx = 0; orListIdx < nextOrList.size(); orListIdx++) { IQueryParameterType nextOr = nextOrList.get(orListIdx); boolean hasNoValue = false; if (nextOr.getMissing() != null) { continue; } if (nextOr instanceof QuantityParam) { if (isBlank(((QuantityParam) nextOr).getValueAsString())) { hasNoValue = true; } } if (hasNoValue) { ourLog.debug("Ignoring empty parameter: {}", theParamName); nextOrList.remove(orListIdx); orListIdx--; } } if (nextOrList.isEmpty()) { theAndOrParams.remove(andListIdx); andListIdx--; } } }
private void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamString> join = createOrReuseJoin(JoinEnum.STRING, 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) { Predicate singleCode = createPredicateString(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(singleCode); } myPredicates.add(myBuilder.or(toArray(codePredicates))); }
private static int compare(FhirContext theCtx, IQueryParameterType theO1, IQueryParameterType theO2) { int retVal; if (theO1.getMissing() == null && theO2.getMissing() == null) { retVal = 0; } else if (theO1.getMissing() == null) { retVal = -1; } else if (theO2.getMissing() == null) { retVal = 1; } else if (ObjectUtil.equals(theO1.getMissing(), theO2.getMissing())) { retVal = 0; } else { if (theO1.getMissing()) { retVal = 1; } else { retVal = -1; } } if (retVal == 0) { String q1 = theO1.getQueryParameterQualifier(); String q2 = theO2.getQueryParameterQualifier(); retVal = StringUtils.compare(q1, q2); } if (retVal == 0) { String v1 = theO1.getValueAsQueryToken(theCtx); String v2 = theO2.getValueAsQueryToken(theCtx); retVal = StringUtils.compare(v1, v2); } return retVal; }
private void addPredicateDate(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamDate> join = createOrReuseJoin(JoinEnum.DATE, theParamName); if (theList.get(0).getMissing() != null) { Boolean missing = theList.get(0).getMissing(); addPredicateParamMissing(theResourceName, theParamName, missing, join); return; } List<Predicate> codePredicates = new ArrayList<>(); for (IQueryParameterType nextOr : theList) { Predicate p = createPredicateDate(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(p); } Predicate orPredicates = myBuilder.or(toArray(codePredicates)); myPredicates.add(orPredicates); }
private void addPredicateToken(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { if (theList.get(0).getMissing() != null) { Join<ResourceTable, ResourceIndexedSearchParamToken> join = createOrReuseJoin(JoinEnum.TOKEN, theParamName); addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing(), join); return; } List<Predicate> codePredicates = new ArrayList<>(); Join<ResourceTable, ResourceIndexedSearchParamToken> join = null; for (IQueryParameterType nextOr : theList) { if (nextOr instanceof TokenParam) { TokenParam id = (TokenParam) nextOr; if (id.isText()) { addPredicateString(theResourceName, theParamName, theList); break; } } if (join == null) { join = createOrReuseJoin(JoinEnum.TOKEN, theParamName); } Predicate singleCode = createPredicateToken(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(singleCode); } if (codePredicates.isEmpty()) { return; } Predicate spPredicate = myBuilder.or(toArray(codePredicates)); myPredicates.add(spPredicate); }
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))); }
if (theList.get(0).getMissing() != null) { addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing(), join); return;
if (nextValueOrIn.getMissing() != null || isNotBlank(nextValueOrIn.getValueAsQueryToken(theCtx))) { nextValuesOrsOut.add(nextValueOrIn); if (firstValue.getMissing() != null) { b.append(Constants.PARAMQUALIFIER_MISSING); b.append('='); if (firstValue.getMissing()) { b.append(Constants.PARAMQUALIFIER_MISSING_TRUE); } else {
assert theParamName.contains(".") == false; if (theList.get(0).getMissing() != null) { addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing()); return;
for (List<? extends IQueryParameterType> nextOrs : nextAnds) { for (IQueryParameterType next : nextOrs) { if (next.getMissing() != null) { throw new MethodNotAllowedException(":missing modifier is disabled on this server");
private void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamString> join = createOrReuseJoin(JoinEnum.STRING, 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) { Predicate singleCode = createPredicateString(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(singleCode); } myPredicates.add(myBuilder.or(toArray(codePredicates))); }
private void addPredicateQuantity(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamQuantity> join = createOrReuseJoin(JoinEnum.QUANTITY, 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) { Predicate singleCode = createPredicateQuantity(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(singleCode); } myPredicates.add(myBuilder.or(toArray(codePredicates))); }
private void addPredicateDate(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { Join<ResourceTable, ResourceIndexedSearchParamDate> join = createOrReuseJoin(JoinEnum.DATE, theParamName); if (theList.get(0).getMissing() != null) { Boolean missing = theList.get(0).getMissing(); addPredicateParamMissing(theResourceName, theParamName, missing, join); return; } List<Predicate> codePredicates = new ArrayList<>(); for (IQueryParameterType nextOr : theList) { Predicate p = createPredicateDate(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(p); } Predicate orPredicates = myBuilder.or(toArray(codePredicates)); myPredicates.add(orPredicates); }
private void addPredicateToken(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList) { if (theList.get(0).getMissing() != null) { Join<ResourceTable, ResourceIndexedSearchParamToken> join = createOrReuseJoin(JoinEnum.TOKEN, theParamName); addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing(), join); return; } List<Predicate> codePredicates = new ArrayList<>(); Join<ResourceTable, ResourceIndexedSearchParamToken> join = null; for (IQueryParameterType nextOr : theList) { if (nextOr instanceof TokenParam) { TokenParam id = (TokenParam) nextOr; if (id.isText()) { addPredicateString(theResourceName, theParamName, theList); break; } } if (join == null) { join = createOrReuseJoin(JoinEnum.TOKEN, theParamName); } Predicate singleCode = createPredicateToken(nextOr, theResourceName, theParamName, myBuilder, join); codePredicates.add(singleCode); } if (codePredicates.isEmpty()) { return; } Predicate spPredicate = myBuilder.or(toArray(codePredicates)); myPredicates.add(spPredicate); }
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))); }
if (theList.get(0).getMissing() != null) { addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing(), join); return;
assert theParamName.contains(".") == false; if (theList.get(0).getMissing() != null) { addPredicateParamMissing(theResourceName, theParamName, theList.get(0).getMissing()); return;
for (List<? extends IQueryParameterType> nextOrs : nextAnds) { for (IQueryParameterType next : nextOrs) { if (next.getMissing() != null) { throw new MethodNotAllowedException(":missing modifier is disabled on this server");