forked from D-Net/dnet-hadoop
code formatting
This commit is contained in:
parent
75144dacb3
commit
3256b9c836
|
@ -5,13 +5,13 @@ import java.util.*;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import eu.dnetlib.dhp.schema.oaf.utils.PidBlacklistProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.clearspring.analytics.util.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||
import eu.dnetlib.dhp.schema.oaf.utils.PidBlacklistProvider;
|
||||
|
||||
public class CleaningFunctions {
|
||||
|
||||
|
@ -148,13 +148,15 @@ public class CleaningFunctions {
|
|||
}
|
||||
if (Objects.nonNull(r.getInstance())) {
|
||||
|
||||
|
||||
|
||||
for (Instance i : r.getInstance()) {
|
||||
final Set<StructuredProperty> pids = Sets.newHashSet(i.getPid());
|
||||
i.setAlternateIdentifier(
|
||||
Optional.ofNullable(i.getAlternateIdentifier())
|
||||
.map(altId -> altId.stream()
|
||||
i
|
||||
.setAlternateIdentifier(
|
||||
Optional
|
||||
.ofNullable(i.getAlternateIdentifier())
|
||||
.map(
|
||||
altId -> altId
|
||||
.stream()
|
||||
.filter(p -> !pids.contains(p))
|
||||
.collect(Collectors.toList()))
|
||||
.orElse(Lists.newArrayList()));
|
||||
|
@ -236,7 +238,8 @@ public class CleaningFunctions {
|
|||
}
|
||||
|
||||
private static List<StructuredProperty> processPidCleaning(List<StructuredProperty> pids) {
|
||||
return pids.stream()
|
||||
return pids
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(sp -> StringUtils.isNotBlank(StringUtils.trim(sp.getValue())))
|
||||
.filter(sp -> !PID_BLACKLIST.contains(sp.getValue().trim().toLowerCase()))
|
||||
|
|
|
@ -71,7 +71,7 @@ public class IdentifierFactory implements Serializable {
|
|||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> s.getQualifier() != null && "doi".equalsIgnoreCase(s.getQualifier().getClassid()))
|
||||
.filter(IdentifierFactory::pidFilter)
|
||||
.filter(CleaningFunctions::pidFilter)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
} else {
|
||||
|
@ -81,7 +81,7 @@ public class IdentifierFactory implements Serializable {
|
|||
.stream()
|
||||
.filter(i -> i.getPid() != null)
|
||||
.flatMap(i -> i.getPid().stream())
|
||||
.filter(IdentifierFactory::pidFilter)
|
||||
.filter(CleaningFunctions::pidFilter)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue