Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-34953 #1054

Open
wants to merge 1 commit into
base: ES-842
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading