More JPA work
This commit is contained in:
parent
610bb542ca
commit
4002cc8824
|
@ -45,7 +45,7 @@ public interface IQueryParameterAnd {
|
|||
* for information on the <b>token</b> format
|
||||
* </p>
|
||||
*/
|
||||
public List<List<String>> getValuesAsQueryTokens();
|
||||
public List<QualifiedParamList> getValuesAsQueryTokens();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.model.api;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
import ca.uhn.fhir.rest.method.QualifiedParamList;
|
||||
|
||||
public interface IQueryParameterOr {
|
||||
|
||||
|
@ -33,7 +33,7 @@ public interface IQueryParameterOr {
|
|||
* for information on the <b>token</b> format
|
||||
* </p>
|
||||
*/
|
||||
public void setValuesAsQueryTokens(List<String> theParameters);
|
||||
public void setValuesAsQueryTokens(QualifiedParamList theParameters);
|
||||
|
||||
/**
|
||||
* Returns the value of this type using the <b>token</b> format. This
|
||||
|
@ -45,7 +45,7 @@ public interface IQueryParameterOr {
|
|||
* for information on the <b>token</b> format
|
||||
* </p>
|
||||
*/
|
||||
public List<String> getValuesAsQueryTokens();
|
||||
public QualifiedParamList getValuesAsQueryTokens();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.model.api;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
|
@ -23,8 +25,7 @@ package ca.uhn.fhir.model.api;
|
|||
public interface IQueryParameterType {
|
||||
|
||||
/**
|
||||
* Sets the value of this type using the <b>token</b> format. This format is used in HTTP queries as a parameter
|
||||
* format.
|
||||
* This method is generally only called by HAPI itself, and should not need to be called from user code.
|
||||
*
|
||||
* <p>
|
||||
* See FHIR specification <a href="http://www.hl7.org/implement/standards/fhir/search.html#ptypes">2.2.2 Search
|
||||
|
@ -41,8 +42,7 @@ public interface IQueryParameterType {
|
|||
public void setValueAsQueryToken(String theQualifier, String theValue);
|
||||
|
||||
/**
|
||||
* Returns the value of this type using the <b>token</b> format. This format is used in HTTP queries as a parameter
|
||||
* format.
|
||||
* This method is generally only called by HAPI itself, and should not need to be called from user code.
|
||||
*
|
||||
* <p>
|
||||
* See FHIR specification <a href="http://www.hl7.org/implement/standards/fhir/search.html#ptypes">2.2.2 Search
|
||||
|
@ -50,5 +50,13 @@ public interface IQueryParameterType {
|
|||
* </p>
|
||||
*/
|
||||
public String getValueAsQueryToken();
|
||||
|
||||
/**
|
||||
* This method is generally only called by HAPI itself, and should not need to be called from user code.
|
||||
*
|
||||
* This method will return any qualifier that should be appended to the parameter name (e.g ":exact")
|
||||
* @param theContext TODO
|
||||
*/
|
||||
public String getQueryParameterQualifier(FhirContext theContext);
|
||||
|
||||
}
|
||||
|
|
|
@ -518,4 +518,4 @@ public class AddressDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,4 +447,4 @@ public class AttachmentDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,4 +204,4 @@ public class CodeableConceptDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ package ca.uhn.fhir.model.dstu.composite;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.BaseElement;
|
||||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
|
@ -425,7 +426,12 @@ public class CodingDt
|
|||
} else {
|
||||
setCode(theValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryParameterQualifier(FhirContext theContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,4 +298,4 @@ public class ContactDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -605,4 +605,4 @@ public class HumanNameDt
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ package ca.uhn.fhir.model.dstu.composite;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.BaseElement;
|
||||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
|
@ -434,4 +435,9 @@ public class IdentifierDt
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getQueryParameterQualifier(FhirContext theContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -216,4 +216,4 @@ public class PeriodDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.BaseElement;
|
||||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
|
@ -430,4 +431,11 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype, IQuer
|
|||
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getQueryParameterQualifier(FhirContext theContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -266,4 +266,4 @@ public class RangeDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,4 +266,4 @@ public class RatioDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,4 +227,4 @@ public class ResourceReferenceDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -589,4 +589,4 @@ public class SampledDataDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -572,4 +572,4 @@ public class ScheduleDt
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -974,4 +974,4 @@ public class AdverseReaction extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -440,4 +440,4 @@ public class Alert extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -782,4 +782,4 @@ public class AllergyIntolerance extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1333,4 +1333,4 @@ public class Appointment extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -850,4 +850,4 @@ public class AppointmentResponse extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -533,4 +533,4 @@ public class Availability extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2092,4 +2092,4 @@ public class CarePlan extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2031,4 +2031,4 @@ public class Claim extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1649,4 +1649,4 @@ public class Composition extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1791,4 +1791,4 @@ public class ConceptMap extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1769,4 +1769,4 @@ public class Condition extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4774,4 +4774,4 @@ public class Conformance extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -974,4 +974,4 @@ public class Coverage extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -980,4 +980,4 @@ public class Device extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -818,4 +818,4 @@ public class DeviceObservationReport extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1526,4 +1526,4 @@ public class DiagnosticOrder extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1354,4 +1354,4 @@ public class DiagnosticReport extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1058,4 +1058,4 @@ public class DocumentManifest extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2470,4 +2470,4 @@ public class DocumentReference extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2040,4 +2040,4 @@ public class Encounter extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -882,4 +882,4 @@ public class FamilyHistory extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1551,4 +1551,4 @@ public class GVFMeta extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3196,4 +3196,4 @@ public class GVFVariant extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1056,4 +1056,4 @@ public class GeneExpression extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1423,4 +1423,4 @@ public class GeneticAnalysis extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -873,4 +873,4 @@ public class Group extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2151,4 +2151,4 @@ public class ImagingStudy extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2146,4 +2146,4 @@ public class Immunization extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1316,4 +1316,4 @@ public class ImmunizationRecommendation extends BaseResource implements IResourc
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -978,4 +978,4 @@ public class ListResource extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1115,4 +1115,4 @@ public class Location extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -923,4 +923,4 @@ public class Media extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -815,4 +815,4 @@ public class Medication extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1327,4 +1327,4 @@ public class MedicationAdministration extends BaseResource implements IResource
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1916,4 +1916,4 @@ public class MedicationDispense extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1660,4 +1660,4 @@ public class MedicationPrescription extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1062,4 +1062,4 @@ public class MedicationStatement extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1238,4 +1238,4 @@ public class MessageHeader extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1489,4 +1489,4 @@ public class Microarray extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1635,4 +1635,4 @@ public class Observation extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,4 +410,4 @@ public class OperationOutcome extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -847,4 +847,4 @@ public class Order extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -656,4 +656,4 @@ public class OrderResponse extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1042,4 +1042,4 @@ public class Organization extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -445,4 +445,4 @@ public class Other extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2023,4 +2023,4 @@ public class Patient extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1263,4 +1263,4 @@ public class Practitioner extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1183,4 +1183,4 @@ public class Procedure extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4993,4 +4993,4 @@ public class Profile extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1202,4 +1202,4 @@ public class Provenance extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -860,4 +860,4 @@ public class Query extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1494,4 +1494,4 @@ public class Questionnaire extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -707,4 +707,4 @@ public class RelatedPerson extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -536,4 +536,4 @@ public class Remittance extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2406,4 +2406,4 @@ public class SecurityEvent extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -659,4 +659,4 @@ public class SequencingAnalysis extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -976,4 +976,4 @@ public class SequencingLab extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -699,4 +699,4 @@ public class Slot extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1790,4 +1790,4 @@ public class Specimen extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -771,4 +771,4 @@ public class Substance extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1096,4 +1096,4 @@ public class Supply extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1430,4 +1430,4 @@ public class Test extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -619,4 +619,4 @@ public class User extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2754,4 +2754,4 @@ public class ValueSet extends BaseResource implements IResource {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package ca.uhn.fhir.model.primitive;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.BasePrimitive;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
@ -129,4 +130,9 @@ public class StringDt extends BasePrimitive<String> implements IQueryParameterTy
|
|||
return super.isEmpty() && StringUtils.isBlank(getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryParameterQualifier(FhirContext theContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
|
@ -172,10 +173,13 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
LinkedHashMap<String, List<String>> params = new LinkedHashMap<String, List<String>>();
|
||||
for (Entry<String, List<IQueryParameterType>> nextEntry : theParams.entrySet()) {
|
||||
ArrayList<String> valueList = new ArrayList<String>();
|
||||
params.put(nextEntry.getKey(), valueList);
|
||||
String qualifier = null;
|
||||
for (IQueryParameterType nextValue : nextEntry.getValue()) {
|
||||
valueList.add(nextValue.getValueAsQueryToken());
|
||||
qualifier = nextValue.getQueryParameterQualifier(myContext);
|
||||
}
|
||||
qualifier = StringUtils.defaultString(qualifier);
|
||||
params.put(nextEntry.getKey()+qualifier, valueList);
|
||||
}
|
||||
|
||||
GetClientInvocation invocation = SearchMethodBinding.createSearchInvocation(toResourceName(theType), params);
|
||||
|
|
|
@ -152,7 +152,7 @@ public abstract class BaseAddOrDeleteTagsMethodBinding extends BaseMethodBinding
|
|||
}
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ConformanceMethodBinding extends BaseResourceReturningMethodBinding
|
|||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class CreateMethodBinding extends BaseOutcomeReturningMethodBindingWithRe
|
|||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ public class DeleteMethodBinding extends BaseOutcomeReturningMethodBinding {
|
|||
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -136,7 +136,7 @@ public class GetTagsMethodBinding extends BaseMethodBinding<TagList> {
|
|||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
|
|||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], retVal.getParameters(),retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], retVal.getParameters(),retVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.rest.method;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
* %%
|
||||
* Copyright (C) 2014 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
@ -25,10 +45,14 @@ public class QualifiedParamList extends ArrayList<String> {
|
|||
myQualifier = theQualifier;
|
||||
}
|
||||
|
||||
public static QualifiedParamList singleton(String theQualifier, String theNextParam) {
|
||||
public static QualifiedParamList singleton(String theParamValue) {
|
||||
return singleton(null, theParamValue);
|
||||
}
|
||||
|
||||
public static QualifiedParamList singleton(String theQualifier, String theParamValue) {
|
||||
QualifiedParamList retVal = new QualifiedParamList(1);
|
||||
retVal.setQualifier(theQualifier);
|
||||
retVal.add(theNextParam);
|
||||
retVal.add(theParamValue);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding {
|
|||
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -91,7 +91,7 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
|
|||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], queryStringArgs, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], queryStringArgs, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithRe
|
|||
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ValidateMethodBinding extends BaseOutcomeReturningMethodBindingWith
|
|||
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(theArgs[idx], null, retVal);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, retVal);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -26,6 +26,9 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
|
||||
import ca.uhn.fhir.rest.client.BaseClientInvocation;
|
||||
import ca.uhn.fhir.rest.method.QualifiedParamList;
|
||||
|
@ -35,7 +38,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
|
||||
public abstract class BaseQueryParameter implements IParameter {
|
||||
|
||||
public abstract List<List<String>> encode(Object theObject) throws InternalErrorException;
|
||||
public abstract List<QualifiedParamList> encode(FhirContext theContext, Object theObject) throws InternalErrorException;
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
|
@ -52,17 +55,17 @@ public abstract class BaseQueryParameter implements IParameter {
|
|||
public abstract SearchParamTypeEnum getParamType();
|
||||
|
||||
@Override
|
||||
public void translateClientArgumentIntoQueryArgument(Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException {
|
||||
public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException {
|
||||
if (theSourceClientArgument == null) {
|
||||
if (isRequired()) {
|
||||
throw new NullPointerException("SearchParameter '" + getName() + "' is required and may not be null");
|
||||
}
|
||||
} else {
|
||||
List<List<String>> value = encode(theSourceClientArgument);
|
||||
List<QualifiedParamList> value = encode(theContext, theSourceClientArgument);
|
||||
ArrayList<String> paramValues = new ArrayList<String>(value.size());
|
||||
theTargetQueryArguments.put(getName(), paramValues);
|
||||
|
||||
for (List<String> nextParamEntry : value) {
|
||||
String qualifier=null;
|
||||
|
||||
for (QualifiedParamList nextParamEntry : value) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (String str : nextParamEntry) {
|
||||
if (b.length() > 0) {
|
||||
|
@ -71,8 +74,13 @@ public abstract class BaseQueryParameter implements IParameter {
|
|||
b.append(str.replace(",", "\\,"));
|
||||
}
|
||||
paramValues.add(b.toString());
|
||||
|
||||
if (StringUtils.isBlank(qualifier)) {
|
||||
qualifier=nextParamEntry.getQualifier();
|
||||
}
|
||||
}
|
||||
|
||||
theTargetQueryArguments.put(getName()+StringUtils.defaultString(qualifier), paramValues);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
|||
|
||||
import ca.uhn.fhir.model.api.IQueryParameterOr;
|
||||
import ca.uhn.fhir.model.dstu.composite.CodingDt;
|
||||
import ca.uhn.fhir.rest.method.QualifiedParamList;
|
||||
|
||||
public class CodingListParam implements IQueryParameterOr, Iterable<CodingDt> {
|
||||
|
||||
|
@ -96,8 +97,8 @@ public class CodingListParam implements IQueryParameterOr, Iterable<CodingDt> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> getValuesAsQueryTokens() {
|
||||
ArrayList<String> retVal = new ArrayList<String>();
|
||||
public QualifiedParamList getValuesAsQueryTokens() {
|
||||
QualifiedParamList retVal = new QualifiedParamList();
|
||||
for (CodingDt next : myCodings) {
|
||||
retVal.add(next.getValueAsQueryToken());
|
||||
}
|
||||
|
@ -112,7 +113,7 @@ public class CodingListParam implements IQueryParameterOr, Iterable<CodingDt> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setValuesAsQueryTokens(List<String> theParameters) {
|
||||
public void setValuesAsQueryTokens(QualifiedParamList theParameters) {
|
||||
getCodings().clear();
|
||||
for (String string : theParameters) {
|
||||
CodingDt dt = new CodingDt();
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Map;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.rest.annotation.Since;
|
||||
|
@ -43,7 +44,7 @@ public class CountParameter implements IParameter {
|
|||
private Class<?> myType;
|
||||
|
||||
@Override
|
||||
public void translateClientArgumentIntoQueryArgument(Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException {
|
||||
public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException {
|
||||
if (theSourceClientArgument != null) {
|
||||
IntegerDt since = ParameterUtil.toInteger(theSourceClientArgument);
|
||||
if (since.isEmpty() == false) {
|
||||
|
|
|
@ -21,7 +21,6 @@ package ca.uhn.fhir.rest.param;
|
|||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -157,13 +156,13 @@ public class DateRangeParam implements IQueryParameterAnd {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<List<String>> getValuesAsQueryTokens() {
|
||||
ArrayList<List<String>> retVal = new ArrayList<List<String>>();
|
||||
public List<QualifiedParamList> getValuesAsQueryTokens() {
|
||||
ArrayList<QualifiedParamList> retVal = new ArrayList<QualifiedParamList>();
|
||||
if (myLowerBound != null) {
|
||||
retVal.add(Collections.singletonList(myLowerBound.getValueAsQueryToken()));
|
||||
retVal.add(QualifiedParamList.singleton(myLowerBound.getValueAsQueryToken()));
|
||||
}
|
||||
if (myUpperBound != null) {
|
||||
retVal.add(Collections.singletonList(myUpperBound.getValueAsQueryToken()));
|
||||
retVal.add(QualifiedParamList.singleton(myUpperBound.getValueAsQueryToken()));
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -22,13 +22,14 @@ package ca.uhn.fhir.rest.param;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.method.QualifiedParamList;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
||||
interface IParamBinder {
|
||||
|
||||
List<List<String>> encode(Object theString) throws InternalErrorException;
|
||||
List<QualifiedParamList> encode(FhirContext theContext, Object theString) throws InternalErrorException;
|
||||
|
||||
Object parse(List<QualifiedParamList> theList) throws InternalErrorException, InvalidRequestException;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.rest.client.BaseClientInvocation;
|
||||
import ca.uhn.fhir.rest.method.Request;
|
||||
|
@ -34,7 +35,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
|
||||
public interface IParameter {
|
||||
|
||||
void translateClientArgumentIntoQueryArgument(Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException;
|
||||
void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException;
|
||||
|
||||
/**
|
||||
* This <b>server method</b> method takes the data received by the server in an incoming request, and translates that data into a single argument for a server method invocation. Note that all
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue