Fix #296 - Handle :missing qualifier on QuantityParam
This commit is contained in:
parent
d8c571dfdc
commit
c7d3f39457
|
@ -193,7 +193,6 @@ public class QuantityParam extends BaseParamWithPrefix<QuantityParam> implements
|
|||
}
|
||||
|
||||
private void clear() {
|
||||
setMissing(null);
|
||||
setPrefix(null);
|
||||
setSystem((String)null);
|
||||
setUnits(null);
|
||||
|
|
|
@ -43,6 +43,8 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
|||
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
||||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.param.DateAndListParam;
|
||||
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
|
||||
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.util.PatternMatcher;
|
||||
|
@ -59,12 +61,14 @@ public class SearchDstu2Test {
|
|||
private static String ourLastMethod;
|
||||
private static DateAndListParam ourLastDateAndList;
|
||||
private static ReferenceParam ourLastRef;
|
||||
private static QuantityParam ourLastQuantity;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
ourLastMethod = null;
|
||||
ourLastDateAndList = null;
|
||||
ourLastRef = null;
|
||||
ourLastQuantity = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -77,6 +81,36 @@ public class SearchDstu2Test {
|
|||
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* See #296
|
||||
*/
|
||||
@Test
|
||||
public void testSearchQuantityMissingTrue() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?quantity:missing=true");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
ourLog.info(responseContent);
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
assertEquals(Boolean.TRUE, ourLastQuantity.getMissing());
|
||||
}
|
||||
|
||||
/**
|
||||
* See #296
|
||||
*/
|
||||
@Test
|
||||
public void testSearchQuantityValue() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?quantity=gt100");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
ourLog.info(responseContent);
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(ParamPrefixEnum.GREATERTHAN, ourLastQuantity.getPrefix());
|
||||
assertEquals(100, ourLastQuantity.getValue().intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchReferenceParams01() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchNoList&ref=123");
|
||||
|
@ -383,6 +417,16 @@ public class SearchDstu2Test {
|
|||
}
|
||||
//@formatter:on
|
||||
|
||||
//@formatter:off
|
||||
@Search()
|
||||
public List<Patient> searchQuantity(
|
||||
@RequiredParam(name="quantity") QuantityParam theParam) {
|
||||
ourLastMethod = "searchQuantity";
|
||||
ourLastQuantity = theParam;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
//@formatter:on
|
||||
|
||||
//@formatter:off
|
||||
@Search(queryName="searchNoList")
|
||||
public List<Patient> searchNoList(
|
||||
|
|
|
@ -134,6 +134,12 @@
|
|||
to a resource which already has one or more profiles set. Thanks to
|
||||
Magnus Vinther for reporting!
|
||||
</action>
|
||||
<action type="fix" issue="296">
|
||||
QuantityParam parameters being used in the RESTful server were ignoring
|
||||
the
|
||||
<![CDATA[<code>:missing</code>]]>
|
||||
qualifier. Thanks to Alexander Takacs for reporting!
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.4" date="2016-02-04">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue