From 713ec2c23f65087b3f0af480d5954827c0ab0a87 Mon Sep 17 00:00:00 2001 From: pm <pmvanhouteghem@gmail.com> Date: Wed, 1 Sep 2021 12:27:37 +0200 Subject: [PATCH] Quality Gate done --- .../PatientRegistryFeedClient.java | 13 ++++++------ .../provider/ChPatientResourceProvider.java | 21 ------------------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java b/src/main/java/net/ihe/gazelle/application/PatientRegistryFeedClient.java index cda00c5..29890d3 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 d650ffa..92b4beb 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 -- GitLab