diff --git a/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java b/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java index cda00c5c65d070ff62c6e1a3bb3fd878d5ff8716..29890d3e5aa0122b925715b815fec7568c3c9453 100644 --- a/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java +++ b/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java @@ -179,16 +179,15 @@ public class PatientRegistryFeedClient { if (uuidDuplicated == null || uuidDuplicated.isBlank()) { throw new InvalidRequestException(INVALID_PARAMETERS); } - + Bundle response = new Bundle(); try { - Bundle response = new Bundle(); + response.setId(client.mergePatient(uuidOriginal, uuidDuplicated)); - return response; + } catch (PatientFeedException e) { - logger.error("pouet pouet ciboulette"); - throw new InternalErrorException(""); - //TODO Map errors and delete the pouet pouet ciboulette comment + treatClientBaseErrors(e); } + return response; } /** @@ -245,7 +244,7 @@ public class PatientRegistryFeedClient { * @param e the exception thrown * @throws InternalErrorException throws back the exception with the right http code and the stack trace. */ - private void treatClientBaseErrors (Exception e) throws InternalErrorException{ + private void treatClientBaseErrors (Exception e) { switch(e.getMessage()) { case "Exception while Mapping with GITB elements !": throw new InternalErrorException("Exception while Mapping with GITB elements !", e); diff --git a/src/main/java/net/ihe/gazelle/business/provider/ChPatientResourceProvider.java b/src/main/java/net/ihe/gazelle/business/provider/ChPatientResourceProvider.java index d650ffa512a20bdbe5c7c786a02ea6b5a7135b10..92b4bebfa3221ac4ace170ba2b03eabedbcffc70 100644 --- a/src/main/java/net/ihe/gazelle/business/provider/ChPatientResourceProvider.java +++ b/src/main/java/net/ihe/gazelle/business/provider/ChPatientResourceProvider.java @@ -199,27 +199,6 @@ public class ChPatientResourceProvider implements IResourceProvider { } } -// @Update -// public MethodOutcome merge(@IdParam IdType theId, @ResourceParam Bundle iti93Bundle) { -// String uuid = theId.getIdPart(); -// if (uuid.isBlank() || uuid == null) { -// patientLogger.error(NO_ID_PROVIDED); -// throw new InvalidRequestException(NO_ID_PROVIDED); -// } -// try { -// net.ihe.gazelle.app.patientregistryapi.business.Patient patientToMerge = BundleToPatientRegistryConverter.iti93BundleToPatient -// (iti93Bundle); -// MethodOutcome methodOutcome = new MethodOutcome(); -// methodOutcome.setResource(patientRegistryFeedClient.mergePatient(uuid,"stringARemplacer")); -// return methodOutcome; -// } catch (ConversionException e) { -// throw new InvalidRequestException("Bundle Could not be converted to HL7 Patient"); -// }catch (PatientFeedException e) { -// throw new InternalErrorException("Patient Feed client is not set"); -// } -// -// } - /** * Search method for a Patient using the source identifier required parameter * and an optional list of target system