diff options
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/main')
-rw-r--r-- | modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java index b4f4098e..b947fbe3 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java @@ -38,11 +38,17 @@ public class RegisterSearchService { private static final Object ZMR = "ZMR"; private static final Object ERNP = "ERnP"; + private static final Object ERNP_KITT = "ERnP(ZMR-Kitt)"; + private static final String LOG_MSG_RESULTS = "Matching operation: {} results: " - + ZMR + ": {} | " + ERNP + ": {}"; + + ZMR + ": {} | " + ERNP + ": {} | " + ERNP_KITT + ": {}"; private static final String LOG_MSG_RESULTS_CLEARING = "Post-processing of register results find duplicated entries. " + "Remove {} entries from " + ERNP + " result."; + private static final String LOG_MSG_RESULTS_CLEARING_KITT = + "Post-processing of register results find duplicated entries. " + + "Remove {} entries from " + ERNP_KITT + " result."; + private static final String LOG_MSG_KITT = "Matching operation kitts entry on: {}"; @@ -98,7 +104,8 @@ public class RegisterSearchService { eidasData.getPseudonym(), eidasData.getCitizenCountryCode()); log.info(LOG_MSG_RESULTS, "seachByPersonalId", - resultsZmr.getPersonResult().size(), resultsErnp.getPersonResult().size()); + resultsZmr.getPersonResult().size(), resultsErnp.getPersonResult().size(), + resultsErnp.getZmrPersonResult().size()); return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultsErnp); @@ -129,7 +136,8 @@ public class RegisterSearchService { eidasData.getFamilyName(), eidasData.getDateOfBirth(), eidasData.getCitizenCountryCode()); log.info(LOG_MSG_RESULTS, "seachByMDS", - resultsZmr.getPersonResult().size(), resultsErnp.getPersonResult().size()); + resultsZmr.getPersonResult().size(), resultsErnp.getPersonResult().size(), + resultsErnp.getZmrPersonResult().size()); return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultsErnp); @@ -168,7 +176,8 @@ public class RegisterSearchService { ccSpecificSearchReq, eidasData.getCitizenCountryCode()); log.info(LOG_MSG_RESULTS, "seachByCountrySpecifics", - resultsZmr.getPersonResult().size(), resultErnp.getPersonResult().size()); + resultsZmr.getPersonResult().size(), resultErnp.getPersonResult().size(), + resultErnp.getZmrPersonResult().size()); return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultErnp); @@ -205,7 +214,7 @@ public class RegisterSearchService { */ log.info(LOG_MSG_RESULTS, "seachByResidence", - resultsZmr.getPersonResult().size(), 0); + resultsZmr.getPersonResult().size(), 0, 0); return RegisterStatusResults.fromZmr(resultsZmr); @@ -452,16 +461,30 @@ public class RegisterSearchService { Set<String> existingZmrPersons = result.getPersonResult().stream() .map(el -> el.getBpk()) .collect(Collectors.toSet()); - List<RegisterResult> ernpCleared = resultErnp.getPersonResult().stream() - .filter(el -> !existingZmrPersons.contains(el.getBpk())) - .collect(Collectors.toList()); + + // check active ERnP entries + List<RegisterResult> ernpCleared = resultErnp.getPersonResultStream() + .filter(el -> !existingZmrPersons.contains(el.getBpk())) + .collect(Collectors.toList()); if (ernpCleared.size() < resultErnp.getPersonResult().size()) { - log.info(LOG_MSG_RESULTS_CLEARING, resultErnp.getPersonResult().size() - ernpCleared.size()); + log.warn(LOG_MSG_RESULTS_CLEARING, resultErnp.getPersonResult().size() - ernpCleared.size()); } + // check ERnP to ZMR kitt entries and join results from ZMR client + List<RegisterResult> zmrCleared = Streams.concat( + resultErnp.getZmrPersonResultStream() + .filter(el -> !existingZmrPersons.contains(el.getBpk())), + result.getPersonResult().stream()) + .collect(Collectors.toList()); + if (zmrCleared.size() < result.getPersonResult().size() + resultErnp.getZmrPersonResult().size()) { + log.info(LOG_MSG_RESULTS_CLEARING, + result.getPersonResult().size() + resultErnp.getZmrPersonResult().size() - zmrCleared.size()); + + } + return new RegisterStatusResults(new RegisterOperationStatus(result.getProcessId()), - result.getPersonResult(), ernpCleared); + zmrCleared, ernpCleared); } static RegisterStatusResults fromErnp(RegisterOperationStatus status, ErnpRegisterResult updateErnp) { |