@Override public void translateClientArgumentIntoQueryArgument( FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException { if (theSourceClientArgument == null) { if (isRequired()) { throw new NullPointerException( "SearchParameter '" + getName() + "' is required and may not be null"); } } else { List<QualifiedParamList> value = encode(theContext, theSourceClientArgument); ArrayList<String> paramValues = new ArrayList<String>(value.size()); String qualifier = null; for (QualifiedParamList nextParamEntry : value) { StringBuilder b = new StringBuilder(); for (String str : nextParamEntry) { if (b.length() > 0) { b.append(","); } b.append(str.replace(",", "\\,")); } paramValues.add(b.toString()); if (StringUtils.isBlank(qualifier)) { qualifier = nextParamEntry.getQualifier(); } } theTargetQueryArguments.put(getName() + StringUtils.defaultString(qualifier), paramValues); } }
private void parseParams( RequestDetails theRequest, List<QualifiedParamList> paramList, String theQualifiedParamName, String theQualifier) { QualifierDetails qualifiers = SearchMethodBinding.extractQualifiersFromParameterName(theQualifier); if (!qualifiers.passes(getQualifierWhitelist(), getQualifierBlacklist())) { return; } String[] value = theRequest.getParameters().get(theQualifiedParamName); if (value != null) { for (String nextParam : value) { if (nextParam.contains(",") == false) { paramList.add(QualifiedParamList.singleton(theQualifier, nextParam)); } else { paramList.add( QualifiedParamList.splitQueryStringByCommasIgnoreEscape(theQualifier, nextParam)); } } } }