Pull request #348: RED-3620: Fixed remove from dictionary

Merge in RED/redaction-service from RED-3620 to release/3.80.x

* commit '358395e69b0b6595f706186971eb6580924fe7d5':
  RED-3620: Fixed remove from dictionary
This commit is contained in:
Dominique Eiflaender 2022-03-15 18:51:02 +01:00 committed by Timo Bejan
commit 1d25575e24

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));