[Cleaning] drop alternate identifiers with empty values

This commit is contained in:
Claudio Atzori 2021-03-26 12:30:00 +01:00
parent 827e7e37db
commit b5b7dc2104
1 changed files with 6 additions and 1 deletions

View File

@ -152,7 +152,12 @@ public class CleaningFunctions {
Optional
.ofNullable(i.getPid())
.ifPresent(pid -> {
final Set<StructuredProperty> pids = Sets.newHashSet(pid);
final Set<StructuredProperty> pids = Sets
.newHashSet(
pid
.stream()
.filter(p -> StringUtils.isBlank(p.getValue()))
.collect(Collectors.toList()));
final Set<StructuredProperty> altIds = Sets.newHashSet(i.getAlternateIdentifier());
i.setAlternateIdentifier(Lists.newArrayList(Sets.difference(altIds, pids)));
});