added code to handle cases where the funding tree is not existing
This commit is contained in:
parent
5d3012eeb4
commit
d2374e3b9e
|
@ -122,26 +122,31 @@ public class SparkPrepareResultProject implements Serializable {
|
||||||
|
|
||||||
private static Project getProject(eu.dnetlib.dhp.schema.oaf.Project op) {
|
private static Project getProject(eu.dnetlib.dhp.schema.oaf.Project op) {
|
||||||
Project p = Project
|
Project p = Project
|
||||||
.newInstance(
|
.newInstance(
|
||||||
op.getId(),
|
op.getId(),
|
||||||
op.getCode().getValue(),
|
op.getCode().getValue(),
|
||||||
Optional
|
Optional
|
||||||
.ofNullable(op.getAcronym())
|
.ofNullable(op.getAcronym())
|
||||||
.map(a -> a.getValue())
|
.map(a -> a.getValue())
|
||||||
.orElse(null),
|
.orElse(null),
|
||||||
Optional
|
Optional
|
||||||
.ofNullable(op.getTitle())
|
.ofNullable(op.getTitle())
|
||||||
.map(v -> v.getValue())
|
.map(v -> v.getValue())
|
||||||
.orElse(null),
|
.orElse(null),
|
||||||
Optional
|
Optional
|
||||||
.ofNullable(op.getFundingtree())
|
.ofNullable(op.getFundingtree())
|
||||||
.map(
|
.map(value -> {
|
||||||
value -> value
|
List<Funder> tmp = value
|
||||||
.stream()
|
.stream()
|
||||||
.map(ft -> getFunder(ft.getValue()))
|
.map(ft -> getFunder(ft.getValue()))
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList());
|
||||||
.get(0))
|
if (tmp.size() > 0) {
|
||||||
.orElse(null));
|
return tmp.get(0);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.orElse(null));
|
||||||
|
|
||||||
Optional<DataInfo> di = Optional.ofNullable(op.getDataInfo());
|
Optional<DataInfo> di = Optional.ofNullable(op.getDataInfo());
|
||||||
Provenance provenance = new Provenance();
|
Provenance provenance = new Provenance();
|
||||||
|
|
Loading…
Reference in New Issue