dnet-hadoop/dhp-workflows/dhp-broker-events/src/main/java/eu/dnetlib/dhp/broker/oa/matchers/simple/EnrichMissingAbstract.java

32 lines
870 B
Java
Raw Normal View History

2020-05-08 16:49:47 +02:00
package eu.dnetlib.dhp.broker.oa.matchers.simple;
2020-05-13 12:00:27 +02:00
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
2020-05-13 12:00:27 +02:00
import eu.dnetlib.dhp.broker.model.Topic;
import eu.dnetlib.dhp.broker.oa.matchers.UpdateMatcher;
2020-06-11 11:25:18 +02:00
import eu.dnetlib.dhp.broker.oa.util.aggregators.withRels.ResultWithRelations;
2020-06-11 11:25:18 +02:00
public class EnrichMissingAbstract extends UpdateMatcher<String> {
2020-05-13 12:00:27 +02:00
public EnrichMissingAbstract() {
2020-06-12 09:47:55 +02:00
super(false,
s -> Topic.ENRICH_MISSING_ABSTRACT,
(p, s) -> p.getAbstracts().add(s),
s -> s);
}
@Override
2020-06-12 09:47:55 +02:00
protected List<String> findDifferences(final ResultWithRelations source,
final ResultWithRelations target) {
2020-06-11 11:25:18 +02:00
if (isMissing(target.getResult().getDescription()) && !isMissing(source.getResult().getDescription())) {
2020-06-10 12:11:16 +02:00
return Arrays
2020-06-12 09:47:55 +02:00
.asList(source.getResult().getDescription().get(0).getValue());
2020-05-13 12:00:27 +02:00
}
return new ArrayList<>();
}
}