From fd76766da74d0a37c141454209b06fb91b590694 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 1 Sep 2022 22:42:16 +1000 Subject: [PATCH] check activeOnly parameter --- .../terminologies/ValueSetExpanderSimple.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java index 9123b9225..0a8b5b973 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java @@ -427,7 +427,7 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx focus.getExpansion().setTimestampElement(DateTimeType.now()); focus.getExpansion().setIdentifier(Factory.createUUID()); for (ParametersParameterComponent p : expParams.getParameter()) { - if (Utilities.existsInList(p.getName(), "includeDesignations", "excludeNested")) + if (Utilities.existsInList(p.getName(), "includeDesignations", "excludeNested", "activeOnly")) focus.getExpansion().addParameter().setName(p.getName()).setValue(p.getValue()); } @@ -487,10 +487,24 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx first = false; else canBeHeirarchy = false; - includeCodes(inc, exp, expParams, canBeHeirarchy, compose.hasInactive() && !compose.getInactive(), extensions, valueSet); + includeCodes(inc, exp, expParams, canBeHeirarchy, compose.hasInactive() ? !compose.getInactive() : checkNoInActiveFromParam(expParams), extensions, valueSet); } } + /** + * returns true if activeOnly = true + * @param expParams + * @return + */ + private boolean checkNoInActiveFromParam(Parameters expParams) { + for (ParametersParameterComponent p : expParams.getParameter()) { + if (p.getName().equals("activeOnly")) { + return p.getValueBooleanType().getValue(); + } + } + return false; + } + private ValueSet importValueSet(String value, ValueSetExpansionComponent exp, Parameters expParams, boolean noInactive, ValueSet valueSet) throws ETooCostly, TerminologyServiceException, FileNotFoundException, IOException, FHIRFormatError { if (value == null) throw fail("unable to find value set with no identity");