Skip to content

Commit

Permalink
Implement the Retrieve Value Set [ITI-48] transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
qligier committed Jan 14, 2025
1 parent 62a16ae commit 68523cc
Show file tree
Hide file tree
Showing 40 changed files with 2,446 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>
123 changes: 123 additions & 0 deletions commons/ihe/svs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<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>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-ws</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</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,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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.Getter;
import org.openehealth.ipf.commons.audit.types.EnumeratedCodedValue;
import org.openehealth.ipf.commons.audit.types.EventType;

/**
* EventTypes for the SVS module
*
* @author Quentin Ligier
*/
public enum SvsEventTypeCode implements EventType, EnumeratedCodedValue<EventType> {

RetrieveValueSet("ITI-48", "Retrieve Value Set");

@Getter
private final EventType value;

SvsEventTypeCode(String code, String displayName) {
this.value = EventType.of(code, "IHE Transactions", displayName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.jaxbadapters;

import jakarta.xml.bind.DatatypeConverter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.GregorianCalendar;

/**
* A JAXB converter between {@link String} and {@link OffsetDateTime}.
*
* @author Quentin Ligier
*/
public class OffsetDateTimeAdapter extends XmlAdapter<String, OffsetDateTime> {

@Override
public OffsetDateTime unmarshal(final String value) {
if (value == null) {
return null;
}
var calendar = DatatypeConverter.parseDateTime(value);
if (calendar instanceof GregorianCalendar) {
return ((GregorianCalendar) calendar).toZonedDateTime().toOffsetDateTime();
}
else {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(calendar.getTimeInMillis()),
calendar.getTimeZone().toZoneId());
}
}

@Override
public String marshal(final OffsetDateTime value) {
return (value != null) ? DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) : null;
}
}
Loading

0 comments on commit 68523cc

Please sign in to comment.