Commit e79c3bf3 authored by Franck Desaize's avatar Franck Desaize
Browse files

Merge branch 'master' into 'develop'

merge master into develop

See merge request !14
parents 3858411d 6500606c
Pipeline #290929 failed with stages
in 14 minutes and 43 seconds
......@@ -81,6 +81,8 @@ target/
.project
**/.classpath
**/.project
**/.allure
**/allure-results
**/.allure**
**/allure-results/**
......
......@@ -4,13 +4,13 @@
<parent>
<artifactId>app.patient-registry</artifactId>
<groupId>net.ihe.gazelle</groupId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry-feed-client</artifactId>
<name>Patient Registry Feed Client</name>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
......@@ -66,4 +66,4 @@
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -5,13 +5,13 @@
<parent>
<artifactId>app.patient-registry</artifactId>
<groupId>net.ihe.gazelle</groupId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry-api</artifactId>
<name>Patient Registry API</name>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
<dependencies>
<dependency>
......@@ -30,4 +30,4 @@
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -5,13 +5,13 @@
<parent>
<artifactId>app.patient-registry</artifactId>
<groupId>net.ihe.gazelle</groupId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry-search-client</artifactId>
<name>Patient Registry Search Client</name>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
......@@ -63,4 +63,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -5,12 +5,12 @@
<parent>
<artifactId>app.patient-registry</artifactId>
<groupId>net.ihe.gazelle</groupId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</parent>
<artifactId>app.patient-registry-service</artifactId>
<name>Patient Registry Service</name>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
<packaging>ejb</packaging>
......@@ -141,13 +141,13 @@
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.11.0</version>
<version>4.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.11.0</version>
<version>4.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
......@@ -405,8 +405,8 @@
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>common-junit48</artifactId>
<version>3.0.0-M5</version>
<artifactId>surefire-junit47</artifactId>
<version>3.0.0-M4</version>
</dependency>
</dependencies>
</plugin>
......@@ -414,4 +414,4 @@
</build>
</profile>
</profiles>
</project>
\ No newline at end of file
</project>
......@@ -32,7 +32,6 @@ public class PatientConverter {
*/
public static PatientDB toPatientDB(Patient patient) {
PatientDB patientDB = new PatientDB();
patientDB.setUuid(patient.getUuid());
patient.getIdentifiers().forEach((identifier -> IdentifierConverter.toPatientIdentifierDB(identifier, patientDB)));
patientDB.setStillActive(patient.isActive());
......
......@@ -7,10 +7,12 @@ import net.ihe.gazelle.app.patientregistryservice.application.dao.DomainDAO;
import net.ihe.gazelle.app.patientregistryservice.application.exceptions.DomainSearchException;
import net.ihe.gazelle.framework.loggerservice.application.GazelleLogger;
import net.ihe.gazelle.framework.loggerservice.application.GazelleLoggerFactory;
import org.apache.commons.lang3.StringUtils;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.*;
import java.util.List;
/**
* DAO for Domain Objects.
......@@ -90,21 +92,23 @@ public class DomainDAOImpl implements DomainDAO {
*/
@Override
public boolean exist(String domainIdentifier) {
if (domainIdentifier == null || domainIdentifier.isBlank()) {
if (StringUtils.isBlank(domainIdentifier)) {
throw new IllegalArgumentException(DOMAIN_IDENTIFIER_CAN_NOT_BE_NULL_OR_EMPTY);
}
try {
TypedQuery<HierarchicDesignatorDB> query = entityManager.createNamedQuery("HierarchicDesignatorDB.findByUniversalID",
HierarchicDesignatorDB.class);
query.setParameter("universalID", domainIdentifier);
query.setParameter("givenUsage", DesignatorTypeDB.PATIENT_ID);
query.getSingleResult();
} catch (NoResultException e) {
TypedQuery<HierarchicDesignatorDB> query = entityManager.createNamedQuery("HierarchicDesignatorDB.findByUniversalID",
HierarchicDesignatorDB.class);
query.setParameter("universalID", domainIdentifier);
query.setParameter("givenUsage", DesignatorTypeDB.PATIENT_ID);
List<HierarchicDesignatorDB> hierarchicDesignatorDBList = query.getResultList();
if (hierarchicDesignatorDBList.isEmpty()) {
return false;
} else {
if (hierarchicDesignatorDBList.size() > 1) {
log.warn("Duplicated Hierarchic Domain ");
return true;
}
return true;
}
log.info(String.format("Domain : %s found", domainIdentifier));
return true;
}
/**
......
......@@ -56,8 +56,8 @@ public class PatientCrossReferenceDAOImpl implements PatientCrossReferenceDAO {
throw new SearchCrossReferenceException("The value from entityIdentifier cannot be null or empty");
}
Integer hierarchicDesignatorDID = searchForHierarchicDesignator(systemID);
String patientIdentifier = searchForPatientIdentifier(hierarchicDesignatorDID, patientIDInSystem);
List<HierarchicDesignatorDB> hierarchicDesignatorDBList = searchForHierarchicDesignator(systemID);
String patientIdentifier = searchForPatientIdentifier(hierarchicDesignatorDBList, patientIDInSystem);
return searchForPatient(patientIdentifier);
}
......@@ -116,7 +116,7 @@ public class PatientCrossReferenceDAOImpl implements PatientCrossReferenceDAO {
* @return Id of the matching HierarchicDesignatorDB to the systemIdentifier
* @throws SearchCrossReferenceException if an error occurred during the search
*/
private Integer searchForHierarchicDesignator(String systemIdentifier) throws SearchCrossReferenceException {
private List<HierarchicDesignatorDB> searchForHierarchicDesignator(String systemIdentifier) throws SearchCrossReferenceException {
TypedQuery<HierarchicDesignatorDB> queryForAPatient = entityManager.createNamedQuery("HierarchicDesignatorDB.findByUniversalID",
HierarchicDesignatorDB.class);
......@@ -126,28 +126,31 @@ public class PatientCrossReferenceDAOImpl implements PatientCrossReferenceDAO {
if (hierarchicDesignatorDBS.isEmpty()) {
throw new SearchCrossReferenceException("Error in the sourceIdentifier : System does not exist");
}
return queryForAPatient.getResultList().get(0).getId();
return queryForAPatient.getResultList();
}
/**
* search for a PatientIdentifierDB given its HierarchicDesignatorDB and its id_number
*
* @param hierarchicDesignatorDBID id of the system domain
* @param hierarchicDesignatorDBList list of the system domain
* @param idNumber of the patient in the system
* @return PatientIdentifierDB
* @throws SearchCrossReferenceException if an error occurred during the search
*/
private String searchForPatientIdentifier(Integer hierarchicDesignatorDBID, String idNumber) throws SearchCrossReferenceException {
try {
TypedQuery<PatientIdentifierDB> queryForAPatient = entityManager.createNamedQuery("PatientIdentifierDB.findByHierarchicDomainAndId",
PatientIdentifierDB.class);
queryForAPatient.setParameter("domain_id", hierarchicDesignatorDBID);
queryForAPatient.setParameter("id_number", idNumber);
return queryForAPatient.getSingleResult().getIdentifier();
} catch (NoResultException exception) {
throw new SearchCrossReferenceException("Error in the sourceIdentifier : it does not match any identity");
private String searchForPatientIdentifier(List<HierarchicDesignatorDB> hierarchicDesignatorDBList, String idNumber) throws SearchCrossReferenceException {
for (HierarchicDesignatorDB hierarchicDesignatorDB : hierarchicDesignatorDBList) {
try {
TypedQuery<PatientIdentifierDB> queryForAPatient = entityManager.createNamedQuery("PatientIdentifierDB.findByHierarchicDomainAndId",
PatientIdentifierDB.class);
queryForAPatient.setParameter("domain_id", hierarchicDesignatorDB.getId());
queryForAPatient.setParameter("id_number", idNumber);
return queryForAPatient.getSingleResult().getIdentifier();
} catch (NoResultException exception) {
log.warn("No Patient Identifier found for the given hierarchicDesignator and PatientID");
}
}
throw new SearchCrossReferenceException("Error in the sourceIdentifier : it does not match any identity");
}
/**
......
......@@ -4,14 +4,14 @@
<parent>
<artifactId>app.patient-registry</artifactId>
<groupId>net.ihe.gazelle</groupId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry-xref-search-client</artifactId>
<name>Patient Registry X Ref Search Client</name>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
......@@ -64,4 +64,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<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>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry</artifactId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Patient Registry</name>
......@@ -311,7 +310,7 @@
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>app.patient-registry-api</artifactId>
<version>2.0.1-SNAPSHOT</version>
<version>2.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.ihe.gazelle</groupId>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment