Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.7.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hhund committed Jun 21, 2022
2 parents 4c6c6a3 + 90c54e3 commit f372b75
Show file tree
Hide file tree
Showing 72 changed files with 571 additions and 160 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ preferred-citation:
doi: 10.3233/SHTI210060
type: proceedings
title: "HiGHmed Data Sharing Framework (HiGHmed DSF)"
version: 0.6.0
date-released: 2022-03-10
version: 0.7.0
date-released: 2022-06-21
url: https://github.com/highmed/highmed-dsf/wiki
repository-code: https://github.com/highmed/highmed-dsf
repository-artifact: https://github.com/highmed/highmed-dsf/releases
Expand Down
19 changes: 17 additions & 2 deletions dsf-bpe/dsf-bpe-process-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-pom</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
</parent>

<dependencies>
Expand All @@ -19,6 +19,10 @@
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-fhir-auth</artifactId>
</dependency>
<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-fhir-validation</artifactId>
</dependency>

<dependency>
<groupId>org.highmed.dsf</groupId>
Expand Down Expand Up @@ -56,6 +60,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
Expand All @@ -65,11 +73,18 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>

<dependency>
<groupId>de.hs-heilbronn.mi</groupId>
<artifactId>log4j2-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public interface ConstantsBase
String BPMN_EXECUTION_VARIABLE_QUERY_PARAMETERS = "queryParameters";
String BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER = "ttpIdentifier";
String BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER = "leadingMedicIdentifier";
String BPMN_EXECUTION_VARIABLE_ALTERNATIVE_BUSINESS_KEY = "alternativeBusinessKey";

/**
* Used to distinguish if I am at the moment in a process called by another process by a CallActivity or not
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.highmed.dsf.fhir.task;

import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_ALTERNATIVE_BUSINESS_KEY;
import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_INSTANTIATES_URI;
import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_MESSAGE_NAME;
import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_PROFILE;
Expand All @@ -14,6 +15,7 @@

import java.util.Date;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Stream;

import org.camunda.bpm.engine.delegate.DelegateExecution;
Expand Down Expand Up @@ -279,6 +281,35 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut
return Stream.empty();
}

/**
* Generates an alternative business-key and stores it as a process variable with name
* {@link ConstantsBase#BPMN_EXECUTION_VARIABLE_ALTERNATIVE_BUSINESS_KEY}<br>
* <br>
* <i>Use this method in combination with overriding
* {@link #sendTask(Target, String, String, String, String, Stream)} to use an alternative business-key with the
* communication target.</i>
*
* <pre>
* &#64;Override
* protected void sendTask(Target target, String instantiatesUri, String messageName, String businessKey,
* String profile, Stream&lt;ParameterComponent&gt; additionalInputParameters)
* {
* String alternativeBusinesKey = createAndSaveAlternativeBusinessKey();
* super.sendTask(target, instantiatesUri, messageName, alternativeBusinesKey, profile,
* additionalInputParameters);
* }
* </pre>
*
* @return the alternative business-key stored as variable
* {@link ConstantsBase#BPMN_EXECUTION_VARIABLE_ALTERNATIVE_BUSINESS_KEY}
*/
protected final String createAndSaveAlternativeBusinessKey()
{
String alternativeBusinessKey = UUID.randomUUID().toString();
execution.setVariable(BPMN_EXECUTION_VARIABLE_ALTERNATIVE_BUSINESS_KEY, alternativeBusinessKey);
return alternativeBusinessKey;
}

