From d4d31786215aa522bc661239a14b3a362a1edd19 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sat, 11 May 2019 15:04:44 -0400 Subject: [PATCH] A couple of test fixes --- .../r4/ResourceProviderR4ValueSetTest.java | 2 -- .../terminologies/ValueSetExpanderSimple.java | 16 +++++++++------- .../hapi/validation/ValidationSupportChain.java | 13 +++++++------ .../hapi/validation/ValidationSupportChain.java | 5 ++++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java index 4b0773ae70f..62519d12477 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java @@ -362,7 +362,6 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { createExternalCsAndLocalVs(); assertNotNull(myLocalValueSetId); - //@formatter:off Parameters respParam = ourClient .operation() .onType(ValueSet.class) @@ -370,7 +369,6 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .withParameter(Parameters.class, "url", new UriType(URL_MY_VALUE_SET)) .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); - //@formatter:on String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/terminologies/ValueSetExpanderSimple.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/terminologies/ValueSetExpanderSimple.java index fedfe244fe5..c8ca9ad6a1e 100644 --- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/terminologies/ValueSetExpanderSimple.java +++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/terminologies/ValueSetExpanderSimple.java @@ -179,14 +179,16 @@ public class ValueSetExpanderSimple implements ValueSetExpander { } private void addCodes(ValueSetExpansionComponent expand, List params, ExpansionProfile profile, List filters) throws ETooCostly { - if (expand.getContains().size() > maxExpansionSize) - throw new ETooCostly("Too many codes to display (>" + Integer.toString(expand.getContains().size()) + ")"); - for (ValueSetExpansionParameterComponent p : expand.getParameter()) { - if (!existsInParams(params, p.getName(), p.getValue())) - params.add(p); - } +// if (expand != null) { + if (expand.getContains().size() > maxExpansionSize) + throw new ETooCostly("Too many codes to display (>" + Integer.toString(expand.getContains().size()) + ")"); + for (ValueSetExpansionParameterComponent p : expand.getParameter()) { + if (!existsInParams(params, p.getName(), p.getValue())) + params.add(p); + } - copyImportContains(expand.getContains(), null, profile, filters); + copyImportContains(expand.getContains(), null, profile, filters); +// } } private void excludeCode(String theSystem, String theCode) { diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/ValidationSupportChain.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/ValidationSupportChain.java index 33f92793610..2dbc1fe8baa 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/ValidationSupportChain.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/ValidationSupportChain.java @@ -52,14 +52,15 @@ public class ValidationSupportChain implements IValidationSupport { for (IValidationSupport next : myChain) { if (isNotBlank(theInclude.getSystem())) { if (next.isCodeSystemSupported(theCtx, theInclude.getSystem())) { - return next.expandValueSet(theCtx, theInclude); + ValueSetExpansionComponent expansion = next.expandValueSet(theCtx, theInclude); + if (expansion != null) { + return expansion; + } } } - for (UriType nextValueSet : theInclude.getValueSet()) { - ValueSetExpansionComponent retVal = next.expandValueSet(theCtx, theInclude); - if (retVal != null && retVal.getContains().size() > 0) { - return retVal; - } + ValueSetExpansionComponent retVal = next.expandValueSet(theCtx, theInclude); + if (retVal != null && retVal.getContains().size() > 0) { + return retVal; } } return myChain.get(0).expandValueSet(theCtx, theInclude); diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/ValidationSupportChain.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/ValidationSupportChain.java index 2f3e3d6eab3..5dade765e8a 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/ValidationSupportChain.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/ValidationSupportChain.java @@ -51,7 +51,10 @@ public class ValidationSupportChain implements IValidationSupport { public ValueSetExpander.ValueSetExpansionOutcome expandValueSet(FhirContext theCtx, ConceptSetComponent theInclude) { for (IValidationSupport next : myChain) { if (next.isCodeSystemSupported(theCtx, theInclude.getSystem())) { - return next.expandValueSet(theCtx, theInclude); + ValueSetExpander.ValueSetExpansionOutcome expansion = next.expandValueSet(theCtx, theInclude); + if (expansion != null) { + return expansion; + } } }