[SKG-IF] trying to fix exception for missing collectedfrom in instance
This commit is contained in:
parent
233aa9ed82
commit
c2ecfdd6cb
|
@ -274,9 +274,9 @@ public class DumpResearchProduct implements Serializable {
|
||||||
.mapGroups((MapGroupsFunction<String, Tuple2<Publication, Row>, ResearchProduct>) (k, v) -> {
|
.mapGroups((MapGroupsFunction<String, Tuple2<Publication, Row>, ResearchProduct>) (k, v) -> {
|
||||||
ArrayList<String> journalHbIds = new ArrayList<>();
|
ArrayList<String> journalHbIds = new ArrayList<>();
|
||||||
Tuple2<Publication, Row> first = v.next();
|
Tuple2<Publication, Row> first = v.next();
|
||||||
if (Optional.ofNullable(first._2()).isPresent())
|
addJournalHostedbyId(first, journalHbIds);
|
||||||
journalHbIds.add(first._2().getAs("journalHostedBy"));
|
while (v.hasNext())
|
||||||
v.forEachRemaining(value -> journalHbIds.add(value._2().getAs("journalHostedBy")));
|
addJournalHostedbyId(v.next(), journalHbIds);
|
||||||
Publication p = first._1();
|
Publication p = first._1();
|
||||||
ResearchProduct rp = ResultMapper.map(p);
|
ResearchProduct rp = ResultMapper.map(p);
|
||||||
rp
|
rp
|
||||||
|
@ -295,6 +295,11 @@ public class DumpResearchProduct implements Serializable {
|
||||||
.json(workingDir + "products" + e.name() + "/temp_researchProduct");
|
.json(workingDir + "products" + e.name() + "/temp_researchProduct");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void addJournalHostedbyId(Tuple2<Publication, Row> next, ArrayList<String> journalHbIds) {
|
||||||
|
if (Optional.ofNullable(next._2()).isPresent())
|
||||||
|
journalHbIds.add(next._2().getAs("jopurnalHostedBy"));
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static <R extends Result> Manifestation getManifestation(Instance i, ArrayList<String> journalHbIds, R p,
|
private static <R extends Result> Manifestation getManifestation(Instance i, ArrayList<String> journalHbIds, R p,
|
||||||
List<MasterDuplicate> eoscDatasourceIdMap) {
|
List<MasterDuplicate> eoscDatasourceIdMap) {
|
||||||
|
@ -347,12 +352,23 @@ public class DumpResearchProduct implements Serializable {
|
||||||
List<MasterDuplicate> eoscDsIds = eoscDatasourceIdMap
|
List<MasterDuplicate> eoscDsIds = eoscDatasourceIdMap
|
||||||
.stream()
|
.stream()
|
||||||
.filter(
|
.filter(
|
||||||
dm -> dm
|
dm -> Optional
|
||||||
.getGraphId()
|
.ofNullable(i.getHostedby())
|
||||||
.equals(i.getHostedby().getKey()) ||
|
.map(
|
||||||
dm
|
hb -> Optional
|
||||||
.getGraphId()
|
.ofNullable(hb.getKey())
|
||||||
.equals(i.getCollectedfrom().getKey()))
|
.map(key -> key.equalsIgnoreCase(dm.getGraphId()))
|
||||||
|
.orElse(false))
|
||||||
|
.orElse(false)
|
||||||
|
||
|
||||||
|
Optional
|
||||||
|
.ofNullable(i.getCollectedfrom())
|
||||||
|
.map(
|
||||||
|
cf -> Optional
|
||||||
|
.ofNullable(cf.getKey())
|
||||||
|
.map(key -> key.equalsIgnoreCase(dm.getGraphId()))
|
||||||
|
.orElse(false))
|
||||||
|
.orElse(false))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (eoscDsIds.size() > 0) {
|
if (eoscDsIds.size() > 0) {
|
||||||
|
|
Loading…
Reference in New Issue