RED-3620: Fixed remove from dictionary

This commit is contained in:
deiflaender 2022-03-15 17:45:26 +01:00
parent 1d1de6caba
commit 32a907f697

View File

@ -99,8 +99,13 @@ public class DictionaryService {
}
Set<DictionaryEntry> entries = new HashSet<>();
var newEntries = convertEntries(t.getId(), currentVersion);
var newValues = newEntries.stream().map(v -> v.getValue()).collect(Collectors.toSet());
// add old entries from existing DictionaryModel
oldModel.ifPresent(dictionaryModel -> entries.addAll(dictionaryModel.getEntries()));
oldModel.ifPresent(dictionaryModel -> entries.addAll(dictionaryModel.getEntries().stream().filter(
f -> !newValues.contains(f.getValue())).collect(Collectors.toList())
));
// Add Increments
entries.addAll(convertEntries(t.getId(), currentVersion));