Skip to content

Commit

Permalink
#13147 - Phone Number Validation for E-Santé Reports – Remove and Sto…
Browse files Browse the repository at this point in the history
…re Non-Numeric Text
  • Loading branch information
SergiuPacurariu committed Oct 8, 2024
1 parent f1f33f3 commit 2452c70
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down Expand Up @@ -102,7 +103,7 @@ private CompletionStage<ProcessingResult<ExternalMessageProcessingResult>> check

protected abstract CompletionStage<Boolean> handleRelatedForwardedMessages();

protected CompletionStage<ProcessingResult<ExternalMessageProcessingResult>> pickOrCreatePerson(ExternalMessageProcessingResult previousResult, ExternalMessageDto externalMessageDto) {
protected CompletionStage<ProcessingResult<ExternalMessageProcessingResult>> pickOrCreatePerson(ExternalMessageProcessingResult previousResult) {

final PersonDto person = buildPerson();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ public List<String[]> 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<Integer, ApproximateAgeType> ageAndAgeType = ApproximateAgeType.ApproximateAgeHelper
Expand All @@ -99,8 +104,6 @@ public List<String[]> mapToPerson(PersonDto person) {
PersonDto.APPROXIMATE_AGE_TYPE))));
}

Mapping.of(person::setAdditionalDetails, person.getAdditionalDetails(),
externalMessage.getPersonAdditionalDetails(), PersonDto.ADDITIONAL_DETAILS);
return changedFields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public CompletionStage<ProcessingResult<ExternalMessageProcessingResult>> 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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public CompletionStage<ProcessingResult<CaseDataDto>> 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 ->
Expand Down

0 comments on commit 2452c70

Please sign in to comment.