diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientFactory.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientFactory.java index a2cffdb..a2ebd6c 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientFactory.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientFactory.java @@ -155,11 +155,10 @@ public void testConnection() { logger.info( "Testing connection to Data Store FHIR server with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {}," - + " basicAuthUsername {}, basicAuthPassword {}, bearerToken {}, serverBase: {}, proxyUrl {}, proxyUsername, proxyPassword {}}", + + " basicAuthUsername: {}, basicAuthPassword: {}, bearerToken: {}, serverBase: {}, proxy: values from 'DEV_DSF_PROXY'... config}", trustStorePath, certificatePath, privateKeyPath, privateKeyPassword != null ? "***" : "null", dataStoreServerBasicAuthUsername, dataStoreServerBasicAuthPassword != null ? "***" : "null", - dataStoreServerBearerToken != null ? "***" : "null", dataStoreServerBase, proxyUrl, proxyUsername, - proxyPassword != null ? "***" : "null"); + dataStoreServerBearerToken != null ? "***" : "null", dataStoreServerBase); getDataStoreClient().testConnection(); } diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientImpl.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientImpl.java index 9963ad4..19ca8fd 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientImpl.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/DataStoreClientImpl.java @@ -81,8 +81,7 @@ private void configureProxy(IRestfulClientFactory clientFactory, String proxyUrl clientFactory.setProxy(url.getHost(), url.getPort()); clientFactory.setProxyCredentials(proxyUsername, proxyPassword); - logger.info("Using proxy for data FHIR server connection with {host: {}, port: {}, username: {}}", - url.getHost(), url.getPort(), proxyUsername); + logger.info("Using proxy for data FHIR server connection with values from 'DEV_DSF_PROXY'... config"); } catch (MalformedURLException e) { diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientFactory.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientFactory.java index 3a2eac6..d86083d 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientFactory.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientFactory.java @@ -154,11 +154,10 @@ public void testConnection() { logger.info( "Testing connection to fTTP with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {}," - + " basicAuthUsername: {}, basicAuthPassword: {}, serverBase: {}, apiKey: {}, study: {}, target: {}, proxyUrl: {}, proxyUsername: {}, proxyPassword: {}}", + + " basicAuthUsername: {}, basicAuthPassword: {}, serverBase: {}, apiKey: {}, study: {}, target: {}, proxy: values from 'DEV_DSF_PROXY'... config}", trustStorePath, certificatePath, privateKeyPath, privateKeyPassword != null ? "***" : "null", fttpBasicAuthUsername, fttpBasicAuthPassword != null ? "***" : "null", fttpServerBase, - fttpApiKey != null ? "***" : "null", fttpStudy, fttpTarget, proxyUrl, proxyUsername, - proxyPassword != null ? "***" : "null"); + fttpApiKey != null ? "***" : "null", fttpStudy, fttpTarget); getFttpClient().testConnection(); } diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientImpl.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientImpl.java index e5c9cb1..2eef356 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientImpl.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientImpl.java @@ -101,8 +101,7 @@ private void configureProxy(IRestfulClientFactory clientFactory, String proxyUrl clientFactory.setProxy(url.getHost(), url.getPort()); clientFactory.setProxyCredentials(proxyUsername, proxyPassword); - logger.info("Using proxy for fTTP connection with {host: {}, port: {}, username: {}}", url.getHost(), - url.getPort(), proxyUsername); + logger.info("Using proxy for fTTP connection with values from 'DEV_DSF_PROXY'... config"); } catch (MalformedURLException e) { diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractComplexFhirClient.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractComplexFhirClient.java index 0a95272..2e16d98 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractComplexFhirClient.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractComplexFhirClient.java @@ -66,7 +66,7 @@ else if (resource instanceof Encounter e) e.setSubject(patientRef); else if (resource instanceof Immunization i) i.setPatient(patientRef); - else if (resource instanceof Medication m) + else if (resource instanceof Medication) ; // nothing to do else if (resource instanceof MedicationAdministration ma) ma.setSubject(patientRef); @@ -94,7 +94,7 @@ else if (resource instanceof Encounter e) return Optional.of(e.getSubject()); else if (resource instanceof Immunization i) return Optional.of(i.getPatient()); - else if (resource instanceof Medication m) + else if (resource instanceof Medication) return Optional.empty(); else if (resource instanceof MedicationAdministration ma) return Optional.of(ma.getSubject()); @@ -198,8 +198,8 @@ protected Optional findPatientInLocalFhirStore(String pseudonym) } catch (Exception e) { - logger.warn("Error while searching for Patient with pseudonym " + NAMING_SYSTEM_NUM_CODEX_CRR_PSEUDONYM - + "|" + pseudonym, e); + logger.warn("Error while searching for Patient with pseudonym {}|{}", NAMING_SYSTEM_NUM_CODEX_CRR_PSEUDONYM, + pseudonym, e); throw e; } } diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractFhirClient.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractFhirClient.java index 57ee2ef..bd2ab69 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractFhirClient.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/AbstractFhirClient.java @@ -636,7 +636,7 @@ public Optional getPatient(String reference) logger.warn("Patient {} not found: {} - {}", reference, e.getClass().getName(), e.getMessage()); if (logger.isDebugEnabled()) - logger.debug("Error while reading patient " + reference, e); + logger.debug("Error while reading patient {}", reference, e); return Optional.empty(); } @@ -684,7 +684,7 @@ public void updatePatient(Patient patient) } catch (Exception e) { - logger.warn("Could not update patient " + id, e); + logger.warn("Could not update patient {}", id, e); throw e; } } diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/FhirBridgeClient.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/FhirBridgeClient.java index 4517f36..aaf7a5b 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/FhirBridgeClient.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/FhirBridgeClient.java @@ -167,7 +167,7 @@ private Optional update(Patient existingPatient, Patient newPatient, St } catch (Exception e) { - logger.warn("Could not update patient " + newPatient.getIdElement().toString(), e); + logger.warn("Could not update patient {}", newPatient.getIdElement().toString(), e); throw e; } } @@ -230,7 +230,7 @@ private Optional create(Patient newPatient, String pseudonym, String bu } catch (Exception e) { - logger.warn("Could not create patient " + newPatient.getIdElement().toString(), e); + logger.warn("Could not create patient {}", newPatient.getIdElement().toString(), e); throw e; } } @@ -318,7 +318,7 @@ private Optional findResourceInLocalFhirStore(String url, Class R fixReferenceFromComponents(R resource, M && uuidsById.containsKey(oldReference.getReference())) { logger.debug( - "Replacing reference at " + path - + " from resource {} with bundle temporary id in transport bundle", - i, getAbsoluteId(resource).getValue()); + "Replacing reference at {}[{}] from resource {} with bundle temporary id in transport bundle", + path, i, getAbsoluteId(resource).getValue()); setReference.apply(component, new Reference(uuidsById.get(oldReference.getReference()))); } else if ((oldReference.hasReference() && oldReference.getReference() == null @@ -382,11 +381,13 @@ else if ((oldReference.hasReference() && oldReference.getReference() == null .hasExtension("http://hl7.org/fhir/StructureDefinition/data-absent-reason")) || oldReference.hasExtension("http://hl7.org/fhir/StructureDefinition/data-absent-reason")) { - logger.debug("Not removing empty reference at " + path + " with data-absent-reason extension", i); + logger.debug( + "Not removing empty reference at {}[{}] with data-absent-reason extension from resource {} in transport bundle", + path, i, getAbsoluteId(resource).getValue()); } else { - logger.warn("Removing reference at " + path + " from resource {} in transport bundle", i, + logger.warn("Removing reference at {}[{}] from resource {} in transport bundle", path, i, getAbsoluteId(resource).getValue()); setReference.apply(component, null); } @@ -454,7 +455,7 @@ private void cleanUnsupportedReferenceFromComponen C component = components.get(i); if (hasReference.apply(component)) { - logger.warn("Removing reference at " + path + " from resource {} in transport bundle", i, + logger.warn("Removing reference at {}[{}] from resource {} in transport bundle", path, i, getAbsoluteId(resource).getValue()); setReference.apply(component, null); } @@ -471,7 +472,7 @@ private void cleanUnsupportedReferenceFromComponen C component = getComponents.apply(resource); if (hasReference.apply(component)) { - logger.warn("Removing reference at " + path + " from resource {} in transport bundle", + logger.warn("Removing reference at {} from resource {} in transport bundle", path, getAbsoluteId(resource).getValue()); setReference.apply(component, null); } @@ -490,7 +491,7 @@ private void cleanUnsupportedReferencesFromCompone C component = components.get(i); if (hasReferences.apply(component)) { - logger.warn("Removing references at " + path + " from resource {} in transport bundle", i, + logger.warn("Removing references at {}[{}] from resource {} in transport bundle", path, i, getAbsoluteId(resource).getValue()); setReferences.apply(component, null); } @@ -514,7 +515,7 @@ private void cleanUnsupportedReferencesFromCo C2 component2 = components2.get(i); if (hasReference.apply(component2)) { - logger.warn("Removing reference at " + path + "[{}] from resource {} in transport bundle", i, + logger.warn("Removing reference at {}[{}] from resource {} in transport bundle", path, i, getAbsoluteId(resource).getValue()); setReference.apply(component2, null); } diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/send/StoreDataForDts.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/send/StoreDataForDts.java index db3a61e..46e99f6 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/send/StoreDataForDts.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/send/StoreDataForDts.java @@ -76,7 +76,7 @@ private IdType createBinaryResource(Binary binary) catch (Exception e) { dataLogger.logData("Binary to create", binary); - logger.warn("Error while creating Binary resource: " + e.getMessage(), e); + logger.warn("Error while creating Binary resource: {}", e.getMessage(), e); throw new BpmnError(CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_UNABLE_TO_STORE_ECRYPTED_DATA, "Unable to create Binary resource with encrypted data for DTS in local DSF FHIR server"); diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadDataFromDic.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadDataFromDic.java index 616cff5..1892393 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadDataFromDic.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadDataFromDic.java @@ -52,7 +52,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw } catch (Exception e) { - logger.warn("Error while reading Binary resoruce: " + e.getMessage(), e); + logger.warn("Error while reading Binary resoruce: {}", e.getMessage(), e); throw new BpmnError( CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_DOWNLOAD_OF_ENCRYPTED_DATA_FROM_DIC_FAILED, diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadValidationErrorFromCrr.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadValidationErrorFromCrr.java index da628f9..890b900 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadValidationErrorFromCrr.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadValidationErrorFromCrr.java @@ -44,7 +44,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw } catch (Exception e) { - logger.warn("Error while reading Binary resoruce: " + e.getMessage(), e); + logger.warn("Error while reading Binary resoruce: {}", e.getMessage(), e); throw new BpmnError( CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_DOWNLOAD_OF_ENCRYTPED_VALIDATION_ERROR_FROM_CRR_FAILED, diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreDataForCrr.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreDataForCrr.java index 1172352..5b44882 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreDataForCrr.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreDataForCrr.java @@ -76,7 +76,7 @@ private IdType createBinaryResource(Binary binary) catch (Exception e) { dataLogger.logData("Binary to create", binary); - logger.warn("Error while creating Binary resource: " + e.getMessage(), e); + logger.warn("Error while creating Binary resource: {}", e.getMessage(), e); throw new BpmnError(CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_UNABLE_TO_STORE_ECRYPTED_DATA, "Unable to create Binary resource with encrypted data for CRR in local DSF FHIR server"); diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreValidationErrorForDic.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreValidationErrorForDic.java index bd1d5d3..1d63fe3 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreValidationErrorForDic.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/StoreValidationErrorForDic.java @@ -76,7 +76,7 @@ private IdType createBinaryResource(Binary binary) catch (Exception e) { dataLogger.logData("Binary to create", binary); - logger.warn("Error while creating Binary resource: " + e.getMessage(), e); + logger.warn("Error while creating Binary resource: {}", e.getMessage(), e); throw new BpmnError( CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_UNABLE_TO_STORE_ECRYPTED_VALIDATION_ERROR, diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/spring/config/ValidationConfig.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/spring/config/ValidationConfig.java index da2387b..98a5372 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/spring/config/ValidationConfig.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/spring/config/ValidationConfig.java @@ -54,6 +54,7 @@ import de.rwh.utils.crypto.CertificateHelper; import de.rwh.utils.crypto.io.CertificateReader; import de.rwh.utils.crypto.io.PemIo; +import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; import dev.dsf.fhir.validation.SnapshotGenerator; import dev.dsf.fhir.validation.ValueSetExpander; @@ -65,6 +66,9 @@ public class ValidationConfig { private static final Logger logger = LoggerFactory.getLogger(ValidationConfig.class); + @Autowired + private ProcessPluginApi api; + public static enum TerminologyServerConnectionTestStatus { OK, NOT_OK, DISABLED @@ -114,18 +118,6 @@ public static enum TerminologyServerConnectionTestStatus @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.package.client.authentication.basic.password:#{null}}") private char[] packageClientBasicAuthPassword; - @ProcessDocumentation(description = "Forwarding proxy server url, set if the FHIR implementation guide package server can only be reached via a proxy server", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend", example = "http://proxy.foo:8080") - @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.package.client.proxy.schemeHostPort:#{null}}") - private String packageClientProxySchemeHostPort; - - @ProcessDocumentation(description = "Forwarding proxy server basic authentication username, set if the FHIR implementation guide package server can only be reached via a proxy server that requires basic authentication", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend") - @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.package.client.proxy.username:#{null}}") - private String packageClientProxyUsername; - - @ProcessDocumentation(description = "Forwarding proxy server basic authentication password, set if the FHIR implementation guide package server can only be reached via a proxy server that requires basic authentication", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend", recommendation = "Use docker secret file to configure by using `${env_variable}_FILE`", example = "/run/secrets/validation_package_server_proxy_basicauth.password") - @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.package.client.proxy.password:#{null}}") - private char[] packageClientProxyPassword; - @ProcessDocumentation(description = "Connection timeout in milliseconds used when accessing the FHIR implementation guide package server, time until a connection needs to be established before aborting", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend") @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.package.client.timeout.connect:10000}") private int packageClientConnectTimeout; @@ -174,18 +166,6 @@ public static enum TerminologyServerConnectionTestStatus @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.valueset.expansion.client.authentication.basic.password:#{null}}") private char[] valueSetExpansionClientBasicAuthPassword; - @ProcessDocumentation(description = "Forwarding proxy server url, set if the terminology server can only be reached via a proxy server", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend", example = "http://proxy.foo:8080") - @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.valueset.expansion.client.proxy.schemeHostPort:#{null}}") - private String valueSetExpansionClientProxySchemeHostPort; - - @ProcessDocumentation(description = "Forwarding proxy server basic authentication username, set if the terminology server can only be reached via a proxy server that requires basic authentication", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend") - @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.valueset.expansion.client.proxy.username:#{null}}") - private String valueSetExpansionClientProxyUsername; - - @ProcessDocumentation(description = "Forwarding proxy server basic authentication password, set if the terminology server can only be reached via a proxy server that requires basic authentication", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend", recommendation = "Use docker secret file to configure by using `${env_variable}_FILE`", example = "/run/secrets/terminology_server_proxy_basicauth.password") - @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.valueset.expansion.client.proxy.password:#{null}}") - private char[] valueSetExpansionClientProxyPassword; - @ProcessDocumentation(description = "Connection timeout in milliseconds used when accessing the terminology server, time until a connection needs to be established before aborting", processNames = "wwwnetzwerk-universitaetsmedizinde_dataSend") @Value("${de.netzwerk.universitaetsmedizin.rdp.validation.valueset.expansion.client.timeout.connect:10000}") private int valueSetExpansionClientConnectTimeout; @@ -394,9 +374,13 @@ private ValidationPackageClientJersey validationPackageClientJersey() "Package client basic authentication username or password not specified"); } - if ((packageClientProxyUsername != null) != (packageClientProxyPassword != null)) + String proxyUrl = null, proxyUsername = null; + char[] proxyPassword = null; + if (api.getProxyConfig().isEnabled() && !api.getProxyConfig().isNoProxyUrl(packageServerBaseUrl)) { - throw new IllegalArgumentException("Package client proxy username or password not specified"); + proxyUrl = api.getProxyConfig().getUrl(); + proxyUsername = api.getProxyConfig().getUsername(); + proxyPassword = api.getProxyConfig().getPassword() == null ? null : api.getProxyConfig().getPassword(); } KeyStore packageClientTrustStore = trustStore("FHIR package client", packageClientTrustCertificates); @@ -407,9 +391,8 @@ private ValidationPackageClientJersey validationPackageClientJersey() return new ValidationPackageClientJersey(packageServerBaseUrl, packageClientTrustStore, packageClientKeyStore, packageClientKeyStore == null ? null : packageClientKeyStorePassword, packageClientBasicAuthUsername, - packageClientBasicAuthPassword, packageClientProxySchemeHostPort, packageClientProxyUsername, - packageClientProxyPassword, packageClientConnectTimeout, packageClientReadTimeout, - packageClientVerbose); + packageClientBasicAuthPassword, proxyUrl, proxyUsername, proxyPassword, packageClientConnectTimeout, + packageClientReadTimeout, packageClientVerbose); } @Bean @@ -454,9 +437,13 @@ private ValueSetExpansionClient valueSetExpansionClientJersey() "ValueSet expansion client basic authentication username or password not specified"); } - if ((valueSetExpansionClientProxyUsername != null) != (valueSetExpansionClientProxyPassword != null)) + String proxyUrl = null, proxyUsername = null; + char[] proxyPassword = null; + if (api.getProxyConfig().isEnabled() && !api.getProxyConfig().isNoProxyUrl(valueSetExpansionServerBaseUrl)) { - throw new IllegalArgumentException("ValueSet expansion client proxy username or password not specified"); + proxyUrl = api.getProxyConfig().getUrl(); + proxyUsername = api.getProxyConfig().getUsername(); + proxyPassword = api.getProxyConfig().getPassword() == null ? null : api.getProxyConfig().getPassword(); } KeyStore valueSetExpansionClientTrustStore = trustStore("ValueSet expansion client", @@ -469,10 +456,9 @@ private ValueSetExpansionClient valueSetExpansionClientJersey() return new ValueSetExpansionClientJersey(valueSetExpansionServerBaseUrl, valueSetExpansionClientTrustStore, valueSetExpansionClientKeyStore, valueSetExpansionClientKeyStore == null ? null : valueSetExpansionClientKeyStorePassword, - valueSetExpansionClientBasicAuthUsername, valueSetExpansionClientBasicAuthPassword, - valueSetExpansionClientProxySchemeHostPort, valueSetExpansionClientProxyUsername, - valueSetExpansionClientProxyPassword, valueSetExpansionClientConnectTimeout, - valueSetExpansionClientReadTimeout, valueSetExpansionClientVerbose, objectMapper, fhirContext); + valueSetExpansionClientBasicAuthUsername, valueSetExpansionClientBasicAuthPassword, proxyUrl, + proxyUsername, proxyPassword, valueSetExpansionClientConnectTimeout, valueSetExpansionClientReadTimeout, + valueSetExpansionClientVerbose, objectMapper, fhirContext); } public TerminologyServerConnectionTestStatus testConnectionToTerminologyServer() @@ -480,25 +466,21 @@ public TerminologyServerConnectionTestStatus testConnectionToTerminologyServer() if (validationEnabled) logger.info( "Testing connection to terminology server with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {}," - + " basicAuthUsername {}, basicAuthPassword {}, serverBase: {}, proxyUrl {}, proxyUsername {}, proxyPassword {}}", + + " basicAuthUsername: {}, basicAuthPassword: {}, serverBase: {}, proxy: values from 'DEV_DSF_PROXY'... config}", valueSetExpansionClientTrustCertificates, valueSetExpansionClientCertificate, valueSetExpansionClientCertificatePrivateKey, valueSetExpansionClientCertificatePrivateKeyPassword != null ? "***" : "null", valueSetExpansionClientBasicAuthUsername, - valueSetExpansionClientBasicAuthPassword != null ? "***" : "null", valueSetExpansionServerBaseUrl, - valueSetExpansionClientProxySchemeHostPort, valueSetExpansionClientProxyUsername, - valueSetExpansionClientProxyPassword != null ? "***" : "null"); + valueSetExpansionClientBasicAuthPassword != null ? "***" : "null", valueSetExpansionServerBaseUrl); else logger.warn( "Not testing connection to terminology server with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {}," - + " basicAuthUsername {}, basicAuthPassword {}, serverBase: {}, proxyUrl {}, proxyUsername {}, proxyPassword {}}, validation disabled", + + " basicAuthUsername: {}, basicAuthPassword: {}, serverBase: {}, proxy: values from 'DEV_DSF_PROXY'... config}, validation disabled", valueSetExpansionClientTrustCertificates, valueSetExpansionClientCertificate, valueSetExpansionClientCertificatePrivateKey, valueSetExpansionClientCertificatePrivateKeyPassword != null ? "***" : "null", valueSetExpansionClientBasicAuthUsername, - valueSetExpansionClientBasicAuthPassword != null ? "***" : "null", valueSetExpansionServerBaseUrl, - valueSetExpansionClientProxySchemeHostPort, valueSetExpansionClientProxyUsername, - valueSetExpansionClientProxyPassword != null ? "***" : "null"); + valueSetExpansionClientBasicAuthPassword != null ? "***" : "null", valueSetExpansionServerBaseUrl); if (!validationEnabled) return TerminologyServerConnectionTestStatus.DISABLED; diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationMain.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationMain.java index ad8a65b..048d70a 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationMain.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationMain.java @@ -252,7 +252,7 @@ private FileNameAndResource tryJson(String file) } catch (Exception e) { - logger.warn("Unable to read " + file + " as JSON, {}: {}", e.getClass().getName(), e.getMessage()); + logger.warn("Unable to read {} as JSON, {}: {}", file, e.getClass().getName(), e.getMessage()); return null; } } @@ -267,7 +267,7 @@ private FileNameAndResource tryXml(String file) } catch (Exception e) { - logger.warn("Unable to read " + file + " as XML, {}: {}", e.getClass().getName(), e.getMessage()); + logger.warn("Unable to read {} as XML, {}: {}", file, e.getClass().getName(), e.getMessage()); return null; } } diff --git a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationPackage.java b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationPackage.java index 79139ef..62608f6 100644 --- a/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationPackage.java +++ b/codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidationPackage.java @@ -155,11 +155,11 @@ private Consumer doParseResources(FhirContext context, L || (entry.getFileName() != null && (entry.getFileName().startsWith("package/example") || entry.getFileName().endsWith(".index.json") || !entry.getFileName().endsWith(".json")))) { - logger.debug("Ignoring " + entry.getFileName()); + logger.debug("Ignoring {}", entry.getFileName()); return; } - logger.debug("Reading " + entry.getFileName()); + logger.debug("Reading {}", entry.getFileName()); try { diff --git a/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/PolarDataTest.java b/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/PolarDataTest.java index 012ff9f..283c120 100644 --- a/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/PolarDataTest.java +++ b/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/PolarDataTest.java @@ -276,7 +276,7 @@ private static Bundle fixBundle(String trace, Bundle bundle, Set resourc fixIdentifier(eTrace, resource); - if (resource instanceof Patient patient) + if (resource instanceof Patient) { // nothing to do } @@ -305,7 +305,7 @@ else if (resource instanceof Condition condition) { fixReference(eTrace + "/subject", condition.getSubject(), idTranslation); } - else if (resource instanceof Medication medication) + else if (resource instanceof Medication) { // nothing to do } diff --git a/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/MiiTest.java b/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/MiiTest.java index f385c0d..090cc8e 100644 --- a/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/MiiTest.java +++ b/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/MiiTest.java @@ -71,9 +71,9 @@ public void testInit() throws Exception for (ValidationPackageWithDepedencies p : packagesWithDependencies) { - logger.info(p.getName() + "|" + p.getVersion()); + logger.info("{}|{}", p.getName(), p.getVersion()); for (ValidationPackage d : p.getDependencies()) - logger.info("\t" + d.getName() + "|" + d.getVersion()); + logger.info("\t{}|{}", d.getName(), d.getVersion()); } } diff --git a/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidateDataLearningTest.java b/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidateDataLearningTest.java index b94938e..ca2f78f 100644 --- a/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidateDataLearningTest.java +++ b/codex-process-data-transfer/src/test/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/validation/ValidateDataLearningTest.java @@ -190,8 +190,8 @@ public void testDownloadTarGzAndParseDescriptor() throws Exception }); ValidationPackageDescriptor descriptor = validationPackage.getDescriptor(mapper); - logger.debug(descriptor.getName() + "/" + descriptor.getVersion() + ":"); - descriptor.getDependencies().forEach((k, v) -> logger.debug("\t" + k + "/" + v)); + logger.debug("{}/{}:", descriptor.getName(), descriptor.getVersion()); + descriptor.getDependencies().forEach((k, v) -> logger.debug("\t{}/{}", k, v)); } @Test @@ -372,7 +372,7 @@ public void testGenerateSnapshots() throws Exception packageWithDependencies.getAllStructureDefinitions().stream() .sorted(Comparator.comparing(StructureDefinition::getUrl) .thenComparing(Comparator.comparing(StructureDefinition::getVersion))) - .forEach(s -> logger.debug(s.getUrl() + " " + s.getVersion())); + .forEach(s -> logger.debug("{} {}", s.getUrl(), s.getVersion())); StructureDefinition miiRef = packageWithDependencies.getAllStructureDefinitions().stream() .filter(s -> "https://www.medizininformatik-initiative.de/fhir/core/StructureDefinition/MII-Reference" @@ -427,13 +427,13 @@ private void printTree(StructureDefinition def, Map { logger.debug(""); logger.debug(" Profile-Dependencies:"); - profileDependencies.stream().sorted().forEach(url -> logger.debug(" " + url)); + profileDependencies.stream().sorted().forEach(url -> logger.debug(" {}", url)); } if (!targetProfileDependencies.isEmpty()) { logger.debug(""); logger.debug(" TargetProfile-Dependencies:"); - targetProfileDependencies.stream().sorted().forEach(url -> logger.debug(" " + url)); + targetProfileDependencies.stream().sorted().forEach(url -> logger.debug(" {}", url)); } } @@ -441,13 +441,13 @@ private void printTree(String k, StructureDefinition def, Map structureDefinitionsByUrl, String indentation, Set profileDependencies, Set targetProfileDependencies) { - logger.debug(indentation + "Profile: " + k); + logger.debug("{}Profile: {}", indentation, k); for (ElementDefinition element : def.getDifferential().getElement()) { if (element.getType().stream().filter(t -> !t.getProfile().isEmpty() || !t.getTargetProfile().isEmpty()) .findAny().isPresent()) { - logger.debug(indentation + " Element: " + element.getId() + " (Path: " + element.getPath() + ")"); + logger.debug("{} Element: {} (Path: {})", indentation, element.getId(), element.getPath()); for (TypeRefComponent type : element.getType()) { if (!type.getProfile().isEmpty()) @@ -461,7 +461,7 @@ private void printTree(String k, StructureDefinition def, structureDefinitionsByUrl, indentation + " ", profileDependencies, targetProfileDependencies); else - logger.debug(indentation + " Profile: " + profile.getValue() + " ?"); + logger.debug("{} Profile: {} ?", indentation, profile.getValue()); } } if (!type.getTargetProfile().isEmpty()) @@ -469,7 +469,7 @@ private void printTree(String k, StructureDefinition def, for (CanonicalType targetProfile : type.getTargetProfile()) { targetProfileDependencies.add(targetProfile.getValue()); - logger.debug(indentation + " TargetProfile: " + targetProfile.getValue()); + logger.debug("{} TargetProfile: {}", indentation, targetProfile.getValue()); } } }