1
0
Fork 0

[EOSC Context Tagging] add check to avoid the insertion of the context if already present

This commit is contained in:
Miriam Baglioni 2022-07-25 13:52:45 +02:00
parent d091866e48
commit 144c103b67
1 changed files with 3 additions and 2 deletions

View File

@ -117,8 +117,9 @@ public class SparkEoscBulkTag implements Serializable {
} }
private static <R extends Result> R enrich(R value, List<String> hostedByList) { private static <R extends Result> R enrich(R value, List<String> hostedByList) {
if (value.getInstance().stream().anyMatch(i -> hostedByList.contains(i.getHostedby().getKey())) || if (value.getInstance().stream().anyMatch(i -> (hostedByList.contains(i.getHostedby().getKey())) ||
(value.getEoscifguidelines() != null && value.getEoscifguidelines().size() > 0)) { (value.getEoscifguidelines() != null && value.getEoscifguidelines().size() > 0)) &&
!value.getContext().stream().anyMatch(c -> c.getId().equals("eosc"))) {
Context context = new Context(); Context context = new Context();
context.setId("eosc"); context.setId("eosc");
context.setDataInfo(Arrays.asList(OafMapperUtils context.setDataInfo(Arrays.asList(OafMapperUtils