formatting

This commit is contained in:
Miriam Baglioni 2020-10-30 14:11:40 +01:00
parent 10d8bbada8
commit 5f4de9a962
1 changed files with 14 additions and 9 deletions

View File

@ -8,7 +8,6 @@ import java.io.StringReader;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.oaf.H2020Programme;
import org.apache.spark.SparkConf; import org.apache.spark.SparkConf;
import org.apache.spark.api.java.function.MapFunction; import org.apache.spark.api.java.function.MapFunction;
import org.apache.spark.sql.Encoders; import org.apache.spark.sql.Encoders;
@ -27,6 +26,7 @@ import eu.dnetlib.dhp.schema.dump.oaf.graph.*;
import eu.dnetlib.dhp.schema.dump.oaf.graph.Funder; import eu.dnetlib.dhp.schema.dump.oaf.graph.Funder;
import eu.dnetlib.dhp.schema.dump.oaf.graph.Project; import eu.dnetlib.dhp.schema.dump.oaf.graph.Project;
import eu.dnetlib.dhp.schema.oaf.Field; import eu.dnetlib.dhp.schema.oaf.Field;
import eu.dnetlib.dhp.schema.oaf.H2020Programme;
import eu.dnetlib.dhp.schema.oaf.Journal; import eu.dnetlib.dhp.schema.oaf.Journal;
import eu.dnetlib.dhp.schema.oaf.OafEntity; import eu.dnetlib.dhp.schema.oaf.OafEntity;
@ -379,14 +379,19 @@ public class DumpGraphEntities implements Serializable {
} }
} }
project.setH2020programme( project
Optional.ofNullable(p.getH2020classification()) .setH2020programme(
.map(classification -> classification Optional
.stream() .ofNullable(p.getH2020classification())
.map(c -> Programme.newInstance(c.getH2020Programme().getCode(), c.getH2020Programme().getDescription())).collect(Collectors.toList())) .map(
.orElse(new ArrayList<>())); classification -> classification
.stream()
.map(
c -> Programme
.newInstance(
c.getH2020Programme().getCode(), c.getH2020Programme().getDescription()))
.collect(Collectors.toList()))
.orElse(new ArrayList<>()));
Optional<List<Field<String>>> ofundTree = Optional Optional<List<Field<String>>> ofundTree = Optional
.ofNullable(p.getFundingtree()); .ofNullable(p.getFundingtree());