Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ccf986d5 authored by pm's avatar pm
Browse files

added java client handler for XRef

parent 1b17a0a1
No related branches found
No related tags found
1 merge request!1Release
# Pixm Connector
---
### Prerequisites
- Java 11 with maven.
- WildFly 18.
---
### Build project locally
After cloning this repository to your local installation launch
```bash
> mvn clean install
```
from the project root directory.
The artifact pixm_fhir_server.war will be created in target/ directory.
---
### Deploy on WildFly server
After building the project through Maven, the artifact created just has to be added to your local WildFly installation in the folder
```bash
{$wildfly.home}/standalone/deployments
```
---
### Request a Patient on a specific Target Identifier
Once the project deployed on your WildFly, you can now call it to request a cross Referenced Patient in the Patient Registry.
The URL to call is
```http
{wildfly18.address}/pixm_fhir_server/fhir_ihe/Patient/$ihe-pix
```
Parameters allowed are :
- The Patient Identifier and the Target System attributed to this identifier
- The Target System you want the cross reference from.
For example :
Given the Patient with the ID 69420 in the Target System 1:2:3:4:5023:31520
And you want the cross referenced patient in the target system 5:6:7:8:0587:79085
The corresponding url will be :
```http
{wildfly18.address}/pixm_fhir_server/fhir_ihe/Patient/$ihe-pix?sourceIdentifier=urn:oid:1:2:3:4:5023:31520|69420&targetSystem=5:6:7:8:0587:79085
```
<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>
<groupId>net.ihe.gazelle</groupId>
<artifactId>pixm-connector</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>Pixm Connector</name>
<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>
<groupId>net.ihe.gazelle</groupId>
<artifactId>pixm-connector</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>Pixm Connector</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dependency.check.version>5.2.4</dependency.check.version>
<dependency.check.skip>true</dependency.check.skip>
<cvss.score.level.tolerate>8</cvss.score.level.tolerate>
<nexus.url>https://gazelle.ihe.net/nexus</nexus.url>
<nexus.path>/content/groups/public/</nexus.path>
<java.version>11</java.version>
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
<git.user.name>gitlab-ci</git.user.name>
<git.user.token>changeit</git.user.token>
<git.project.url>
https://${git.user.name}:${git.user.token}@gitlab.inria.fr/gazelle/applications/test-execution/simulator/pixm-connector.git
</git.project.url>
<hapifhir_version>5.4.0</hapifhir_version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dependency.check.version>5.2.4</dependency.check.version>
<dependency.check.skip>true</dependency.check.skip>
<cvss.score.level.tolerate>8</cvss.score.level.tolerate>
<nexus.url>https://gazelle.ihe.net/nexus</nexus.url>
<nexus.path>/content/groups/public/</nexus.path>
<java.version>11</java.version>
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
<git.user.name>gitlab-ci</git.user.name>
<git.user.token>changeit</git.user.token>
<git.project.url>
https://${git.user.name}:${git.user.token}@gitlab.inria.fr/gazelle/applications/test-execution/simulator/pixm-connector.git
</git.project.url>
<hapifhir_version>5.4.0</hapifhir_version>
<maven.release.plugin.version>2.5.3</maven.release.plugin.version>
<nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version>
<sonar.maven.plugin>3.5.0.1254</sonar.maven.plugin>
</properties>
</properties>
<scm>
<connection>scm:git:${git.project.url}</connection>
......@@ -111,60 +112,56 @@
</profiles>
<build>
<finalName>pixm_fhir_server</finalName>
<finalName>pixm_fhir_server</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.release.plugin.version}</version>
<configuration>
<tagNameFormat>@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<!--
Tell Maven which Java source version you want to use
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.22.1</version>
</dependency>
</dependencies>
</plugin>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.release.plugin.version}</version>
<configuration>
<tagNameFormat>@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<!-- Tell Maven which Java source version you want to use -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.22.1</version>
</dependency>
</dependencies>
</plugin>
<!--
The configuration here tells the WAR plugin to include the FHIR Tester
overlay. You can omit it if you are not using that feature.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
<!-- The configuration here tells the WAR plugin to include the FHIR Tester
overlay. You can omit it if you are not using that feature. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
......@@ -172,9 +169,15 @@
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>framework.preferences-model-api</artifactId>
<version>1.0.0</version>
</dependency>
<!-- This dependency includes the core HAPI-FHIR classes -->
......@@ -183,21 +186,21 @@
<artifactId>hapi-fhir-base</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-server</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-server</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<!-- At least one "structures" JAR must also be included -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<!-- Used for validation -->
<!-- At least one "structures" JAR must also be included -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<!-- Used for validation -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
......@@ -215,22 +218,20 @@
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>${hapifhir_version}</version>
<type>war</type>
<scope>provided</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>${hapifhir_version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
<scope>provided</scope>
</dependency>
<!--
HAPI-FHIR uses Logback for logging support. The logback library is included
automatically by Maven as a part of the hapi-fhir-base dependency, but you
also need to include a logging library. Logback is used here, but log4j
would also be fine.
-->
<!-- HAPI-FHIR uses Logback for logging support. The logback library is
included automatically by Maven as a part of the hapi-fhir-base dependency,
but you also need to include a logging library. Logback is used here, but
log4j would also be fine. -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
......@@ -245,28 +246,26 @@
<scope>provided</scope>
</dependency>
<!--
If you are using HAPI narrative generation, you will need to include Thymeleaf
as well. Otherwise the following can be omitted.
-->
<!-- If you are using HAPI narrative generation, you will need to include
Thymeleaf as well. Otherwise the following can be omitted. -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.fhir</groupId>
<artifactId>ucum</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry-xref-search-client</artifactId>
......@@ -285,7 +284,7 @@
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
package net.ihe.gazelle.adapter.preferences;
public enum Namespaces {
DEPLOYMENT("java:/app/gazelle/pdqm-connector/operational-preferences");
private String value;
/**
* Default constructor for the class. Defines the value of the value in the JNDI context. This aims to be used by the Preferences Module.
* @param value value of the value in the JNDI context.
*/
Namespaces(String value){
this.value = value;
}
/**
* Getter for the value property.
* @return the value of the value property.
*/
public String getValue() {
return value;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return value;
}
}
package net.ihe.gazelle.adapter.preferences;
public enum Preferences {
PATIENT_REGISTRY_URL(Namespaces.DEPLOYMENT,"patientregistry.url");
private Namespaces namespace;
private String key;
/**
* Default constructor for the class. Defines the value of the Preference's key. It can then be used throughout the application to retrieve the
* preference value.
* @param namespace value of the namespace where the Preference is defined.
* @param key value of the Preference's key.
*/
Preferences(Namespaces namespace, String key){
this.namespace = namespace;
this.key = key;
}
/**
* Getter for the namespace property.
* @return the value of the namespace property.
*/
public Namespaces getNamespace() {
return namespace;
}
/**
* Getter for the key property.
* @return the value of the key property.
*/
public String getKey() {
return key;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return key;
}
}
package net.ihe.gazelle.application;
import java.net.MalformedURLException;
import java.net.URL;
import javax.inject.Inject;
import javax.xml.ws.WebServiceException;
import org.slf4j.LoggerFactory;
import com.gitb.ps.ProcessingService;
import net.ihe.gazelle.adapter.preferences.Preferences;
import net.ihe.gazelle.app.patientregistryxrefsearchclient.adapter.XRefSearchClient;
import net.ihe.gazelle.framework.preferencesmodelapi.application.NamespaceException;
import net.ihe.gazelle.framework.preferencesmodelapi.application.OperationalPreferencesService;
import net.ihe.gazelle.framework.preferencesmodelapi.application.PreferenceException;
import net.ihe.gazelle.lib.annotations.Package;
import net.ihe.gazelle.lib.searchmodelapi.business.exception.SearchException;
public class PatientRegistryXRefSearchClient {
private static final Logger clientLogger = LoggerFactory.getLogger(PatientRegistryXRefSearchClient.class);
private OperationPreferencesService operationalPreferencesService;
private XRefSearchClient client;
@Inject
public PatientRegistryXRefSearchClient(OperationalPreferencesService operationalPreferencesService) {
this.operationalPreferencesService = operationalPreferencesService;
}
@Package
PatientRegistryXRefSearchClient(URL url) {
this.client = new XRefSearchClient(url);
}
@Package
PatientRegistryXRefSearchClient(ProcessingService service) {
this.client = new XRefSearchClient(service);
}
private void initializeSearchClient() {
String patientRegistryUrl = null;
try {
patientRegistryUrl = this.operationalPreferencesService.getStringValue(
Preferences.PATIENT_REGISTRY_URL.getNamespace().getValue(), Preferences.PATIENT_REGISTRY_URL.getKey());
this.client = new PatientRegistryXRefSearchClient(new URL(patientRegistryUrl));
} catch (NamespaceException | PreferenceException e) {
throw new SearchException(String.format("Unable to retrieve [%s] Preference !", Preferences.PATIENT_REGISTRY_URL.getKey()));
} catch (MalformedURLException e) {
throw new SearchException(String.format("Preference [%s] with value [%s] is not a valid URL !", Preferences.PATIENT_REGISTRY_URL.getKey(),
patientRegistryUrl));
} catch (WebServiceException e) {
throw new SearchException("Can't connect to patient registry !");
}
}
}
package net.ihe.gazelle.application;
import javax.inject.Inject;
public class PatientXRefSupplier {
private static final Logger = LoggerFactory.getLogger(PatientXRefSupplier.class);
private PatientRegistryXRefSearchClient client;
@Inject
public PatientXRefSupplier(PatientRegistryXRefSearchClient patientRegistryXRefSearchClient) {
this.client = patientRegistryXRefSearchClient;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment