Skip to content

Commit

Permalink
Merge pull request #354 from qligier/feature-tmp-svs
Browse files Browse the repository at this point in the history
WIP: Implement the ITI-48 transaction (Retrieve Value Set, SOAP)
  • Loading branch information
unixoid authored Jan 19, 2025
2 parents 62a16ae + a2966ec commit e17d1ef
Show file tree
Hide file tree
Showing 46 changed files with 3,118 additions and 0 deletions.
1 change: 1 addition & 0 deletions commons/ihe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<module>fhir</module>
<module>hpd</module>
<module>xacml20</module>
<module>svs</module>
</modules>

</project>
125 changes: 125 additions & 0 deletions commons/ihe/svs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<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-svs</artifactId>
<name>ipf-commons-ihe-svs</name>
<description>SVS-specific IHE support</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-core</artifactId>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-ws</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</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,72 @@
/*
* 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.svs;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.openehealth.ipf.commons.ihe.core.IntegrationProfile;
import org.openehealth.ipf.commons.ihe.core.InteractionId;
import org.openehealth.ipf.commons.ihe.svs.core.audit.SvsAuditDataset;
import org.openehealth.ipf.commons.ihe.svs.iti48.Iti48AuditStrategy;
import org.openehealth.ipf.commons.ihe.svs.iti48.Iti48PortType;
import org.openehealth.ipf.commons.ihe.ws.WsInteractionId;
import org.openehealth.ipf.commons.ihe.ws.WsTransactionConfiguration;

import javax.xml.namespace.QName;
import java.util.Arrays;
import java.util.List;

/**
* Definitions for the Sharing Value Sets (SVS) integration profile of the IHE TF.
*
* @author Quentin Ligier
* @since 5.0
*/
public class SVS implements IntegrationProfile {

private static final SVS Instance = new SVS();

@AllArgsConstructor
public enum Interactions implements WsInteractionId<WsTransactionConfiguration<SvsAuditDataset>> {
ITI_48(ITI_48_WS_CONFIG);

@Getter
private final WsTransactionConfiguration<SvsAuditDataset> wsTransactionConfiguration;
}

@Override
public List<InteractionId> getInteractionIds() {
return Arrays.asList(Interactions.values());
}

private static final WsTransactionConfiguration<SvsAuditDataset> ITI_48_WS_CONFIG = new WsTransactionConfiguration<>(
"svs-iti48",
"Retrieve Value Set",
true,
new Iti48AuditStrategy(false),
new Iti48AuditStrategy(true),
new QName("urn:ihe:iti:svs:2008", "ValueSetRepository_Service", "ihe"),
Iti48PortType.class,
new QName("urn:ihe:iti:svs:2008", "ValueSetRepository_Binding_Soap12", "ihe"),
false,
"wsdl/iti48/iti48.wsdl",
true,
false,
false,
false
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.svs.core;

/**
* @author Quentin Ligier
**/
public class SvsException extends RuntimeException {

public SvsException(Throwable cause) {
super(cause);
}

public SvsException(String message) {
super(message);
}

public SvsException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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.svs.core;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.util.JAXBSource;
import org.openehealth.ipf.commons.core.modules.api.ValidationException;
import org.openehealth.ipf.commons.ihe.svs.core.requests.RetrieveValueSetRequest;
import org.openehealth.ipf.commons.ihe.svs.core.responses.RetrieveValueSetResponse;
import org.openehealth.ipf.commons.xml.XsdValidator;

import javax.xml.transform.Source;

/**
* @author Quentin Ligier
**/
public class SvsValidator {
public static final JAXBContext JAXB_CONTEXT;
static {
try {
JAXB_CONTEXT = JAXBContext.newInstance(
org.openehealth.ipf.commons.ihe.svs.core.requests.ObjectFactory.class,
org.openehealth.ipf.commons.ihe.svs.core.responses.ObjectFactory.class);
} catch (JAXBException e) {
throw new ExceptionInInitializerError(e);
}
}

private static final XsdValidator XSD_VALIDATOR = new XsdValidator();

public static void validateIti48Request(final RetrieveValueSetRequest request) {
validateWithXsd(request, "/wsdl/iti48/SVS.xsd");
// Not much to do here
}

public static void validateIti48Response(final RetrieveValueSetResponse response) {
validateWithXsd(response, "/wsdl/iti48/SVS.xsd");
// Not much to do here
}

private static void validateWithXsd(final Object object, final String schemaName) {
try {
final Source source = new JAXBSource(JAXB_CONTEXT, object);
XSD_VALIDATOR.validate(source, schemaName);
} catch (Exception e) {
throw new SvsException(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.svs.core.audit;

import lombok.*;
import org.openehealth.ipf.commons.ihe.ws.cxf.audit.WsAuditDataset;

import java.io.Serial;

/**
* The audit dataset for SVS transactions.
*
* @author Quentin Ligier
*/
@Getter
@Setter
@ToString(callSuper = true)
public class SvsAuditDataset extends WsAuditDataset {

@Serial
private static final long serialVersionUID = -8950614248765744542L;

/**
* The retrieved value set ID (OID).
*/
private String valueSetId;

/**
* The retrieved value set display name, if any.
*/
private String valueSetName;

/**
* The retrieved value set version, if any.
*/
private String valueSetVersion;

public SvsAuditDataset(boolean serverSide) {
super(serverSide);
this.setSourceUserIsRequestor(false);
}
}
Loading

0 comments on commit e17d1ef

Please sign in to comment.