Skip to content

Commit

Permalink
#466: support for eCH-0213, eCH-0214, eCH-0215
Browse files Browse the repository at this point in the history
  • Loading branch information
unixoid committed Jan 29, 2025
1 parent 2997f8a commit 05a6e4b
Show file tree
Hide file tree
Showing 170 changed files with 24,305 additions and 1 deletion.
59 changes: 59 additions & 0 deletions boot/ipf-ech-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openehealth.ipf.boot</groupId>
<artifactId>ipf-spring-boot</artifactId>
<version>5.0-SNAPSHOT</version>
</parent>

<artifactId>ipf-ech-spring-boot-starter</artifactId>
<name>ipf-ech-spring-boot-starter</name>
<description>Spring Boot support for eCH based components</description>

<dependencies>
<!-- Camel Spring Boot Support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
</dependency>

<!-- IPF Support -->
<dependency>
<groupId>org.openehealth.ipf.boot</groupId>
<artifactId>ipf-atna-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.boot</groupId>
<artifactId>ipf-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.platform-camel</groupId>
<artifactId>ipf-platform-camel-ihe-ech</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2025 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.boot.ech;

import org.openehealth.ipf.boot.atna.IpfAtnaAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfigureAfter(IpfAtnaAutoConfiguration.class)
@EnableConfigurationProperties(IpfEchConfigurationProperties.class)
public class IpfEchAutoConfiguration {

private final IpfEchConfigurationProperties properties;

public IpfEchAutoConfiguration(IpfEchConfigurationProperties properties) {
this.properties = properties;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2025 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.boot.ech;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
*
*/
@ConfigurationProperties(prefix = "ipf.ech")
public class IpfEchConfigurationProperties {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.openehealth.ipf.boot.ech.IpfEchAutoConfiguration
1 change: 1 addition & 0 deletions boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<module>ipf-hpd-spring-boot-starter</module>
<module>ipf-xacml20-spring-boot-starter</module>
<module>ipf-svs-spring-boot-starter</module>
<module>ipf-ech-spring-boot-starter</module>
</modules>


Expand Down
117 changes: 117 additions & 0 deletions commons/ihe/ech/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>ipf-commons-ihe-ech</artifactId>
<name>ipf-commons-ihe-ech</name>
<description>Support for eCH (UPI) interactions</description>

<parent>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe</artifactId>
<version>5.0-SNAPSHOT</version>
</parent>

<dependencies>
<!-- Dependencies for main -->
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-ws</artifactId>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-xml</artifactId>
</dependency>
</dependencies>

<profiles>
<profile>
<id>generate-stubs</id>
<build>
<plugins>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<outputDirectory>${output-folder}/generated-stubs</outputDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok-version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>none</phase>
</execution>
<execution>
<id>add-test-source</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-stubs</outputDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok-version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright 2025 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.ech

import jakarta.xml.bind.JAXBContext
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0006._2.ObjectFactory as Ech0006ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0007._5.ObjectFactory as Ech0007ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0008._3.ObjectFactory as Ech0008ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0010._5.ObjectFactory as Ech0010ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0011._8.ObjectFactory as Ech0011ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0021._7.ObjectFactory as Ech0021ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0044._4.ObjectFactory as Ech0044ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0058._5.HeaderType
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0058._5.ObjectFactory as Ech0058ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0058._5.SendingApplicationType
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0135._1.ObjectFactory as Ech0135ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0213._1.ObjectFactory as Ech0213ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0213_commons._1.ObjectFactory as Ech0213CommonsObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0214._2.ObjectFactory as Ech0214ObjectFactory
import org.openehealth.ipf.commons.ihe.ech.stub.ech_0215._2.ObjectFactory as Ech0215ObjectFactory

import javax.xml.datatype.DatatypeFactory
import javax.xml.datatype.XMLGregorianCalendar

class EchUtils {

private static final DatatypeFactory DT_FACTORY = DatatypeFactory.newInstance()

static final JAXBContext JAXB_CONTEXT = JAXBContext.newInstance(
Ech0006ObjectFactory.class,
Ech0007ObjectFactory.class,
Ech0008ObjectFactory.class,
Ech0010ObjectFactory.class,
Ech0011ObjectFactory.class,
Ech0021ObjectFactory.class,
Ech0044ObjectFactory.class,
Ech0058ObjectFactory.class,
Ech0135ObjectFactory.class,
Ech0213ObjectFactory.class,
Ech0213CommonsObjectFactory.class,
Ech0214ObjectFactory.class,
Ech0215ObjectFactory.class,
)

static final String EPR_SPID_ID_CATEGORY = 'EPD-ID.BAG.ADMIN.CH'

final String senderId
final String manufacturerName
final String productName
final String productVersion
final boolean testDeliveryFlag
final String responseLanguage

EchUtils(String senderId, String manufacturerName, String productName, String productVersion, boolean testDeliveryFlag, String responseLanguage) {
this.senderId = senderId
this.manufacturerName = manufacturerName
this.productName = productName
this.productVersion = productVersion
this.testDeliveryFlag = testDeliveryFlag
this.responseLanguage = responseLanguage
}

static XMLGregorianCalendar now() {
def calendar = new GregorianCalendar(TimeZone.getTimeZone('UTC'))
calendar.add(Calendar.MINUTE, -1)
return DT_FACTORY.newXMLGregorianCalendar(calendar)
}

HeaderType createHeader(String messageType, String action, HeaderType requestHeader = null) {
def header = new HeaderType(
senderId: 'sedex://' + senderId,
messageId: UUID.randomUUID().toString(),
messageType: messageType,
sendingApplication: new SendingApplicationType(
manufacturer: manufacturerName,
product: productName,
productVersion: productVersion,
),
messageDate: now(),
action: action,
testDeliveryFlag: testDeliveryFlag,
)

if (requestHeader) {
header.recipientId << requestHeader.senderId
header.referenceMessageId = requestHeader.messageId
}

return header
}

}
Loading

0 comments on commit 05a6e4b

Please sign in to comment.