public class SortParameter implements IParameter {
@Override
public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException {
SortSpec ss = (SortSpec) theSourceClientArgument;
while (ss != null) {
String name;
if (ss.getOrder() == null) {
name = Constants.PARAM_SORT;
} else if (ss.getOrder() == SortOrderEnum.ASC) {
name = Constants.PARAM_SORT_ASC;
} else {
name = Constants.PARAM_SORT_DESC;
}
if (ss.getParamName() != null) {
if (!theTargetQueryArguments.containsKey(name)) {
theTargetQueryArguments.put(name, new ArrayList<String>());
}
theTargetQueryArguments.get(name).add(ss.getParamName());
}
ss = ss.getChain();
}
}