From fc8ce73bb61c17ff0b8c72589ae2fb6c4fc965f3 Mon Sep 17 00:00:00 2001 From: tadgh Date: Mon, 27 Jan 2025 11:08:38 -0800 Subject: [PATCH 1/2] Rel 8 0 cves (#6655) * Bump logback core for https://nvd.nist.gov/vuln/detail/CVE-2024-12798 * Bump UCUM for https://github.com/FHIR/Ucum-java/security/advisories/GHSA-w9j7-phm3-f97j --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e8240dc45cf..ad3d4c367b2 100644 --- a/pom.xml +++ b/pom.xml @@ -1032,7 +1032,7 @@ 0.64.8 10.20.1 6.6.4.Final - 1.5.12 + 1.5.16 7.2.1.Final @@ -1084,7 +1084,7 @@ 1.0.1 1.52.0 8.15.3 - 1.0.8 + 1.0.9 3.17.0 From 8d60820554a44ee14c9aef934adcb120de7fef35 Mon Sep 17 00:00:00 2001 From: jmarchionatto <60409882+jmarchionatto@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:24:23 -0500 Subject: [PATCH 2/2] 6662 remote terminology boolean properties as string (#6663) * Add test for failing use case and fix by adding Boolean property for remote validation * changelog * Revert not yet supported change --- .../context/support/IValidationSupport.java | 34 +++++++++++++++++-- ...-terminology-boolean-values-as-string.yaml | 4 +++ ...teTerminologyServiceValidationSupport.java | 5 +++ .../hapi/validation/ILookupCodeTest.java | 14 ++++++-- .../RemoteTerminologyLookupCodeR4Test.java | 2 +- 5 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_8_0/6662-remote-terminology-boolean-values-as-string.yaml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java index 36df7a9ddd8..939c83dc0ce 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java @@ -774,6 +774,7 @@ public String getPropertyName() { // Some of the types in the spec are not yet implemented as well. // @see https://github.com/hapifhir/hapi-fhir/issues/5700 String TYPE_STRING = "string"; + String TYPE_BOOLEAN = "boolean"; String TYPE_CODING = "Coding"; String TYPE_GROUP = "group"; @@ -800,6 +801,29 @@ public String getType() { } } + class BooleanConceptProperty extends BaseConceptProperty { + private final boolean myValue; + + /** + * Constructor + * + * @param theName The name + */ + public BooleanConceptProperty(String theName, boolean theValue) { + super(theName); + myValue = theValue; + } + + public boolean getValue() { + return myValue; + } + + @Override + public String getType() { + return TYPE_BOOLEAN; + } + } + class CodingConceptProperty extends BaseConceptProperty { private final String myCode; private final String myCodeSystem; @@ -1073,7 +1097,7 @@ class ValueSetExpansionOutcome { private final IBaseResource myValueSet; private final String myError; - private boolean myErrorIsFromServer; + private final boolean myErrorIsFromServer; public ValueSetExpansionOutcome(String theError, boolean theErrorIsFromServer) { myValueSet = null; @@ -1199,7 +1223,7 @@ public LookupCodeResult setFound(boolean theFound) { } public void throwNotFoundIfAppropriate() { - if (isFound() == false) { + if (!isFound()) { throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode() + "] in system[" + getSearchedForSystem() + "]"); } @@ -1270,6 +1294,10 @@ private void populateProperty( StringConceptProperty stringConceptProperty = (StringConceptProperty) theConceptProperty; ParametersUtil.addPartString(theContext, theProperty, "value", stringConceptProperty.getValue()); break; + case TYPE_BOOLEAN: + BooleanConceptProperty booleanConceptProperty = (BooleanConceptProperty) theConceptProperty; + ParametersUtil.addPartBoolean(theContext, theProperty, "value", booleanConceptProperty.getValue()); + break; case TYPE_CODING: CodingConceptProperty codingConceptProperty = (CodingConceptProperty) theConceptProperty; ParametersUtil.addPartCoding( @@ -1321,7 +1349,7 @@ class TranslateCodeRequest { private final String myTargetValueSetUrl; private final IIdType myResourceId; private final boolean myReverse; - private List myCodings; + private final List myCodings; public TranslateCodeRequest(List theCodings, String theTargetSystemUrl) { myCodings = theCodings; diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_8_0/6662-remote-terminology-boolean-values-as-string.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_8_0/6662-remote-terminology-boolean-values-as-string.yaml new file mode 100644 index 00000000000..469cd7d40f1 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_8_0/6662-remote-terminology-boolean-values-as-string.yaml @@ -0,0 +1,4 @@ +--- +type: fix +issue: 6662 +title: "Fixed remote terminology lookup results showing boolean properties as strings." diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/RemoteTerminologyServiceValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/RemoteTerminologyServiceValidationSupport.java index f6579bb525f..530faa86e63 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/RemoteTerminologyServiceValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/RemoteTerminologyServiceValidationSupport.java @@ -27,6 +27,7 @@ import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.Base; +import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.CodeType; import org.hl7.fhir.r4.model.CodeableConcept; @@ -457,6 +458,10 @@ private static BaseConceptProperty createConceptPropertyR4(final String theName, StringType stringType = (StringType) theValue; conceptProperty = new StringConceptProperty(theName, stringType.getValue()); break; + case IValidationSupport.TYPE_BOOLEAN: + BooleanType booleanType = (BooleanType) theValue; + conceptProperty = new BooleanConceptProperty(theName, booleanType.getValue()); + break; case IValidationSupport.TYPE_CODING: Coding coding = (Coding) theValue; conceptProperty = diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/ILookupCodeTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/ILookupCodeTest.java index eac448ad0eb..8e7641d89dc 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/ILookupCodeTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/ILookupCodeTest.java @@ -7,6 +7,7 @@ import ca.uhn.fhir.context.support.IValidationSupport.GroupConceptProperty; import ca.uhn.fhir.context.support.IValidationSupport.LookupCodeResult; import ca.uhn.fhir.context.support.IValidationSupport.StringConceptProperty; +import ca.uhn.fhir.context.support.IValidationSupport.BooleanConceptProperty; import ca.uhn.fhir.context.support.LookupCodeRequest; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.test.utilities.validation.IValidationProviders; @@ -17,17 +18,18 @@ import java.util.List; import java.util.Optional; +import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_BOOLEAN; import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_CODING; import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_GROUP; import static ca.uhn.fhir.context.support.IValidationSupport.TYPE_STRING; -import static java.util.stream.IntStream.range; -import static org.assertj.core.api.Assertions.assertThat; import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE; import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE_SYSTEM; import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE_SYSTEM_NAME; import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.CODE_SYSTEM_VERSION; import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.DISPLAY; import static ca.uhn.fhir.test.utilities.validation.IValidationProviders.LANGUAGE; +import static java.util.stream.IntStream.range; +import static org.assertj.core.api.Assertions.assertThat; import static org.hl7.fhir.common.hapi.validation.support.RemoteTerminologyServiceValidationSupport.createConceptProperty; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -198,7 +200,8 @@ default void verifyLookupCodeResult(LookupCodeRequest theRequest, LookupCodeResu assertEquals(theExpectedResult.isCodeIsAbstract(), outcome.isCodeIsAbstract()); assertEquals(theExpectedResult.getProperties().size(), outcome.getProperties().size()); - range(0, outcome.getProperties().size()).forEach(i -> assertEqualConceptProperty(theExpectedResult.getProperties().get(i), outcome.getProperties().get(i))); + range(0, outcome.getProperties().size()).forEach(i -> + assertEqualConceptProperty(theExpectedResult.getProperties().get(i), outcome.getProperties().get(i))); assertEquals(theExpectedResult.getDesignations().size(), outcome.getDesignations().size()); range(0, outcome.getDesignations().size()).forEach(i -> assertEqualConceptDesignation(theExpectedResult.getDesignations().get(i), outcome.getDesignations().get(i))); @@ -225,6 +228,11 @@ private void assertEqualConceptProperty(BaseConceptProperty theProperty, BaseCon StringConceptProperty actual = (StringConceptProperty) theProperty; assertEquals(expected.getValue(), actual.getValue()); } + case TYPE_BOOLEAN -> { + BooleanConceptProperty expected = (BooleanConceptProperty) theExpectedProperty; + IValidationSupport.BooleanConceptProperty actual = (BooleanConceptProperty) theProperty; + assertEquals(expected.getValue(), actual.getValue()); + } case TYPE_CODING -> { CodingConceptProperty expected = (CodingConceptProperty) theExpectedProperty; CodingConceptProperty actual = (CodingConceptProperty) theProperty; diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/RemoteTerminologyLookupCodeR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/RemoteTerminologyLookupCodeR4Test.java index 382f621f547..9b0d4e2ca14 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/RemoteTerminologyLookupCodeR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/RemoteTerminologyLookupCodeR4Test.java @@ -133,7 +133,7 @@ public static Stream getPropertyValueListArguments() { @ParameterizedTest @MethodSource(value = "getPropertyValueArguments") public void lookupCode_forCodeSystemWithProperty_returnsCorrectProperty(IBaseDatatype thePropertyValue) { - verifyLookupWithProperty(List.of(thePropertyValue), List.of()); + verifyLookupWithProperty(List.of(thePropertyValue), List.of(0)); } @ParameterizedTest