Small bugfix for RDA Import

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

View File

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