From ba11c9d6c4ef8d4ecaa8d972ee0c47bda07f4ea4 Mon Sep 17 00:00:00 2001
From: Achraf <aai@kereval.com>
Date: Tue, 30 Jan 2024 10:44:13 +0100
Subject: [PATCH] Fix active update & active issues

---
 .../adapter/connector/FhirToGazelleRegistryConverter.java     | 3 +++
 .../ihe/gazelle/application/PatientRegistryFeedClient.java    | 4 +---
 .../gazelle/business/provider/IhePatientResourceProvider.java | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pixm-connector-service/src/main/java/net/ihe/gazelle/adapter/connector/FhirToGazelleRegistryConverter.java b/pixm-connector-service/src/main/java/net/ihe/gazelle/adapter/connector/FhirToGazelleRegistryConverter.java
index 0640401..7ae59da 100644
--- a/pixm-connector-service/src/main/java/net/ihe/gazelle/adapter/connector/FhirToGazelleRegistryConverter.java
+++ b/pixm-connector-service/src/main/java/net/ihe/gazelle/adapter/connector/FhirToGazelleRegistryConverter.java
@@ -36,6 +36,9 @@ public class FhirToGazelleRegistryConverter {
         if (fhirPatient.hasActive()) {
             registryPatient.setActive(fhirPatient.getActive());
         }
+        else{
+            registryPatient.setActive(true);
+        }
 
         if (fhirPatient.hasBirthDate()) {
             registryPatient.setDateOfBirth(fhirPatient.getBirthDate());
diff --git a/pixm-connector-service/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java b/pixm-connector-service/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java
index fdbf7f9..27310a6 100644
--- a/pixm-connector-service/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java
+++ b/pixm-connector-service/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java
@@ -177,9 +177,7 @@ public class PatientRegistryFeedClient {
         if (patient == null ) {
             throw new InvalidRequestException(INVALID_PARAMETERS);
         }
-        if(patient.getUuid() == null){
-            patient.setUuid(UUID);
-        }
+        patient.setUuid(UUID);
 
         Patient updatedPatient = null;
         try {
diff --git a/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java b/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java
index 5d4396a..a99edc6 100644
--- a/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java
+++ b/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java
@@ -106,7 +106,7 @@ public class IhePatientResourceProvider implements IResourceProvider {
     public MethodOutcome create(@ResourceParam Patient iti104Patient, HttpServletRequest request) throws UnprocessableEntityException {
         checkIfPatientExist(iti104Patient);
         String profileId = configurationAdapter.getProfileIdCreateUpdateDeleteIti104();
-//        validateInputs(request, iti104Patient, profileId);
+        validateInputs(request, iti104Patient, profileId);
         return addNewPatientIntoRegistry(iti104Patient);
     }
 
@@ -123,7 +123,7 @@ public class IhePatientResourceProvider implements IResourceProvider {
         checkIfIdIsPresent(theConditional, iti104Patient);
 
 
-//        validateInputs(request, iti104Patient, configurationAdapter.getProfileIdCreateUpdateDeleteIti104());
+        validateInputs(request, iti104Patient, configurationAdapter.getProfileIdCreateUpdateDeleteIti104());
         // the '?' is surely not at the beginning of the string
         EntityIdentifier identifier = createEntityIdentifierFromConditional(theConditional);
         if(identifier == null){
-- 
GitLab