From 2452c70e85c8983650a16a13c369bbc966fc7bb7 Mon Sep 17 00:00:00 2001 From: SergiuPacurariu Date: Tue, 8 Oct 2024 15:09:17 +0300 Subject: [PATCH] =?UTF-8?q?#13147=20-=20Phone=20Number=20Validation=20for?= =?UTF-8?q?=20E-Sant=C3=A9=20Reports=20=E2=80=93=20Remove=20and=20Store=20?= =?UTF-8?q?Non-Numeric=20Text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processing/AbstractProcessingFlow.java | 13 +++++++------ .../processing/ExternalMessageMapper.java | 9 ++++++--- .../AbstractLabMessageProcessingFlow.java | 2 +- .../AbstractPhysiciansReportProcessingFlow.java | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java b/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java index 007b5b35a97..fefeb32f8ab 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java @@ -15,6 +15,12 @@ package de.symeda.sormas.api.externalmessage.processing; +import java.util.concurrent.CompletionStage; +import java.util.function.Function; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import de.symeda.sormas.api.CountryHelper; import de.symeda.sormas.api.caze.CaseDataDto; import de.symeda.sormas.api.externalmessage.ExternalMessageDto; @@ -29,11 +35,6 @@ import de.symeda.sormas.api.utils.dataprocessing.ProcessingResult; import de.symeda.sormas.api.utils.dataprocessing.ProcessingResultStatus; import de.symeda.sormas.api.utils.dataprocessing.flow.FlowThen; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.CompletionStage; -import java.util.function.Function; public abstract class AbstractProcessingFlow { @@ -102,7 +103,7 @@ private CompletionStage> check protected abstract CompletionStage handleRelatedForwardedMessages(); - protected CompletionStage> pickOrCreatePerson(ExternalMessageProcessingResult previousResult, ExternalMessageDto externalMessageDto) { + protected CompletionStage> pickOrCreatePerson(ExternalMessageProcessingResult previousResult) { final PersonDto person = buildPerson(); diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageMapper.java b/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageMapper.java index 000541bcbc3..6cbc4a81d12 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageMapper.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageMapper.java @@ -82,7 +82,12 @@ public List mapToPerson(PersonDto person) { person::setNationalHealthId, person.getNationalHealthId(), externalMessage.getPersonNationalHealthId(), - PersonDto.NATIONAL_HEALTH_ID))); + PersonDto.NATIONAL_HEALTH_ID), + Mapping.of( + person::setAdditionalDetails, + person.getAdditionalDetails(), + externalMessage.getPersonAdditionalDetails(), + PersonDto.ADDITIONAL_DETAILS))); if (person.getBirthdateYYYY() != null) { DataHelper.Pair ageAndAgeType = ApproximateAgeType.ApproximateAgeHelper @@ -99,8 +104,6 @@ public List mapToPerson(PersonDto person) { PersonDto.APPROXIMATE_AGE_TYPE)))); } - Mapping.of(person::setAdditionalDetails, person.getAdditionalDetails(), - externalMessage.getPersonAdditionalDetails(), PersonDto.ADDITIONAL_DETAILS); return changedFields; } diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlow.java b/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlow.java index 0794aacda41..1f3f7675523 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlow.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlow.java @@ -126,7 +126,7 @@ public CompletionStage> run() return doInitialChecks(externalMessage, new ExternalMessageProcessingResult()) .then(initialCheckResult -> handleRelatedLabMessages(relatedLabMessageHandler, initialCheckResult)) // if no handling happened, or opted to continue regular processing, ignore results - .then(ignored -> pickOrCreatePerson(new ExternalMessageProcessingResult(), externalMessage)) + .then(ignored -> pickOrCreatePerson(new ExternalMessageProcessingResult())) .thenSwitch(p -> pickOrCreateEntry(p.getData(), externalMessage)) .when(PickOrCreateEntryResult::isNewCase, (f, p, r) -> doCreateCaseFlow(f)) .when(PickOrCreateEntryResult::isNewContact, (f, p, r) -> doCreateContactFlow(f)) diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java index be8f5c2780b..a6e52ea4167 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java @@ -46,7 +46,7 @@ public CompletionStage> run(ExternalMessageDto ext //@formatter:off return doInitialChecks(externalMessage, new ExternalMessageProcessingResult()) - .then(initialResult -> pickOrCreatePerson(initialResult.getData(), externalMessage)) + .then(initialResult -> pickOrCreatePerson(initialResult.getData())) .thenSwitch(p -> pickOrCreateEntry(p.getData(), externalMessage)) .when(PersonAndPickOrCreateEntryResult::isNewCase, (f, e, p) -> f .then(ignored -> createCase(e.getPerson(), externalMessage)).then(c ->