diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java index f0e13e587aa8..5b95a4e5c777 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java @@ -50,11 +50,13 @@ import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; +import ca.uhn.fhir.context.BaseRuntimeChildDatatypeDefinition; import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition; import ca.uhn.fhir.context.BaseRuntimeElementDefinition; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.context.IRuntimeDatatypeDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IQueryParameterType; @@ -1496,8 +1498,16 @@ private void addParam(String theName, IBase theValue) { parameterElem.getChildByName("name").getMutator().setValue(parameter, name); if (theValue instanceof IBaseDatatype) { - String childElementName = "value" + StringUtils.capitalize(myContext.getElementDefinition(theValue.getClass()).getName()); - parameterElem.getChildByName(childElementName).getMutator().setValue(parameter, theValue); + BaseRuntimeElementDefinition datatypeDef = myContext.getElementDefinition(theValue.getClass()); + if (datatypeDef instanceof IRuntimeDatatypeDefinition) { + Class profileOf = ((IRuntimeDatatypeDefinition) datatypeDef).getProfileOf(); + if (profileOf != null) { + datatypeDef = myContext.getElementDefinition(profileOf); + } + } + String childElementName = "value" + StringUtils.capitalize(datatypeDef.getName()); + BaseRuntimeChildDefinition childByName = parameterElem.getChildByName(childElementName); + childByName.getMutator().setValue(parameter, theValue); } else if (theValue instanceof IBaseResource) { parameterElem.getChildByName("resource").getMutator().setValue(parameter, theValue); } else { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java index 8a223778f783..5a3ba9f65d05 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java @@ -27,7 +27,7 @@ import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -312,7 +312,7 @@ public static BaseHttpClientInvocation createOperationInvocation(FhirContext the FhirTerser t = theContext.newTerser(); List parameters = t.getValues(theInput, "Parameters.parameter"); - Map> params = new HashMap>(); + Map> params = new LinkedHashMap>(); for (Object nextParameter : parameters) { IPrimitiveType nextNameDt = (IPrimitiveType) t.getSingleValueOrNull((IBase) nextParameter, "name"); if (nextNameDt == null || nextNameDt.isEmpty()) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderValueSetDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderValueSetDstu2.java index fcf7efcfb5b7..f97e30546959 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderValueSetDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderValueSetDstu2.java @@ -46,7 +46,7 @@ public class BaseJpaResourceProviderValueSetDstu2 extends JpaResourceProviderDst //@formatter:off @Operation(name = "$expand", idempotent = true) - public ValueSet expant( + public ValueSet expand( HttpServletRequest theServletRequest, @IdParam(optional=true) IdDt theId, @OperationParam(name="valueSet", min=0, max=1) ValueSet theValueSet, @@ -110,13 +110,13 @@ private String toFilterString(StringDt theFilter) { }) public Parameters validateCode( HttpServletRequest theServletRequest, - @IdParam IdDt theId, - @OperationParam(name="identifier") UriDt theValueSetIdentifier, - @OperationParam(name="code") CodeDt theCode, - @OperationParam(name="system") UriDt theSystem, - @OperationParam(name="display") StringDt theDisplay, - @OperationParam(name="coding") CodingDt theCoding, - @OperationParam(name="codeableConcept") CodeableConceptDt theCodeableConcept + @IdParam(optional=true) IdDt theId, + @OperationParam(name="identifier", min=0, max=1) UriDt theValueSetIdentifier, + @OperationParam(name="code", min=0, max=1) CodeDt theCode, + @OperationParam(name="system", min=0, max=1) UriDt theSystem, + @OperationParam(name="display", min=0, max=1) StringDt theDisplay, + @OperationParam(name="coding", min=0, max=1) CodingDt theCoding, + @OperationParam(name="codeableConcept", min=0, max=1) CodeableConceptDt theCodeableConcept ) { //@formatter:on diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2ValueSetTest.java index f592ea22dcde..2ceff26bd2a8 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2ValueSetTest.java @@ -16,6 +16,8 @@ import ca.uhn.fhir.model.dstu2.resource.Parameters; import ca.uhn.fhir.model.dstu2.resource.ValueSet; +import ca.uhn.fhir.model.primitive.BooleanDt; +import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.UriDt; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -33,6 +35,26 @@ public void before02() throws IOException { myExtensionalVsId = myValueSetDao.create(upload).getId().toUnqualifiedVersionless(); } + @Test + public void testValidateCodeOperationByCodeAndSystemBad() { + //@formatter:off + Parameters respParam = ourClient + .operation() + .onInstance(myExtensionalVsId) + .named("validate-code") + .withParameter(Parameters.class, "code", new CodeDt("8495-4")) + .andParameter("system", new UriDt("http://loinc.org")) + .execute(); + //@formatter:on + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + assertEquals(new BooleanDt(true), respParam.getParameter().get(0).getValue()); + } + + + @Test public void testExpandById() throws IOException { //@formatter:off @@ -115,7 +137,7 @@ public void testExpandByIdentifier() { //@formatter:off Parameters respParam = ourClient .operation() - .onInstance(myExtensionalVsId) + .onType(ValueSet.class) .named("expand") .withParameter(Parameters.class, "identifier", new UriDt("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) .andParameter("filter", new StringDt("11378")) @@ -141,7 +163,7 @@ public void testExpandByValueSet() throws IOException { //@formatter:off Parameters respParam = ourClient .operation() - .onInstance(myExtensionalVsId) + .onType(ValueSet.class) .named("expand") .withParameter(Parameters.class, "valueSet", toExpand) .andParameter("filter", new StringDt("11378")) diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java index ebbba9ca8435..9a106f8d5aab 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java @@ -22,6 +22,7 @@ import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; import org.apache.http.client.methods.HttpUriRequest; @@ -52,6 +53,7 @@ import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; import ca.uhn.fhir.model.dstu2.resource.Parameters; import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.DateDt; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; @@ -70,6 +72,8 @@ public class GenericClientDstu2Test { private static FhirContext ourCtx; + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GenericClientDstu2Test.class); + private HttpClient myHttpClient; private HttpResponse myHttpResponse; @@ -1089,6 +1093,60 @@ public boolean isEmpty() { //@formatter:on } + @Test + public void testOperationWithProfiledDatatypeParam() throws IOException, Exception { + IParser p = ourCtx.newXmlParser(); + + Parameters outParams = new Parameters(); + outParams.addParameter().setValue(new StringDt("STRINGVALOUT1")); + outParams.addParameter().setValue(new StringDt("STRINGVALOUT2")); + final String respString = p.encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + //@formatter:off + client + .operation() + .onInstance(new IdDt("http://foo/Patient/1")) + .named("validate-code") + .withParameter(Parameters.class, "code", new CodeDt("8495-4")) + .andParameter("system", new UriDt("http://loinc.org")) + .useHttpGet() + .execute(); + //@formatter:off + + assertEquals("http://example.com/fhir/Patient/1/$validate-code?code=8495-4&system=http%3A%2F%2Floinc.org", capt.getAllValues().get(idx).getURI().toASCIIString()); + + //@formatter:off + idx++; + client + .operation() + .onInstance(new IdDt("http://foo/Patient/1")) + .named("validate-code") + .withParameter(Parameters.class, "code", new CodeDt("8495-4")) + .andParameter("system", new UriDt("http://loinc.org")) + .execute(); + //@formatter:off + + assertEquals("http://example.com/fhir/Patient/1/$validate-code", capt.getAllValues().get(idx).getURI().toASCIIString()); + ourLog.info(extractBody(capt, idx)); + assertEquals("",extractBody(capt, idx)); + + } + @Test public void testOperationWithListOfParameterResponse() throws Exception { IParser p = ourCtx.newXmlParser(); @@ -1556,6 +1614,85 @@ public void testSearchByString() throws Exception { } + @Test + public void testSearchByUrl() throws Exception { + + final String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + int idx = 0; + + //@formatter:off + ca.uhn.fhir.model.dstu2.resource.Bundle response = client.search() + .byUrl("http://foo?name=http://foo|bar") + .encodedJson() + .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://foo?name=http%3A//foo%7Cbar&_format=json", capt.getAllValues().get(idx).getURI().toString()); + assertNotNull(response); + idx++; + + //@formatter:off + response = client.search() + .byUrl("Patient?name=http://foo|bar") + .encodedJson() + .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient?name=http%3A//foo%7Cbar&_format=json", capt.getAllValues().get(idx).getURI().toString()); + assertNotNull(response); + idx++; + + //@formatter:off + response = client.search() + .byUrl("/Patient?name=http://foo|bar") + .encodedJson() + .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient?name=http%3A//foo%7Cbar&_format=json", capt.getAllValues().get(idx).getURI().toString()); + assertNotNull(response); + idx++; + + //@formatter:off + response = client.search() + .byUrl("Patient") + .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString()); + assertNotNull(response); + idx++; + + //@formatter:off + response = client.search() + .byUrl("Patient?") + .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient?", capt.getAllValues().get(idx).getURI().toString()); + assertNotNull(response); + idx++; + + try { + client.search().byUrl("foo/bar?test=1"); + } catch (IllegalArgumentException e) { + assertEquals("Search URL must be either a complete URL starting with http: or https:, or a relative FHIR URL in the form [ResourceType]?[Params]", e.getMessage()); + } + } + /** * See #191 */ @@ -1692,84 +1829,6 @@ public void testSearchWithReverseInclude() throws Exception { } - @Test - public void testSearchByUrl() throws Exception { - - final String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); - }}); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - int idx = 0; - - //@formatter:off - ca.uhn.fhir.model.dstu2.resource.Bundle response = client.search() - .byUrl("http://foo?name=http://foo|bar") - .encodedJson() - .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) - .execute(); - //@formatter:on - assertEquals("http://foo?name=http%3A//foo%7Cbar&_format=json", capt.getAllValues().get(idx).getURI().toString()); - assertNotNull(response); - idx++; - - //@formatter:off - response = client.search() - .byUrl("Patient?name=http://foo|bar") - .encodedJson() - .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) - .execute(); - //@formatter:on - assertEquals("http://example.com/fhir/Patient?name=http%3A//foo%7Cbar&_format=json", capt.getAllValues().get(idx).getURI().toString()); - assertNotNull(response); - idx++; - - //@formatter:off - response = client.search() - .byUrl("/Patient?name=http://foo|bar") - .encodedJson() - .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) - .execute(); - //@formatter:on - assertEquals("http://example.com/fhir/Patient?name=http%3A//foo%7Cbar&_format=json", capt.getAllValues().get(idx).getURI().toString()); - assertNotNull(response); - idx++; - - //@formatter:off - response = client.search() - .byUrl("Patient") - .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) - .execute(); - //@formatter:on - assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString()); - assertNotNull(response); - idx++; - - //@formatter:off - response = client.search() - .byUrl("Patient?") - .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class) - .execute(); - //@formatter:on - assertEquals("http://example.com/fhir/Patient?", capt.getAllValues().get(idx).getURI().toString()); - assertNotNull(response); - idx++; - - try { - client.search().byUrl("foo/bar?test=1"); - } catch (IllegalArgumentException e) { - assertEquals("Search URL must be either a complete URL starting with http: or https:, or a relative FHIR URL in the form [ResourceType]?[Params]", e.getMessage()); - } - } - @Test public void testSearchWithSummaryParam() throws Exception { String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}"; diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java index e481fc4b9c2f..beda80735ac3 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java @@ -7,13 +7,18 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; @@ -28,6 +33,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.primitive.InstantDt; @@ -138,6 +144,48 @@ public void testSearchDateAndList() throws Exception { assertEquals("2002", ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(1).getValueAsString()); } + + @Test + public void testSearchByPost() throws Exception { + HttpPost httpGet = new HttpPost("http://localhost:" + ourPort + "/Patient/_search"); + StringEntity entity = new StringEntity("searchDateAndList=2001,2002&searchDateAndList=2003,2004", ContentType.APPLICATION_FORM_URLENCODED); + httpGet.setEntity(entity); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + ourLog.info(responseContent); + assertEquals("searchDateAndList", ourLastMethod); + assertEquals(2, ourLastDateAndList.getValuesAsQueryTokens().size()); + assertEquals(2, ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().size()); + assertEquals(2, ourLastDateAndList.getValuesAsQueryTokens().get(1).getValuesAsQueryTokens().size()); + assertEquals("2001", ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0).getValueAsString()); + assertEquals("2002", ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(1).getValueAsString()); + assertThat(responseContent, containsString("SYSTEM")); + } + + @Test + public void testSearchByPostWithBodyAndUrlParams() throws Exception { + + HttpPost httpGet = new HttpPost("http://localhost:" + ourPort + "/Patient/_search?_format=json"); + StringEntity entity = new StringEntity("searchDateAndList=2001,2002&searchDateAndList=2003,2004", ContentType.APPLICATION_FORM_URLENCODED); + httpGet.setEntity(entity); + + CloseableHttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + ourLog.info(responseContent); + assertEquals("searchDateAndList", ourLastMethod); + assertEquals(2, ourLastDateAndList.getValuesAsQueryTokens().size()); + assertEquals(2, ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().size()); + assertEquals(2, ourLastDateAndList.getValuesAsQueryTokens().get(1).getValuesAsQueryTokens().size()); + assertEquals("2001", ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0).getValueAsString()); + assertEquals("2002", ourLastDateAndList.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(1).getValueAsString()); + assertThat(responseContent, containsString(":\"SYSTEM\"")); + + } + + @Test public void testSearchBlacklist01Failing() throws Exception { HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.black1=value"); @@ -292,7 +340,11 @@ public List searchDateAndList( @RequiredParam(name = "searchDateAndList") DateAndListParam theParam) { ourLastMethod = "searchDateAndList"; ourLastDateAndList = theParam; - return Collections.emptyList(); + ArrayList retVal = new ArrayList(); + Patient patient = new Patient(); + patient.setId("1"); + retVal.add(patient.addIdentifier(new IdentifierDt("SYSTEM", "CODE"))); + return retVal; } //@formatter:on diff --git a/hapi-tinder-plugin/src/main/resources/vm/valueset.vm b/hapi-tinder-plugin/src/main/resources/vm/valueset.vm index bb28287f96db..0e338100456e 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/valueset.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/valueset.vm @@ -69,7 +69,7 @@ public enum ${valueSet.className} { /** * Returns the enumerated value associated with this code */ - public ${valueSet.className} forCode(String theCode) { + public static ${valueSet.className} forCode(String theCode) { ${valueSet.className} retVal = CODE_TO_ENUM.get(theCode); return retVal; }