Skip to content

Commit

Permalink
EPA-282
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-kontcur committed Oct 14, 2024
1 parent c32fc9f commit b3c04fa
Show file tree
Hide file tree
Showing 47 changed files with 519 additions and 1,360 deletions.
50 changes: 34 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<quarkus-plugin.version>3.9.4</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>3.9.4</quarkus.platform.version>
<surefire-plugin.version>3.2.5</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<hapi.version>7.4.0</hapi.version>
<version.referencevalidator>2.5.1</version.referencevalidator>

<surefire-plugin.version>3.2.5</surefire-plugin.version>
<failsafe-plugin.version>3.5.0</failsafe-plugin.version>
</properties>
<!-- 2021-12-20 Add a random line to update maven cache in gitHub actions -->
<dependencyManagement>
Expand Down Expand Up @@ -203,6 +203,16 @@
<artifactId>Saxon-HE</artifactId>
<version>10.3</version>
</dependency>
<dependency>
<groupId>de.servicehealth.libcetp</groupId>
<artifactId>lib-cetp</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>health.ere</groupId>
<artifactId>api-telematik-service</artifactId>
Expand Down Expand Up @@ -387,10 +397,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
Expand All @@ -400,10 +406,25 @@
<quarkus.test.profile>dev</quarkus.test.profile>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<quarkus.log.level>INFO</quarkus.log.level>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<source>17</source>
<target>17</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.6.2</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<!-- STATIC CODE ANALYSIS -->
<plugin>
<groupId>com.github.spotbugs</groupId>
Expand Down Expand Up @@ -461,8 +482,9 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${failsafe-plugin.version}</version>
<executions>
<execution>
<goals>
Expand All @@ -472,12 +494,8 @@
<configuration>
<systemPropertyVariables>
<quarkus.test.profile>dev</quarkus.test.profile>
<native.image.path>
${project.build.directory}/${project.build.finalName}-runner
</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager
</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
</configuration>
</execution>
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/health/ere/ps/config/AppConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package health.ere.ps.config;

import health.ere.ps.service.cetp.CETPServer;
import de.health.service.cetp.CETPServer;
import de.health.service.cetp.config.SubscriptionConfig;
import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.config.inject.ConfigProperty;

Expand All @@ -13,8 +14,9 @@
import java.util.logging.Level;
import java.util.logging.Logger;

