2020-05-21 16:47:53 +02:00
|
|
|
|
2020-06-04 17:10:43 +02:00
|
|
|
package eu.dnetlib.dhp.broker.oa.matchers.relatedSoftware;
|
2020-05-21 16:47:53 +02:00
|
|
|
|
2020-06-16 12:34:13 +02:00
|
|
|
import java.util.ArrayList;
|
2020-05-21 16:47:53 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2020-06-22 08:51:31 +02:00
|
|
|
import eu.dnetlib.broker.objects.OaBrokerMainEntity;
|
|
|
|
import eu.dnetlib.broker.objects.OaBrokerRelatedSoftware;
|
2020-05-21 16:47:53 +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-21 16:47:53 +02:00
|
|
|
|
|
|
|
public class EnrichMissingSoftware
|
2020-06-22 08:51:31 +02:00
|
|
|
extends UpdateMatcher<OaBrokerRelatedSoftware> {
|
2020-05-21 16:47:53 +02:00
|
|
|
|
|
|
|
public EnrichMissingSoftware() {
|
2020-06-26 11:20:45 +02:00
|
|
|
super(10,
|
2020-06-12 09:47:55 +02:00
|
|
|
s -> Topic.ENRICH_MISSING_SOFTWARE,
|
|
|
|
(p, s) -> p.getSoftwares().add(s),
|
2020-06-25 09:28:13 +02:00
|
|
|
s -> s.getOpenaireId());
|
2020-05-21 16:47:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-06-22 08:51:31 +02:00
|
|
|
protected List<OaBrokerRelatedSoftware> findDifferences(
|
|
|
|
final OaBrokerMainEntity source,
|
|
|
|
final OaBrokerMainEntity target) {
|
2020-06-04 17:10:43 +02:00
|
|
|
|
2020-06-16 12:34:13 +02:00
|
|
|
if (target.getSoftwares().isEmpty()) {
|
|
|
|
return source.getSoftwares();
|
2020-06-04 17:10:43 +02:00
|
|
|
} else {
|
2020-06-16 12:34:13 +02:00
|
|
|
return new ArrayList<>();
|
2020-06-04 17:10:43 +02:00
|
|
|
}
|
2020-05-21 16:47:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|