[EOSC Context Tagging] refactoring

This commit is contained in:
Miriam Baglioni 2022-07-25 14:16:45 +02:00
parent 144c103b67
commit 0172bab251
1 changed files with 17 additions and 8 deletions

View File

@ -117,12 +117,21 @@ 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
(value.getEoscifguidelines() != null && value.getEoscifguidelines().size() > 0)) && .getInstance()
.stream()
.anyMatch(
i -> (hostedByList.contains(i.getHostedby().getKey())) ||
(value.getEoscifguidelines() != null && value.getEoscifguidelines().size() > 0))
&&
!value.getContext().stream().anyMatch(c -> c.getId().equals("eosc"))) { !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
.dataInfo( .dataInfo(
false, BULKTAG_DATA_INFO_TYPE, true, false, false, BULKTAG_DATA_INFO_TYPE, true, false,
OafMapperUtils OafMapperUtils