[Cleaning] drop alternate identifiers with empty values

This commit is contained in:
Claudio Atzori 2021-03-29 14:23:18 +02:00
parent 1dfda3624e
commit 48f2b6127e
1 changed files with 12 additions and 6 deletions

View File

@ -152,15 +152,21 @@ public class CleaningFunctions {
Optional
.ofNullable(i.getPid())
.ifPresent(pid -> {
final Set<StructuredProperty> pids = Sets
.newHashSet(
final Set<StructuredProperty> pids =
pid
.stream()
.filter(p -> StringUtils.isBlank(p.getValue()))
.collect(Collectors.toList()));
final Set<StructuredProperty> altIds = Sets.newHashSet(i.getAlternateIdentifier());
.filter(p -> StringUtils.isNotBlank(p.getValue()))
.collect(Collectors.toCollection(HashSet::new));
Optional.ofNullable(i.getAlternateIdentifier())
.ifPresent(altId -> {
final Set<StructuredProperty> altIds = altId.stream()
.filter(p -> StringUtils.isNotBlank(p.getValue()))
.collect(Collectors.toCollection(HashSet::new));
i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids)));
});
});
if (Objects.isNull(i.getAccessright()) || StringUtils.isBlank(i.getAccessright().getClassid())) {
i