Skip to content

Commit

Permalink
MOSIP-34953
Browse files Browse the repository at this point in the history
  • Loading branch information
dhanendra06 committed Aug 4, 2024
1 parent f53646e commit 59283e2
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1031,12 +1031,14 @@ private Map<String, List<HandleDto>> checkAndGetHandles(IdRequestDTO request, St
if (handles != null && !handles.isEmpty()) {
List<String> duplicateHandleFieldIds = handles.keySet().stream().filter(handleName -> {
List<String> hashes = handles.get(handleName).stream().map(HandleDto::getHandleHash).collect(Collectors.toList());
List<String> uinHashFromDB = handleRepo.findUinHashByHandleHashes(hashes);
if (!uinHashFromDB.isEmpty()) {
if (method.equals(UPDATE) && uinHashFromDB.contains(uinHash)) {
return false;
if(!hashes.isEmpty()){
List<String> uinHashFromDB = handleRepo.findUinHashByHandleHashes(hashes);
if (!uinHashFromDB.isEmpty()) {
if (method.equals(UPDATE) && uinHashFromDB.contains(uinHash)) {
return false;
}
return true;
}
return true;
}
return false;
}).collect(Collectors.toList());
Expand Down Expand Up @@ -1098,7 +1100,8 @@ private Map<String, List<HandleDto>> getNewAndDeleteExistingHandles(IdRequestDTO
for(HandleDto existingHandleDto : existingEntry.getValue()) {
//if same handle hash present in "inputSelectedHandlesMap" then
//remove from "inputSelectedHandlesMap" otherwise update handle status as 'DELETE'.
if (inputSelectedHandlesMap != null && inputSelectedHandlesMap.containsKey(existingEntry.getKey())) {
if (inputSelectedHandlesMap != null && inputSelectedHandlesMap.containsKey(existingEntry.getKey()) &&
!inputSelectedHandlesMap.get(existingEntry.getKey()).isEmpty()) {
Optional<HandleDto> result = inputSelectedHandlesMap.get(existingEntry.getKey())
.stream()
.filter( newDto -> newDto.getHandleHash().equals(existingHandleDto.getHandleHash()) )
Expand All @@ -1111,9 +1114,9 @@ private Map<String, List<HandleDto>> getNewAndDeleteExistingHandles(IdRequestDTO
inputSelectedHandlesMap.get(existingEntry.getKey()).remove(result.get());
}

} else {
} /*else {
handleHashesToBeDeleted.add(existingHandleDto.getHandleHash());
}
}*/
}
}

Expand Down

0 comments on commit 59283e2

Please sign in to comment.