Small bugfix for RDA Import

This commit is contained in:
George Kalampokis 2020-03-27 10:50:37 +02:00
parent c80e8bb4ba
commit 9a56d55fb7
1 changed files with 3 additions and 3 deletions

View File

@ -63,7 +63,7 @@ public class DatasetRDAMapper {
if (!qaNodes.isEmpty()) {
rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList()));
for (int i = 0; i < qaNodes.size(); i++) {
rda.setAdditionalProperty("qa" + (i + 1), qaNodes.get(i).get("id").asText());
rda.setAdditionalProperty("qaId" + (i + 1), qaNodes.get(i).get("id").asText());
}
}
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
@ -149,7 +149,7 @@ public class DatasetRDAMapper {
properties.putAll(MetadataRDAMapper.toProperties(rda.getMetadata()));
}
List <String> qaIds = rda.getAdditionalProperties().entrySet().stream().filter(entry -> entry.getKey().startsWith("qa")).map(entry -> entry.getValue().toString()).collect(Collectors.toList());
List <String> qaIds = rda.getAdditionalProperties().entrySet().stream().filter(entry -> entry.getKey().startsWith("qaId")).map(entry -> entry.getValue().toString()).collect(Collectors.toList());
for (int i = 0; i < qaIds.size(); i++) {
properties.put(qaIds.get(i), rda.getDataQualityAssurance().get(i));
}
@ -187,7 +187,7 @@ public class DatasetRDAMapper {
}
rda.getAdditionalProperties().entrySet().stream()
.filter(entry -> !entry.getKey().equals("template") && !entry.getKey().startsWith("qa") && !entry.getKey().startsWith("keyword"))
.filter(entry -> !entry.getKey().equals("template") && !entry.getKey().startsWith("qaId") && !entry.getKey().startsWith("keyword"))
.forEach(entry -> properties.put(entry.getKey(), entry.getValue()));
entity.setProperties(new ObjectMapper().writeValueAsString(properties));
} catch (Exception e) {