2020-05-08 16:49:47 +02:00
|
|
|
|
2020-05-22 17:17:41 +02:00
|
|
|
package eu.dnetlib.dhp.broker.oa.matchers.simple;
|
2020-05-07 12:31:26 +02:00
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
2020-05-15 12:25:37 +02:00
|
|
|
import java.util.stream.Collectors;
|
2020-05-07 12:31:26 +02:00
|
|
|
|
2020-06-22 08:51:31 +02:00
|
|
|
import eu.dnetlib.broker.objects.OaBrokerMainEntity;
|
|
|
|
import eu.dnetlib.broker.objects.OaBrokerTypedValue;
|
2020-05-13 12:00:27 +02:00
|
|
|
import eu.dnetlib.dhp.broker.model.Topic;
|
2020-05-22 17:17:41 +02:00
|
|
|
import eu.dnetlib.dhp.broker.oa.matchers.UpdateMatcher;
|
2020-05-07 12:31:26 +02:00
|
|
|
|
2020-06-22 08:51:31 +02:00
|
|
|
public class EnrichMissingPid extends UpdateMatcher<OaBrokerTypedValue> {
|
2020-05-07 12:31:26 +02:00
|
|
|
|
2020-05-13 12:00:27 +02:00
|
|
|
public EnrichMissingPid() {
|
2020-06-26 11:20:45 +02:00
|
|
|
super(10,
|
2020-06-12 09:47:55 +02:00
|
|
|
pid -> Topic.ENRICH_MISSING_PID,
|
|
|
|
(p, pid) -> p.getPids().add(pid),
|
|
|
|
pid -> pid.getType() + "::" + pid.getValue());
|
2020-05-07 12:31:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-06-22 08:51:31 +02:00
|
|
|
protected List<OaBrokerTypedValue> findDifferences(final OaBrokerMainEntity source,
|
|
|
|
final OaBrokerMainEntity target) {
|
2020-05-15 12:25:37 +02:00
|
|
|
|
2020-07-01 08:42:39 +02:00
|
|
|
if (target.getPids().size() > 0) {
|
2020-06-10 12:11:16 +02:00
|
|
|
return Arrays.asList();
|
|
|
|
}
|
2020-05-15 12:25:37 +02:00
|
|
|
|
|
|
|
return source
|
2020-06-16 12:34:13 +02:00
|
|
|
.getPids()
|
2020-05-15 12:25:37 +02:00
|
|
|
.stream()
|
|
|
|
.collect(Collectors.toList());
|
2020-05-07 12:31:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|