Skip to content

Commit

Permalink
Merge pull request #1615 from MonobikashDas/release-1.2.0.1merge
Browse files Browse the repository at this point in the history
MOSIP-24234 : Filter exception biometrics before sending to ABIS
  • Loading branch information
ckm007 authored Oct 10, 2022
2 parents 7e3bd99 + cb504c8 commit 59ea188
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ private String getDataShareUrl(String id, String process) throws Exception {
priorityBasedPacketManagerService.getMetaInfo(id, process, ProviderStageName.BIO_DEDUPE));
}

byte[] content = cbeffutil.createXML(biometricRecord.getSegments());
byte[] content = cbeffutil.createXML(filterExceptionBiometrics(biometricRecord).getSegments());

MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("name", individualBiometricsLabel);
Expand Down Expand Up @@ -706,6 +706,18 @@ private void validateBiometricRecord(BiometricRecord biometricRecord, List<Strin
}
}

private BiometricRecord filterExceptionBiometrics(BiometricRecord biometricRecord) {
List<BIR> segments = biometricRecord.getSegments().stream().filter(bio -> {
Map<String, String> othersMap = bio.getOthers().entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
return (othersMap == null || !othersMap.containsKey("EXCEPTION")) ? true
: !(Boolean.parseBoolean(othersMap.get("EXCEPTION")));
}).collect(Collectors.toList());
BiometricRecord biorecord = new BiometricRecord();
biorecord.setSegments(segments);
return biorecord;
}

public Map<String, List<String>> createTypeSubtypeMapping() throws ApisResourceAccessException, DataShareException,
IOException {

Expand Down

0 comments on commit 59ea188

Please sign in to comment.