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
|
|
|
|
2020-05-13 12:00:27 +02:00
|
|
|
import java.util.ArrayList;
|
2020-05-07 12:31:26 +02:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
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-06-11 11:25:18 +02:00
|
|
|
import eu.dnetlib.dhp.broker.oa.util.aggregators.withRels.ResultWithRelations;
|
2020-05-07 12:31:26 +02:00
|
|
|
|
2020-06-11 11:25:18 +02:00
|
|
|
public class EnrichMissingAbstract extends UpdateMatcher<String> {
|
2020-05-07 12:31:26 +02:00
|
|
|
|
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);
|
2020-05-07 12:31:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@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<>();
|
2020-05-07 12:31:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|