Even more fixes for RDA import

This commit is contained in:
George Kalampokis 2020-05-29 14:42:21 +03:00
parent 644976be29
commit 4d91f0c7af
4 changed files with 23 additions and 16 deletions

View File

@ -7,15 +7,8 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.*;
/**
@ -24,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
*
*
*/
@JsonIgnoreProperties(value = { "schema" })
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"contact",

View File

@ -160,7 +160,7 @@ public class DatasetRDAMapper {
}
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language");
if (!languageNodes.isEmpty()) {
if (!languageNodes.isEmpty() && rda.getLanguage() != null) {
properties.put(languageNodes.get(0).get("id").asText(), rda.getLanguage().value());
}

View File

@ -145,23 +145,34 @@ public class DistributionRDAMapper {
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
break;
case DOWNLOAD_URL:
if (rda.getDownloadUrl() != null) {
properties.put(distributionNode.get("id").asText(), rda.getDownloadUrl().toString());
}
break;
case DATA_ACCESS:
properties.put(distributionNode.get("id").asText(), rda.getDataAccess().value());
break;
case BYTE_SIZE:
if (rda.getByteSize() != null) {
properties.put(distributionNode.get("id").asText(), rda.getByteSize().toString());
}
break;
case FORMAT:
if (rda.getFormat() != null && !rda.getFormat().isEmpty()) {
properties.put(distributionNode.get("id").asText(), rda.getFormat().get(0));
}
break;
case LICENSE:
if (rda.getLicense() != null && !rda.getLicense().isEmpty()) {
properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense().get(0), root));
}
break;
case HOST:
if (rda.getHost() != null) {
properties.putAll(HostRDAMapper.toProperties(rda.getHost()));
}
break;
}
}
}
}

View File

@ -72,7 +72,9 @@ public class LicenseRDAMapper {
if (licenseNode.get("rdaProperty").asText().endsWith(licenceProperty.getName())) {
switch (licenceProperty) {
case LICENSE_REF:
if (rda.getLicenseRef() != null) {
properties.put(licenseNode.get("id").asText(), rda.getLicenseRef().toString());
}
break;
case START_DATE:
properties.put(licenseNode.get("id").asText(), rda.getStartDate());