Merge branch 'master' into reuse-subscription-channels

# Conflicts:
#	src/changes/changes.xml
This commit is contained in:
Ken Stevens 2019-02-14 19:42:00 -05:00
commit ffc5966aa3
5 changed files with 64 additions and 0 deletions

View File

@ -1277,18 +1277,22 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
private void writeExtensionsAsDirectChild(IBaseResource theResource, JsonLikeWriter theEventWriter, RuntimeResourceDefinition resDef, List<HeldExtension> extensions,
List<HeldExtension> modifierExtensions, EncodeContext theEncodeContext) throws IOException {
if (extensions.isEmpty() == false) {
theEncodeContext.pushPath("extension", false);
beginArray(theEventWriter, "extension");
for (HeldExtension next : extensions) {
next.write(resDef, theResource, theEventWriter, theEncodeContext);
}
theEventWriter.endArray();
theEncodeContext.popPath();
}
if (modifierExtensions.isEmpty() == false) {
theEncodeContext.pushPath("modifierExtension", false);
beginArray(theEventWriter, "modifierExtension");
for (HeldExtension next : modifierExtensions) {
next.write(resDef, theResource, theEventWriter, theEncodeContext);
}
theEventWriter.endArray();
theEncodeContext.popPath();
}
}

View File

@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.config;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.context.annotation.Bean;

View File

@ -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
public void testSearchStringParam() throws Exception {
IIdType pid1;

View File

@ -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
public void testMultiResourceElementsFilterWithMetadataExcluded() throws IOException {
createProcedureWithLongChain();

View File

@ -29,6 +29,11 @@
<action type="change">
Re-use subscription channel and handlers when a subscription is updated (unless the channel type changed).
</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 version="3.7.0" date="2019-02-06" description="Gale">
<action type="add">