Tweak to elements parametr support
This commit is contained in:
parent
5aadf91a83
commit
10c348d44f
|
@ -1277,18 +1277,22 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
|
||||||
private void writeExtensionsAsDirectChild(IBaseResource theResource, JsonLikeWriter theEventWriter, RuntimeResourceDefinition resDef, List<HeldExtension> extensions,
|
private void writeExtensionsAsDirectChild(IBaseResource theResource, JsonLikeWriter theEventWriter, RuntimeResourceDefinition resDef, List<HeldExtension> extensions,
|
||||||
List<HeldExtension> modifierExtensions, EncodeContext theEncodeContext) throws IOException {
|
List<HeldExtension> modifierExtensions, EncodeContext theEncodeContext) throws IOException {
|
||||||
if (extensions.isEmpty() == false) {
|
if (extensions.isEmpty() == false) {
|
||||||
|
theEncodeContext.pushPath("extension", false);
|
||||||
beginArray(theEventWriter, "extension");
|
beginArray(theEventWriter, "extension");
|
||||||
for (HeldExtension next : extensions) {
|
for (HeldExtension next : extensions) {
|
||||||
next.write(resDef, theResource, theEventWriter, theEncodeContext);
|
next.write(resDef, theResource, theEventWriter, theEncodeContext);
|
||||||
}
|
}
|
||||||
theEventWriter.endArray();
|
theEventWriter.endArray();
|
||||||
|
theEncodeContext.popPath();
|
||||||
}
|
}
|
||||||
if (modifierExtensions.isEmpty() == false) {
|
if (modifierExtensions.isEmpty() == false) {
|
||||||
|
theEncodeContext.pushPath("modifierExtension", false);
|
||||||
beginArray(theEventWriter, "modifierExtension");
|
beginArray(theEventWriter, "modifierExtension");
|
||||||
for (HeldExtension next : modifierExtensions) {
|
for (HeldExtension next : modifierExtensions) {
|
||||||
next.write(resDef, theResource, theEventWriter, theEncodeContext);
|
next.write(resDef, theResource, theEventWriter, theEncodeContext);
|
||||||
}
|
}
|
||||||
theEventWriter.endArray();
|
theEventWriter.endArray();
|
||||||
|
theEncodeContext.popPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.config;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
|
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
|
||||||
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
import ca.uhn.fhir.validation.ResultSeverityEnum;
|
||||||
import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
|
import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
|
||||||
|
import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel;
|
||||||
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
|
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
|
||||||
import org.apache.commons.dbcp2.BasicDataSource;
|
import org.apache.commons.dbcp2.BasicDataSource;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
|
@ -2029,6 +2029,24 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchStringParamWithLike() throws Exception {
|
||||||
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
|
map.add(Patient.SP_FAMILY, new StringOrListParam().addOr(new StringParam("AAA")).addOr(new StringParam("BBB")));
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
myPatientDao.search(map);
|
||||||
|
|
||||||
|
List<String> queries = CaptureQueriesListener
|
||||||
|
.getLastNQueries()
|
||||||
|
.stream()
|
||||||
|
.map(t -> t.getSql(true, true))
|
||||||
|
.filter(t -> t.contains("select"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
ourLog.info("Queries:\n " + queries.stream().collect(Collectors.joining("\n ")));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchStringParam() throws Exception {
|
public void testSearchStringParam() throws Exception {
|
||||||
IIdType pid1;
|
IIdType pid1;
|
||||||
|
|
|
@ -246,6 +246,42 @@ public class ElementsParamR4Test {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMultiResourceElementsOnExtension() throws IOException {
|
||||||
|
ourNextProcedure = new Procedure();
|
||||||
|
ourNextProcedure.setId("Procedure/PROC");
|
||||||
|
ourNextProcedure.addExtension()
|
||||||
|
.setUrl("http://quantity")
|
||||||
|
.setValue(Quantity.fromUcum("1.1", "mg"));
|
||||||
|
verifyXmlAndJson(
|
||||||
|
"http://localhost:" + ourPort + "/Procedure?_elements=Procedure.extension",
|
||||||
|
bundle -> {
|
||||||
|
Procedure procedure = (Procedure) bundle.getEntry().get(0).getResource();
|
||||||
|
assertEquals("SUBSETTED", procedure.getMeta().getTag().get(0).getCode());
|
||||||
|
assertEquals(0, procedure.getReasonCode().size());
|
||||||
|
assertEquals("http://quantity", procedure.getExtension().get(0).getUrl());
|
||||||
|
assertEquals("mg", ((Quantity) procedure.getExtension().get(0).getValue()).getCode());
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyXmlAndJson(
|
||||||
|
"http://localhost:" + ourPort + "/Procedure?_elements=Procedure.extension.value.value",
|
||||||
|
bundle -> {
|
||||||
|
Procedure procedure = (Procedure) bundle.getEntry().get(0).getResource();
|
||||||
|
assertEquals("SUBSETTED", procedure.getMeta().getTag().get(0).getCode());
|
||||||
|
assertEquals(0, procedure.getReasonCode().size());
|
||||||
|
assertEquals("1.1", ((Quantity) procedure.getExtension().get(0).getValue()).getValueElement().getValueAsString());
|
||||||
|
assertEquals(null, ((Quantity) procedure.getExtension().get(0).getValue()).getCode());
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyXmlAndJson(
|
||||||
|
"http://localhost:" + ourPort + "/Procedure?_elements=Procedure.reason",
|
||||||
|
bundle -> {
|
||||||
|
Procedure procedure = (Procedure) bundle.getEntry().get(0).getResource();
|
||||||
|
assertEquals("SUBSETTED", procedure.getMeta().getTag().get(0).getCode());
|
||||||
|
assertEquals(0, procedure.getExtension().size());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiResourceElementsFilterWithMetadataExcluded() throws IOException {
|
public void testMultiResourceElementsFilterWithMetadataExcluded() throws IOException {
|
||||||
createProcedureWithLongChain();
|
createProcedureWithLongChain();
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
enabled after the refactoring of how Subscriptions are enabled that
|
enabled after the refactoring of how Subscriptions are enabled that
|
||||||
occurred in HAPI FHIR 3.7.0. Thanks to Volker Schmidt for the pull request!
|
occurred in HAPI FHIR 3.7.0. Thanks to Volker Schmidt for the pull request!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
When using the <![CDATA[<code>_elements</code>]]> parameter on searches and reads,
|
||||||
|
requesting extensions to be included caused the extensions to be included but
|
||||||
|
not any values contained within. This has been corrected.
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="3.7.0" date="2019-02-06" description="Gale">
|
<release version="3.7.0" date="2019-02-06" description="Gale">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
|
Loading…
Reference in New Issue