@Override public <T extends IResource> Bundle search( final Class<T> theType, Map<String, List<IQueryParameterType>> theParams) { LinkedHashMap<String, List<String>> params = new LinkedHashMap<String, List<String>>(); for (Entry<String, List<IQueryParameterType>> nextEntry : theParams.entrySet()) { ArrayList<String> valueList = new ArrayList<String>(); String qualifier = null; for (IQueryParameterType nextValue : nextEntry.getValue()) { valueList.add(nextValue.getValueAsQueryToken()); qualifier = nextValue.getQueryParameterQualifier(); } qualifier = StringUtils.defaultString(qualifier); params.put(nextEntry.getKey() + qualifier, valueList); } BaseHttpClientInvocation invocation = SearchMethodBinding.createSearchInvocation( myContext, toResourceName(theType), params, null, null, null); if (isKeepResponses()) { myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding()); } BundleResponseHandler binding = new BundleResponseHandler(theType); Bundle resp = invokeClient(myContext, binding, invocation, myLogRequestAndResponse); return resp; }
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)); } } } }
@Override public Bundle execute() { Map<String, List<String>> params = new LinkedHashMap<String, List<String>>(); // Map<String, List<String>> initial = createExtraParams(); // if (initial != null) { // params.putAll(initial); // } for (ICriterionInternal next : myCriterion) { String parameterName = next.getParameterName(); String parameterValue = next.getParameterValue(); addParam(params, parameterName, parameterValue); } for (Include next : myInclude) { addParam(params, Constants.PARAM_INCLUDE, next.getValue()); } for (SortInternal next : mySort) { addParam(params, next.getParamName(), next.getParamValue()); } if (myParamLimit != null) { addParam(params, Constants.PARAM_COUNT, Integer.toString(myParamLimit)); } BundleResponseHandler binding = new BundleResponseHandler(myResourceType); IdDt resourceId = myResourceId != null ? new IdDt(myResourceId) : null; BaseHttpClientInvocation invocation = SearchMethodBinding.createSearchInvocation( myContext, myResourceName, params, resourceId, myCompartmentName, mySearchStyle); return invoke(params, binding, invocation); }