@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"})
@ApplicationScoped
public class AppConfig {
public class AppConfig implements SubscriptionConfig {

private static final Logger log = Logger.getLogger(AppConfig.class.getName());

Expand Down Expand Up @@ -194,8 +196,8 @@ public String getKonnectorHost() {
return konnectorHost;
}

public Integer getCetpPort() {
return cetpPort.orElse(CETPServer.PORT);
public int getCetpPort() {
return cetpPort.orElse(CETPServer.DEFAULT_PORT);
}

public String getConnectorCrypt() {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/health/ere/ps/config/RuntimeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import de.health.service.cetp.config.IRuntimeConfig;
import de.health.service.cetp.config.IUserConfigurations;
import health.ere.ps.model.config.UserConfigurations;
import jakarta.enterprise.inject.Alternative;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.json.JsonObject;
import jakarta.servlet.http.HttpServletRequest;

@Alternative
public class RuntimeConfig extends UserConfig {
public class RuntimeConfig extends UserConfig implements IRuntimeConfig {

private static Logger log = Logger.getLogger(RuntimeConfig.class.getName());

Expand All @@ -39,7 +41,7 @@ public RuntimeConfig() {
}
}

public RuntimeConfig(UserConfigurations userConfigurations) {
public RuntimeConfig(IUserConfigurations userConfigurations) {
this();
this.updateProperties(userConfigurations);
}
Expand Down
47 changes: 27 additions & 20 deletions src/main/java/health/ere/ps/config/SimpleUserConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package health.ere.ps.config;

import de.health.service.cetp.config.IRuntimeConfig;
import de.health.service.cetp.config.IUserConfigurations;
import de.health.service.cetp.config.UserRuntimeConfig;

import java.util.Objects;

public class SimpleUserConfig {
Expand Down Expand Up @@ -52,7 +56,7 @@ public class SimpleUserConfig {



public SimpleUserConfig(UserConfig userConfig) {
public SimpleUserConfig(UserRuntimeConfig userConfig) {
setValues(userConfig);
}

Expand Down Expand Up @@ -210,25 +214,28 @@ public void setIdpClientId(String idpClientId) {
this.idpClientId = idpClientId;
}

private void setValues(UserConfig userConfig) {
this.erixaHotfolder = userConfig.getConfigurations().getErixaHotfolder();
this.erixaDrugstoreEmail = userConfig.getConfigurations().getErixaDrugstoreEmail();
this.erixaUserEmail = userConfig.getConfigurations().getErixaUserEmail();
this.erixaApiKey = userConfig.getConfigurations().getErixaApiKey();
this.muster16TemplateProfile = userConfig.getConfigurations().getMuster16TemplateProfile();
this.connectorBaseURL = userConfig.getConfigurations().getConnectorBaseURL();
this.mandantId = userConfig.getConfigurations().getMandantId();
this.workplaceId = userConfig.getConfigurations().getWorkplaceId();
this.clientSystemId = userConfig.getConfigurations().getClientSystemId();
this.userId = userConfig.getConfigurations().getUserId();
this.version = userConfig.getConfigurations().getVersion();
this.tvMode = userConfig.getConfigurations().getTvMode();
if(userConfig.getClass().getName().contains("RuntimeConfig")) {
this.eHBAHandle = ((RuntimeConfig)userConfig).getEHBAHandle();
this.SMCBHandle = ((RuntimeConfig)userConfig).getSMCBHandle();
this.sendPreview = ((RuntimeConfig)userConfig).isSendPreview();
this.idpAuthRequestRedirectURL = ((RuntimeConfig)userConfig).getIdpAuthRequestRedirectURL();
this.idpClientId = ((RuntimeConfig)userConfig).getIdpClientId();
private void setValues(UserRuntimeConfig userConfig) {
IUserConfigurations configurations = userConfig.getUserConfigurations();
this.erixaHotfolder = configurations.getErixaHotfolder();
this.erixaDrugstoreEmail = configurations.getErixaDrugstoreEmail();
this.erixaUserEmail = configurations.getErixaUserEmail();
this.erixaApiKey = configurations.getErixaApiKey();
this.muster16TemplateProfile = configurations.getMuster16TemplateProfile();
this.connectorBaseURL = configurations.getConnectorBaseURL();
this.mandantId = configurations.getMandantId();
this.workplaceId = configurations.getWorkplaceId();
this.clientSystemId = configurations.getClientSystemId();
this.userId = configurations.getUserId();
this.version = configurations.getVersion();
this.tvMode = configurations.getTvMode();

IRuntimeConfig runtimeConfig = userConfig.getRuntimeConfig();
if (runtimeConfig != null) {
this.eHBAHandle = runtimeConfig.getEHBAHandle();
this.SMCBHandle = runtimeConfig.getSMCBHandle();
this.sendPreview = runtimeConfig.isSendPreview();
this.idpAuthRequestRedirectURL = runtimeConfig.getIdpAuthRequestRedirectURL();
this.idpClientId = runtimeConfig.getIdpClientId();
}
}

Expand Down
35 changes: 32 additions & 3 deletions src/main/java/health/ere/ps/config/UserConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package health.ere.ps.config;

import de.health.service.cetp.config.IRuntimeConfig;
import de.health.service.cetp.config.IUserConfigurations;
import de.health.service.cetp.config.UserRuntimeConfig;
import de.health.service.cetp.konnektorconfig.KCUserConfigurations;
import health.ere.ps.event.config.UserConfigurationsUpdateEvent;
import health.ere.ps.model.config.UserConfigurations;
import health.ere.ps.service.config.UserConfigurationService;
Expand All @@ -13,7 +17,7 @@
import java.util.Optional;

@ApplicationScoped
public class UserConfig {
public class UserConfig implements UserRuntimeConfig {

@Inject
UserConfigurationService configurationManagementService;
Expand Down Expand Up @@ -55,6 +59,27 @@ void init() {
public UserConfig() {
}

@Override
public IUserConfigurations getUserConfigurations() {
return configurations;
}

@Override
public IRuntimeConfig getRuntimeConfig() {
if (this instanceof RuntimeConfig runtimeConfig) {
return runtimeConfig;
} else {
return null;
}
}

@Override
public UserRuntimeConfig copy() {
RuntimeConfig runtimeConfig = new RuntimeConfig();
runtimeConfig.copyValuesFromUserConfig(this);
return runtimeConfig;
}

public UserConfigurations getConfigurations() {
return configurations == null ? new UserConfigurations() : configurations;
}
Expand Down Expand Up @@ -119,8 +144,12 @@ public void handleUpdateProperties(@ObservesAsync UserConfigurationsUpdateEvent
updateProperties(event.getConfigurations());
}

public void updateProperties(UserConfigurations configurations) {
this.configurations = configurations;
public void updateProperties(IUserConfigurations configurations) {
if (configurations instanceof UserConfigurations) {
this.configurations = (UserConfigurations) configurations;
} else if (configurations instanceof KCUserConfigurations kcUserConfigurations) {
this.configurations = new UserConfigurations(kcUserConfigurations.properties());
}
}

private void updateProperties() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/health/ere/ps/jmx/StatusMXBeanImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.health.service.cetp.SubscriptionManager;
import health.ere.ps.config.RuntimeConfig;
import health.ere.ps.model.status.Status;
import health.ere.ps.service.cetp.SubscriptionManager;
import health.ere.ps.service.status.StatusService;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/health/ere/ps/model/config/UserConfigurations.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package health.ere.ps.model.config;

import de.health.service.cetp.config.IUserConfigurations;
import jakarta.json.JsonObject;
import jakarta.json.bind.annotation.JsonbNillable;
import jakarta.json.bind.annotation.JsonbProperty;
import jakarta.servlet.http.HttpServletRequest;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
Expand All @@ -15,12 +21,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import jakarta.json.JsonObject;
import jakarta.json.bind.annotation.JsonbNillable;
import jakarta.json.bind.annotation.JsonbProperty;
import jakarta.servlet.http.HttpServletRequest;

public class UserConfigurations {
public class UserConfigurations implements IUserConfigurations {

private static final Logger log = Logger.getLogger(UserConfigurations.class.getName());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package health.ere.ps.resource.gematik;

import de.gematik.ws.conn.vsds.vsdservice.v5.FaultMessage;
import de.health.service.cetp.SubscriptionManager;
import health.ere.ps.config.RuntimeConfig;
import health.ere.ps.config.UserConfig;
import health.ere.ps.service.cetp.SubscriptionManager;
import health.ere.ps.service.gematik.PharmacyService;
import jakarta.inject.Inject;
import jakarta.servlet.http.HttpServletRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import de.gematik.ws.conn.connectorcontext.v2.ContextType;
import de.gematik.ws.conn.eventservice.wsdl.v7.EventServicePortType;
import de.gematik.ws.conn.eventservice.wsdl.v7.FaultMessage;
import de.health.service.cetp.konnektorconfig.KonnektorConfig;
import health.ere.ps.config.RuntimeConfig;
import health.ere.ps.service.cetp.config.KonnektorConfig;
import health.ere.ps.service.connector.provider.MultiConnectorServicesProvider;
import health.ere.ps.service.gematik.PharmacyService;
import io.quarkus.arc.Unremovable;
Expand Down
Loading

0 comments on commit b3c04fa

Please sign in to comment.