Commit 38a2b14d authored by Franck Desaize's avatar Franck Desaize
Browse files

Merge branch 'release/2.0.0' into 'master'

Release 2.0.0

See merge request !10
parents 4d3dcffe 18909da0
Pipeline #270311 failed with stages
in 1 minute and 1 second
......@@ -24,15 +24,11 @@ variables:
P_DB_SCHEMA_PATH: "patient-registry-service/src/main/resources/sql/schema.sql"
P_DB_NAME: "pam-simulator"
services:
- postgres:9.6.17-alpine
# Define jobs
code:
stage: build
extends:
- .codeForJavaWithWildflyAndPostgresql
- .buildCodeForJavaWithWildflyAndPostgresql
services:
- postgres:9.6.17-alpine
variables:
......@@ -41,17 +37,11 @@ code:
quality:
stage: tests
extends:
- .qualityForJavaWithSonarqubeAndPostgresql
- .testQualityForJavaWithSonarqubeAndPostgresql
services:
- postgres:9.6.17-alpine
variables:
P_MAVEN_IMAGE_TAG: "wildfly-3.6.3-18.0.1.Final"
P_CODE_BINARIES: "target/classes/"
P_CODE_JACOCO_REPORT_PATH: "target/jacoco.exec"
P_CODE_JUNIT_REPORTS_PATH: "target/surefire-reports"
P_CODE_DYNAMIC_ANALYSIS: "reuseReports"
P_CODE_COVERAGE_PLUGIN: "jacoco"
P_CODE_SOURCE_ENCODING: "UTF-8"
P_CODE_LANGUAGE: "java"
P_CODE_DEVELOPER_EDITION: "true"
release/code:
stage: release
......
......@@ -24,6 +24,10 @@
boolean exist(String domainIdentifier);
void createDomain(String domainIdentifier, String domainName);
```
- XReference service
```java
PatientAliases search(EntityIdentifier sourceIdentifier, List<String> targetDomains) throws SearchCrossReferenceException;
```
### Dependency
......@@ -48,6 +52,7 @@
The different services accessible through a `GITB processing service` (SOAP) are :
- patient feed
- patient search
- XReference search
### Dependency
......@@ -61,6 +66,7 @@
</dependency>
```
## Patient search client
The patient search client is a `GITB Processing Service Client` which will point to a `GITB Processing Service`.
......@@ -84,6 +90,7 @@ It will be used to search Patients depending on specific characteristics
public PatientSearchClient(ProcessingService processingService)
```
### Dependency
To use the client, add the dependency to the library in the `pom.xml` of the client application.
......@@ -128,4 +135,43 @@ It will be used to order the creation of a patient.
<artifactId>app.patient-registry-feed-client</artifactId>
<version>...</version>
</dependency>
```
## XRef search Client
The CrossReference search client is a `GITB Processing Service Client` which will point to a `GITB Processing Service`.
It will be used to order the search of a crossReference matching the given parameters.
### Client API
- The client can point to a distant service
```java
/**
* Default constructor for the class. The Client will create the GITB Processing Service client based on the URL.
* @param processingServiceURL : URL of the remote Processing Service.
*/
public XRefSearchClient(URL processingServiceURL)
```
- The client can point to an instantiated Patient Feed Service
```java
/**
* Constructor used for test purposes.
* @param processingService : processing service to be used by the XRefSearchClient.
*/
public XRefSearchClient(ProcessingService processingService)
```
### Dependency
To use the client, add the dependency to the library in the `pom.xml` of the client application.
```xml
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>patient-registry-xref-search-client</artifactId>
<version>...</version>
</dependency>
```
\ No newline at end of file
sudo cp patient-registry-service/target/patient-registry-1.0.1-SNAPSHOT.jar /usr/local/wildfly18/standalone/deployments/patient-registry.jar
......@@ -7,7 +7,7 @@ import com.gitb.ps.ProcessingService;
import com.gitb.tr.BAR;
import com.gitb.tr.TAR;
import com.gitb.tr.TestResultType;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedException;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedService;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
......@@ -19,7 +19,7 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import java.net.URL;
import java.util.List;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.*;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.*;
/**
* PatientFeed Client to be used by any application that wants to feed a patient to a remote Patient Registry.
......@@ -54,7 +54,7 @@ public class PatientFeedClient implements PatientFeedService {
@Override
public String feedPatient(Patient patient) throws PatientFeedException {
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation(PatientRegistryGITBWebserviceConstants.PATIENT_FEED_OPERATION);
processRequest.setOperation(PatientProcessingWebserviceConstants.PATIENT_FEED_OPERATION);
AnyContent patientToFeedAnyContent = null;
try {
patientToFeedAnyContent = new MapperObjectToAnyContent().getAnyContent(PATIENT_INPUT_NAME, patient);
......@@ -76,7 +76,7 @@ public class PatientFeedClient implements PatientFeedService {
* Extract the UUID from the ProcessResponse received from the remote ProcessingService.
* @param processResponse : response received.
* @return literal value of the UUID assigned to the fed patient by the remote Repository.
* @throws PatientFeedProcessResponseException : if the ProcesssResponse is not valid for a PatientFeed request.
* @throws PatientFeedProcessResponseException : if the ProcessResponse is not valid for a PatientFeed request.
* @throws PatientFeedException : if the Patient Feed raised an exception in the remote Repository.
*/
private String extractUUIDFromProcessResponse(ProcessResponse processResponse) throws PatientFeedProcessResponseException, PatientFeedException{
......@@ -103,7 +103,7 @@ public class PatientFeedClient implements PatientFeedService {
* Extract the UUID from the ProcessResponse.output received from the remote ProcessingService.
* @param outputs : list of received outputs.
* @return literal value of the UUID assigned to the fed patient by the remote Repository.
* @throws PatientFeedProcessResponseException : if the ProcesssResponse.output is not valid for a PatientFeed request.
* @throws PatientFeedProcessResponseException : if the ProcessResponse.output is not valid for a PatientFeed request.
*/
private String extractUUIDFromOutputs(List<AnyContent> outputs) throws PatientFeedProcessResponseException{
if (outputs.size() == 1){
......
......@@ -11,8 +11,8 @@ import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import java.math.BigInteger;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.PATIENT_INPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebserviceConstants.UUID_OUTPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.PATIENT_INPUT_NAME;
import static net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientProcessingWebserviceConstants.UUID_OUTPUT_NAME;
import static org.junit.jupiter.api.Assertions.fail;
/**
......
package net.ihe.gazelle.app.patientregistryapi.adapter.ws;
/**
* This class is used to store all constant values used by Patient Registry in X-ref Processing Service.
*/
public class CrossReferenceProcessingWebServiceConstants {
public static final String CROSS_REFERENCE_PROCESSING_RESOURCE_URL = "xref-processing-service";
public static final String CROSS_REFERENCE_PROCESSING_SERVICE = "CrossReferenceService";
public static final String CROSS_REFERENCE_PROCESSING_SERVICE_PORT = "XRefProcessingServicePort";
public static final String CROSS_REFERENCE_PATIENT_OUTPUT_NAME = "XRefPatient";
public static final String CROSS_REFERENCE_PATIENT_SEARCH_OPERATION = "XRefSearch";
public static final String CROSS_REFERENCE_INPUT_NAME = "CrossRefSourceIdentifier";
public static final String CROSS_REFERENCE_INPUT_TARGET_NAME = "CrossRefTargetDomains";
/**
* Private constructor to hide implicit one.
*/
private CrossReferenceProcessingWebServiceConstants() {
}
}
......@@ -2,11 +2,11 @@ package net.ihe.gazelle.app.patientregistryapi.adapter.ws;
/**
*
*This class is used to store all contant values used by Patient Registry Patient Feed Processing Service.
*This class is used to store all constant values used by Patient Registry Patient Feed Processing Service.
*/
public class PatientRegistryGITBWebserviceConstants {
public static final String PATIENT_PROCESSING_SERVICE = "PatientProcessingServiceService";
public class PatientProcessingWebserviceConstants {
public static final String PATIENT_PROCESSING_RESOURCE_URL = "patient-processing-service";
public static final String PATIENT_PROCESSING_SERVICE = "PatientProcessingService";
public static final String PATIENT_PROCESSING_SERVICE_PORT = "PatientProcessingServicePort";
public static final String PATIENT_FEED_OPERATION = "PatientFeed";
public static final String PATIENT_SEARCH_OPERATION = "PatientSearch";
......@@ -18,6 +18,6 @@ public class PatientRegistryGITBWebserviceConstants {
/**
* Private constructor to hide implicit one.
*/
private PatientRegistryGITBWebserviceConstants(){
private PatientProcessingWebserviceConstants(){
}
}
package net.ihe.gazelle.app.patientregistryapi.application;
import net.ihe.gazelle.app.patientregistryapi.business.EntityIdentifier;
import net.ihe.gazelle.app.patientregistryapi.business.PatientAliases;
import java.util.List;
/**
* Patient Cross Reference Search Service API
*/
public interface PatientCrossReferenceSearch {
/**
* retrieve the patient alias corresponding to the requested
*
* @param sourceIdentifier identifier of the reference patient
* @param targetDomains list of TargetDomains, the list cardinality must be [0..*]
* @return a patient aliases that match the patient with sourceIdentifier
* @throws SearchCrossReferenceException if an error happens during the search processing.
*/
PatientAliases search(EntityIdentifier sourceIdentifier, List<String> targetDomains) throws SearchCrossReferenceException;
}
package net.ihe.gazelle.app.patientregistryapi.application;
/**
* Exception to be thrown if a X-ref cannot be searched.
*/
public class SearchCrossReferenceException extends Exception {
/**
* Constructs a new exception with {@code null} as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*/
public SearchCrossReferenceException() {
super();
}
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public SearchCrossReferenceException(String message) {
super(message);
}
/**
* Constructs a new exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public SearchCrossReferenceException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new exception with the specified cause and a detail
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public SearchCrossReferenceException(Throwable cause) {
super(cause);
}
/**
* Constructs a new exception with the specified detail message,
* cause, suppression enabled or disabled, and writable stack
* trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
public SearchCrossReferenceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
package net.ihe.gazelle.app.patientregistryapi.application;
/**
* Exception to be thrown if a targetDomain cannot be searched.
*/
public class UnrecognizedDomainException extends Exception {
/**
* Constructs a new exception with {@code null} as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*/
public UnrecognizedDomainException() {
super();
}
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public UnrecognizedDomainException(String message) {
super(message);
}
/**
* Constructs a new exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public UnrecognizedDomainException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new exception with the specified cause and a detail
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public UnrecognizedDomainException(Throwable cause) {
super(cause);
}
/**
* Constructs a new exception with the specified detail message,
* cause, suppression enabled or disabled, and writable stack
* trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
public UnrecognizedDomainException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
package net.ihe.gazelle.app.patientregistryapi.business;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PatientAliases {
private String uuid;
private String lastModifier;
private Date lastModifierDateTime;
private List<Patient> members = new ArrayList<>();
/**
* default constructor
*/
public PatientAliases() {
}
/**
* Constructor for the class
*
* @param uuid the identifier of the patient aliases
* @param lastModifier the name of the last modifier
* @param lastModifierDateTime the date time of the last update
*/
public PatientAliases(String uuid, String lastModifier, Date lastModifierDateTime) {
this.uuid = uuid;
this.lastModifier = lastModifier;
this.lastModifierDateTime = lastModifierDateTime;
}
/**
* get uuid gazelle patientAliases
*
* @return string uuid
*/
public String getUuid() {
return uuid;
}
/**
* set patientAliases gazelle identifier
*
* @param uuid the value to set to the uuid property
*/
public void setUuid(String uuid) {
this.uuid = uuid;
}
/**
* get the last modifier of the PatientAliases
*
* @return the name as String
*/
public String getLastModifier() {
return lastModifier;
}
/**
* set the last modifier of the PatientAliases
*
* @param lastModifier the name of the last modifier
*/
public void setLastModifier(String lastModifier) {
this.lastModifier = lastModifier;
}
/**
* get the Date Time of the last modifier
*
* @return the date time of the last modifier
*/
public Date getLastModifierDateTime() {
return lastModifierDateTime;
}
/**
* set the Date Time of the last modifier
*/
public void setLastModifierDateTime() {
this.lastModifierDateTime = new Timestamp(new Date().getTime());
}
/**
* get the list of the patients
*
* @return the list of the patients
*/
public List<Patient> getMembers() {
return members;
}
/**
* Add a list of patient to the current list of patient if it is not already in the list
*
* @param patients
*/
public void addMembers(List<Patient> patients) {
if (patients != null) {
for (Patient patient : patients) {
setLastModifierDateTime();
if (!this.members.contains(patient)) {
this.members.add(patient);
}
}
}
}
public void setMembers(List<Patient> patients) {
if (patients != null) {
setLastModifierDateTime();
this.members = patients;
}
}
/**
* add a patient to a members
*
* @param member the patient to add
*/
public void addMember(Patient member) {
setLastModifierDateTime();
this.members.add(member);
}
/**
* add a patient to a members
*
* @param member the patient to add
* @param index the index to insert the patient
*/
public void addMember(Patient member, int index) {
setLastModifierDateTime();
this.members.add(index, member);
}
/**
* remove a member to a list of members
*
* @param member the patient to remove
*/
public void removeMember(Patient member) {
setLastModifierDateTime();
this.members.remove(member);
}
/**
* {@inheritDoc}