protected void sendTask(Target target, String instantiatesUri, String messageName, String businessKey,
String profile, Stream<ParameterComponent> additionalInputParameters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ public FhirWebserviceClient createClient(String baseUrl) throws Exception
ReferenceCleaner referenceCleaner = new ReferenceCleanerImpl(new ReferenceExtractorImpl());

return new FhirWebserviceClientJersey(baseUrl, trustStore, keyStore, certificatePassword, null, null, null, 0,
0, null, context, referenceCleaner);
0, false, null, context, referenceCleaner);
}
}
2 changes: 1 addition & 1 deletion dsf-bpe/dsf-bpe-server-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-pom</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion dsf-bpe/dsf-bpe-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-pom</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private Stream<ProcessesResource> getCurrentOrOldResources(
List<ResourceInfo> resources = dbResourcesByProcess.get(process);
if (resources == null)
{
logger.warn("No resources found in BPE DB for process {}", process);
logger.debug("No resources found in BPE DB for process {}", process);
resources = Collections.emptyList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import org.highmed.dsf.fhir.websocket.FhirConnector;
import org.highmed.dsf.fhir.websocket.FhirConnectorImpl;
import org.highmed.dsf.fhir.websocket.LastEventTimeIo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -49,8 +52,10 @@
import de.rwh.utils.crypto.io.PemIo;

@Configuration
public class FhirConfig
public class FhirConfig implements InitializingBean
{
private static final Logger logger = LoggerFactory.getLogger(FhirConfig.class);

private static final BouncyCastleProvider provider = new BouncyCastleProvider();

@Autowired
Expand Down Expand Up @@ -98,23 +103,24 @@ public FhirWebsocketClientProvider clientProvider()

try
{
KeyStore webserviceKeyStore = createKeyStore(propertiesConfig.getWebserviceClientCertificateFile(),
propertiesConfig.getWebserviceClientCertificatePrivateKeyFile(),
propertiesConfig.getWebserviceClientCertificatePrivateKeyFilePassword(), keyStorePassword);
KeyStore webserviceTrustStore = createTrustStore(
propertiesConfig.getWebserviceClientCertificateTrustStoreFile());
KeyStore webserviceKeyStore = createKeyStore(propertiesConfig.getClientCertificateFile(),
propertiesConfig.getClientCertificatePrivateKeyFile(),
propertiesConfig.getClientCertificatePrivateKeyFilePassword(), keyStorePassword);
KeyStore webserviceTrustStore = createTrustStore(propertiesConfig.getClientCertificateTrustStoreFile());

return new FhirClientProviderImpl(fhirContext(), referenceCleaner(), propertiesConfig.getServerBaseUrl(),
propertiesConfig.getWebserviceClientLocalReadTimeout(),
propertiesConfig.getWebserviceClientLocalConnectTimeout(),
propertiesConfig.getWebserviceClientLocalProxySchemeHostPort(),
propertiesConfig.getWebserviceClientLocalProxyUsername(),
propertiesConfig.getWebserviceClientLocalProxyPassword(), webserviceTrustStore, webserviceKeyStore,
propertiesConfig.getWebserviceClientLocalProxyPassword(),
propertiesConfig.getWebserviceClientLocalVerbose(), webserviceTrustStore, webserviceKeyStore,
keyStorePassword, propertiesConfig.getWebserviceClientRemoteReadTimeout(),
propertiesConfig.getWebserviceClientRemoteConnectTimeout(),
propertiesConfig.getWebserviceClientRemoteProxySchemeHostPort(),
propertiesConfig.getWebserviceClientRemoteProxyUsername(),
propertiesConfig.getWebserviceClientRemoteProxyPassword(), getWebsocketUrl(), webserviceTrustStore,
propertiesConfig.getWebserviceClientRemoteProxyPassword(),
propertiesConfig.getWebserviceClientRemoteVerbose(), getWebsocketUrl(), webserviceTrustStore,
webserviceKeyStore, keyStorePassword, propertiesConfig.getWebsocketClientProxySchemeHostPort(),
propertiesConfig.getWebsocketClientProxyUsername(),
propertiesConfig.getWebsocketClientProxyPassword());
Expand Down Expand Up @@ -211,4 +217,37 @@ public ReadAccessHelper readAccessHelper()
{
return new ReadAccessHelperImpl();
}

@Override
public void afterPropertiesSet() throws Exception
{
logger.info(
"Local webservice client config: {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
+ " proxyUrl {}, proxyUsername {}, proxyPassword {}, serverBase: {}}",
propertiesConfig.getClientCertificateTrustStoreFile(), propertiesConfig.getClientCertificateFile(),
propertiesConfig.getClientCertificatePrivateKeyFile(),
propertiesConfig.getClientCertificatePrivateKeyFilePassword() != null ? "***" : "null",
propertiesConfig.getWebserviceClientLocalProxySchemeHostPort(),
propertiesConfig.getWebserviceClientLocalProxyUsername(),
propertiesConfig.getWebserviceClientLocalProxyPassword() != null ? "***" : "null",
propertiesConfig.getServerBaseUrl());
logger.info(
"Local websocket client config: {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
+ " proxyUrl {}, proxyUsername {}, proxyPassword {}, websocketUrl: {}}",
propertiesConfig.getClientCertificateTrustStoreFile(), propertiesConfig.getClientCertificateFile(),
propertiesConfig.getClientCertificatePrivateKeyFile(),
propertiesConfig.getClientCertificatePrivateKeyFilePassword() != null ? "***" : "null",
propertiesConfig.getWebsocketClientProxySchemeHostPort(),
propertiesConfig.getWebsocketClientProxyUsername(),
propertiesConfig.getWebsocketClientProxyPassword() != null ? "***" : "null", getWebsocketUrl());
logger.info(
"Remote webservice client config: {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
+ " proxyUrl {}, proxyUsername {}, proxyPassword {}}",
propertiesConfig.getClientCertificateTrustStoreFile(), propertiesConfig.getClientCertificateFile(),
propertiesConfig.getClientCertificatePrivateKeyFile(),
propertiesConfig.getClientCertificatePrivateKeyFilePassword() != null ? "***" : "null",
propertiesConfig.getWebserviceClientRemoteProxySchemeHostPort(),
propertiesConfig.getWebserviceClientRemoteProxyUsername(),
propertiesConfig.getWebserviceClientRemoteProxyPassword() != null ? "***" : "null");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ public class PropertiesConfig

@Documentation(required = true, description = "PEM encoded file with one or more trusted root certificates to validate server certificates for https connections to local and remote DSF FHIR servers", recommendation = "Use docker secret file to configure", example = "/run/secrets/app_client_trust_certificates.pem")
@Value("${org.highmed.dsf.bpe.fhir.client.trust.certificates}")
private String webserviceClientCertificateTrustStoreFile;
private String clientCertificateTrustStoreFile;

@Documentation(required = true, description = "PEM encoded file with local client certificate for https connections to local and remote DSF FHIR servers", recommendation = "Use docker secret file to configure", example = "/run/secrets/app_client_certificate.pem")
@Value("${org.highmed.dsf.bpe.fhir.client.certificate}")
private String webserviceClientCertificateFile;
private String clientCertificateFile;

@Documentation(required = true, description = "Private key corresponding to the local client certificate as PEM encoded file. Use ${env_variable}_PASSWORD* or *${env_variable}_PASSWORD_FILE* if private key is encrypted", recommendation = "Use docker secret file to configure", example = "/run/secrets/app_client_certificate_private_key.pem")
@Value("${org.highmed.dsf.bpe.fhir.client.certificate.private.key}")
private String webserviceClientCertificatePrivateKeyFile;
private String clientCertificatePrivateKeyFile;

@Documentation(description = "Password to decrypt the local client certificate encrypted private key", recommendation = "Use docker secret file to configure using *${env_variable}_FILE*", example = "/run/secrets/app_client_certificate_private_key.pem.password")
@Value("${org.highmed.dsf.bpe.fhir.client.certificate.private.key.password:#{null}}")
private char[] webserviceClientCertificatePrivateKeyFilePassword;
private char[] clientCertificatePrivateKeyFilePassword;

@Documentation(description = "The timeout in milliseconds until a reading a resource from a remote DSF FHIR server is aborted", recommendation = "Change default value only if timeout exceptions occur")
@Value("${org.highmed.dsf.bpe.fhir.client.remote.timeout.read:60000}")
Expand All @@ -78,6 +78,10 @@ public class PropertiesConfig
@Value("${org.highmed.dsf.bpe.fhir.client.remote.proxy.password:#{null}}")
private char[] webserviceClientRemoteProxyPassword;

@Documentation(description = "To enable verbose logging of requests to and replies from remote DSF FHIR servers, set to `true`")
@Value("${org.highmed.dsf.bpe.fhir.client.remote.verbose:false}")
private boolean webserviceClientRemoteVerbose;

@Documentation(required = true, description = "The base address of the local DSF FHIR server to read/store fhir resources", example = "https://foo.bar/fhir")
@Value("${org.highmed.dsf.bpe.fhir.server.base.url}")
private String serverBaseUrl;
Expand All @@ -102,6 +106,10 @@ public class PropertiesConfig
@Value("${org.highmed.dsf.bpe.fhir.client.local.proxy.password:#{null}}")
private char[] webserviceClientLocalProxyPassword;

@Documentation(description = "To enable verbose logging of requests to and replies from the local DSF FHIR server, set to `true`")
@Value("${org.highmed.dsf.bpe.fhir.client.local.verbose:false}")
private boolean webserviceClientLocalVerbose;

@Documentation(description = "Proxy location, set if the DSF BPE server can reach internal servers via websocket, like the DSF FHIR server, only through a proxy", example = "http://proxy.foo:8080")
@Value("${org.highmed.dsf.bpe.fhir.client.local.websocket.proxy.url:#{null}}")
private String websocketClientProxySchemeHostPort;
Expand Down Expand Up @@ -205,24 +213,24 @@ public String getOrganizationIdentifierValue()
return organizationIdentifierValue;
}

public String getWebserviceClientCertificateTrustStoreFile()
public String getClientCertificateTrustStoreFile()
{
return webserviceClientCertificateTrustStoreFile;
return clientCertificateTrustStoreFile;
}

public String getWebserviceClientCertificateFile()
public String getClientCertificateFile()
{
return webserviceClientCertificateFile;
return clientCertificateFile;
}

public String getWebserviceClientCertificatePrivateKeyFile()
public String getClientCertificatePrivateKeyFile()
{
return webserviceClientCertificatePrivateKeyFile;
return clientCertificatePrivateKeyFile;
}

public char[] getWebserviceClientCertificatePrivateKeyFilePassword()
public char[] getClientCertificatePrivateKeyFilePassword()
{
return webserviceClientCertificatePrivateKeyFilePassword;
return clientCertificatePrivateKeyFilePassword;
}

public int getWebserviceClientRemoteReadTimeout()
Expand Down Expand Up @@ -250,6 +258,11 @@ public char[] getWebserviceClientRemoteProxyPassword()
return webserviceClientRemoteProxyPassword;
}

public boolean getWebserviceClientRemoteVerbose()
{
return webserviceClientRemoteVerbose;
}

public String getServerBaseUrl()
{
return serverBaseUrl;
Expand Down Expand Up @@ -280,6 +293,11 @@ public char[] getWebserviceClientLocalProxyPassword()
return webserviceClientLocalProxyPassword;
}

public boolean getWebserviceClientLocalVerbose()
{
return webserviceClientLocalVerbose;
}

public String getWebsocketClientProxySchemeHostPort()
{
return websocketClientProxySchemeHostPort;
Expand Down
Loading

0 comments on commit f372b75

Please sign in to comment.