From 1cac9e0c8ace39b56e6b696194edd5f91153db2b Mon Sep 17 00:00:00 2001 From: Christian Ohr Date: Thu, 19 Sep 2024 18:12:51 +0200 Subject: [PATCH] #448: update HAPI FHIR, Camel, Groovy, Spring Boot --- boot/ipf-spring-boot-starter/pom.xml | 10 ---- .../ihe/fhir/DelegatingFhirContext.java | 53 ------------------- .../SslAwareMethanolRestfulClientFactory.java | 2 +- .../translation/XacmlToFhirTranslator.groovy | 5 +- .../ihe/fhir/chppqm/TranslationTest.java | 16 +++--- dependencies/pom.xml | 8 +-- .../iti68/Iti68ConsumerAuditInterceptor.java | 5 +- .../Iti68BinaryConsumerAuditInterceptor.java | 5 +- .../camel/ihe/fhir/iti68/TestIti68Error.java | 2 +- .../iti68/Iti68ConsumerAuditInterceptor.java | 5 +- pom.xml | 2 +- 11 files changed, 24 insertions(+), 89 deletions(-) delete mode 100644 commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/DelegatingFhirContext.java diff --git a/boot/ipf-spring-boot-starter/pom.xml b/boot/ipf-spring-boot-starter/pom.xml index 7bacea2e10..c0ab6adb19 100644 --- a/boot/ipf-spring-boot-starter/pom.xml +++ b/boot/ipf-spring-boot-starter/pom.xml @@ -25,16 +25,6 @@ org.apache.camel.springboot camel-spring-boot-starter - - - com.sun.xml.bind - jaxb-impl - - - com.sun.xml.bind - jaxb-core - - diff --git a/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/DelegatingFhirContext.java b/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/DelegatingFhirContext.java deleted file mode 100644 index a58e8b80ff..0000000000 --- a/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/DelegatingFhirContext.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openehealth.ipf.commons.ihe.fhir; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.client.api.IRestfulClientFactory; -import lombok.experimental.Delegate; - -/** - * Delegating FhirContext with a custom IRestfulClientFactory. This is more lightweight - * than to create new FhirContext instances just due to a different HTTP client setup. - */ -public class DelegatingFhirContext extends FhirContext { - - interface Excluded { - @SuppressWarnings("unused") - IRestfulClientFactory getRestfulClientFactory(); - } - - @Delegate(excludes = Excluded.class) - private final FhirContext fhirContext; - - private final IRestfulClientFactory restfulClientFactory; - - public DelegatingFhirContext(FhirContext fhirContext, IRestfulClientFactory restfulClientFactory) { - this.fhirContext = fhirContext; - this.restfulClientFactory = restfulClientFactory; - } - - @Override - public IRestfulClientFactory getRestfulClientFactory() { - return restfulClientFactory != null ? restfulClientFactory : fhirContext.getRestfulClientFactory(); - } - - public FhirContext getDelegate() { - return fhirContext; - } -} - - diff --git a/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/SslAwareMethanolRestfulClientFactory.java b/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/SslAwareMethanolRestfulClientFactory.java index 78d2b0b88b..d53107dbe4 100644 --- a/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/SslAwareMethanolRestfulClientFactory.java +++ b/commons/ihe/fhir/core/src/main/java/org/openehealth/ipf/commons/ihe/fhir/SslAwareMethanolRestfulClientFactory.java @@ -117,7 +117,7 @@ protected Methanol.Builder newHttpClientBuilder() { protected synchronized Methanol getNativeHttpClient() { if (httpClient == null) { var builder = httpClientBuilder() - .version(HttpClient.Version.HTTP_2) + .version(HttpClient.Version.HTTP_1_1) .followRedirects(HttpClient.Redirect.NORMAL) .priority(1) .cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_NONE)) diff --git a/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy b/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy index 46aff977ad..af80ea304e 100644 --- a/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy +++ b/commons/ihe/fhir/r4/chppqm/src/main/groovy/org/openehealth/ipf/commons/ihe/fhir/chppqm/translation/XacmlToFhirTranslator.groovy @@ -228,7 +228,8 @@ class XacmlToFhirTranslator { static Bundle translatePpq1To4Response( Bundle ppq4Request, AssertionBasedRequestType ppq1Request, - EprPolicyRepositoryResponse ppq1Response) + EprPolicyRepositoryResponse ppq1Response, + String baseUrl = "http://localhost/fhir") { if (ppq1Response.status == 'urn:e-health-suisse:2015:response-status:success') { Bundle ppq4Response = new Bundle( @@ -244,7 +245,7 @@ class XacmlToFhirTranslator { consentId = ChPpqmUtils.extractConsentIdFromUrl(ppq4RequestEntry.request.url) } ppq4Response.entry << new Bundle.BundleEntryComponent( - fullUrl: 'Consent?identifier=' + consentId, + fullUrl: "$baseUrl/Consent?identifier=$consentId", response: new Bundle.BundleEntryResponseComponent( status: (ppq1Request instanceof AddPolicyRequest) ? '201' : '200', ), diff --git a/commons/ihe/fhir/r4/chppqm/src/test/java/org/openehealth/ipf/commons/ihe/fhir/chppqm/TranslationTest.java b/commons/ihe/fhir/r4/chppqm/src/test/java/org/openehealth/ipf/commons/ihe/fhir/chppqm/TranslationTest.java index c917951100..385852e968 100644 --- a/commons/ihe/fhir/r4/chppqm/src/test/java/org/openehealth/ipf/commons/ihe/fhir/chppqm/TranslationTest.java +++ b/commons/ihe/fhir/r4/chppqm/src/test/java/org/openehealth/ipf/commons/ihe/fhir/chppqm/TranslationTest.java @@ -66,7 +66,7 @@ public static void beforeAll() { Xacml20Utils.initializeHerasaf(); } - private static void doTest(String templateId, Consent consent, String httpMethod, String expectedError) throws Exception { + private static void doTest(String templateId, Consent consent, String httpMethod, String expectedError) { log.debug("Consent:\n{}", PARSER.encodeResourceToString(consent)); consent.getIdentifier().stream() @@ -105,47 +105,47 @@ private static void doTest(String templateId, Consent consent, String httpMethod } @Test - public void testConsent201Creation1() throws Exception { + public void testConsent201Creation1() { Consent consent = create201Consent(createUuid(), "123456789012345678"); doTest("201", consent, "POST", null); } @Test - public void testConsent202Creation1() throws Exception { + public void testConsent202Creation1() { Consent consent = create202Consent(createUuid(), "123456789012345678", "urn:e-health-suisse:2015:policies:access-level:normal"); doTest("202", consent, "POST", null); } @Test - public void testConsent203Creation1() throws Exception { + public void testConsent203Creation1() { Consent consent = create203Consent(createUuid(), "123456789012345678", "urn:e-health-suisse:2015:policies:provide-level:restricted"); doTest("203", consent, "POST", null); } @Test - public void testConsent301Creation1() throws Exception { + public void testConsent301Creation1() { Consent consent = create301Consent(createUuid(), "123456789012345678", "3210987654321", "urn:e-health-suisse:2015:policies:access-level:normal", null, new Date()); doTest("301", consent, "POST", null); } @Test - public void testConsent302Creation1() throws Exception { + public void testConsent302Creation1() { Consent consent = create302Consent(createUuid(), "123456789012345678", "urn:oid:1.2.3.4.5", "urn:e-health-suisse:2015:policies:access-level:restricted", null, new Date()); doTest("302", consent, "POST", null); } @Test - public void testConsent303Creation1() throws Exception { + public void testConsent303Creation1() { Consent consent = create303Consent(createUuid(), "123456789012345678", "rep123", null, null); doTest("303", consent, "POST", null); } @Test - public void testConsent304Creation1() throws Exception { + public void testConsent304Creation1() { Consent consent = create304Consent(createUuid(), "123456789012345678", "3210987654321", "urn:e-health-suisse:2015:policies:access-level:delegation-and-normal", null, new Date()); doTest("304", consent, "POST", null); diff --git a/dependencies/pom.xml b/dependencies/pom.xml index af99c0b817..c6050a1c5a 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -10,7 +10,7 @@ 1.6 1.78 - 4.4.3 + 4.8.0 3.19.0 4.0.5 @@ -18,9 +18,9 @@ 1.27.1 1.3.200-v20130910-1609 3.6.200-v20130402-1505 - 4.0.22 + 4.0.23 2.5.1 - 7.2.3 + 7.4.0 3.0.2 3.0.0 5.3.1 @@ -39,7 +39,7 @@ 11.1.0 12.5 0.0.16 - 3.3.3 + 3.3.4 2.3 25.0 7.0.0 diff --git a/platform-camel/ihe/fhir/r4/mhd/src/main/java/org/openehealth/ipf/platform/camel/ihe/fhir/iti68/Iti68ConsumerAuditInterceptor.java b/platform-camel/ihe/fhir/r4/mhd/src/main/java/org/openehealth/ipf/platform/camel/ihe/fhir/iti68/Iti68ConsumerAuditInterceptor.java index d98d1ac1ed..d6f1fcb277 100644 --- a/platform-camel/ihe/fhir/r4/mhd/src/main/java/org/openehealth/ipf/platform/camel/ihe/fhir/iti68/Iti68ConsumerAuditInterceptor.java +++ b/platform-camel/ihe/fhir/r4/mhd/src/main/java/org/openehealth/ipf/platform/camel/ihe/fhir/iti68/Iti68ConsumerAuditInterceptor.java @@ -17,6 +17,7 @@ package org.openehealth.ipf.platform.camel.ihe.fhir.iti68; import org.apache.camel.Exchange; +import org.apache.camel.http.common.HttpMessage; import org.openehealth.ipf.commons.audit.AuditContext; import org.openehealth.ipf.commons.audit.codes.EventOutcomeIndicator; import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy; @@ -27,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.servlet.http.HttpServletRequest; - /** * Audit Interceptor for ITI-68. Note that the ParticipantObjectIdentificationType for the document * is not populated automatically, because the location of the parameters depends upon the actual @@ -102,7 +101,7 @@ private Iti68AuditDataset createAndEnrichAuditDatasetFromRequest(AuditStrategy1.18.34 5.15.0 0.6 - 10.1.28 + 10.1.30 4.25