Even more fixes for RDA import
This commit is contained in:
parent
644976be29
commit
4d91f0c7af
|
@ -7,15 +7,8 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnoreProperties(value = { "schema" })
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@JsonPropertyOrder({
|
@JsonPropertyOrder({
|
||||||
"contact",
|
"contact",
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class DatasetRDAMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language");
|
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());
|
properties.put(languageNodes.get(0).get("id").asText(), rda.getLanguage().value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,23 +145,34 @@ public class DistributionRDAMapper {
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
|
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
|
||||||
break;
|
break;
|
||||||
case DOWNLOAD_URL:
|
case DOWNLOAD_URL:
|
||||||
|
if (rda.getDownloadUrl() != null) {
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getDownloadUrl().toString());
|
properties.put(distributionNode.get("id").asText(), rda.getDownloadUrl().toString());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DATA_ACCESS:
|
case DATA_ACCESS:
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getDataAccess().value());
|
properties.put(distributionNode.get("id").asText(), rda.getDataAccess().value());
|
||||||
break;
|
break;
|
||||||
case BYTE_SIZE:
|
case BYTE_SIZE:
|
||||||
|
if (rda.getByteSize() != null) {
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getByteSize().toString());
|
properties.put(distributionNode.get("id").asText(), rda.getByteSize().toString());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FORMAT:
|
case FORMAT:
|
||||||
|
if (rda.getFormat() != null && !rda.getFormat().isEmpty()) {
|
||||||
properties.put(distributionNode.get("id").asText(), rda.getFormat().get(0));
|
properties.put(distributionNode.get("id").asText(), rda.getFormat().get(0));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case LICENSE:
|
case LICENSE:
|
||||||
|
if (rda.getLicense() != null && !rda.getLicense().isEmpty()) {
|
||||||
properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense().get(0), root));
|
properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense().get(0), root));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case HOST:
|
case HOST:
|
||||||
|
if (rda.getHost() != null) {
|
||||||
properties.putAll(HostRDAMapper.toProperties(rda.getHost()));
|
properties.putAll(HostRDAMapper.toProperties(rda.getHost()));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,9 @@ public class LicenseRDAMapper {
|
||||||
if (licenseNode.get("rdaProperty").asText().endsWith(licenceProperty.getName())) {
|
if (licenseNode.get("rdaProperty").asText().endsWith(licenceProperty.getName())) {
|
||||||
switch (licenceProperty) {
|
switch (licenceProperty) {
|
||||||
case LICENSE_REF:
|
case LICENSE_REF:
|
||||||
|
if (rda.getLicenseRef() != null) {
|
||||||
properties.put(licenseNode.get("id").asText(), rda.getLicenseRef().toString());
|
properties.put(licenseNode.get("id").asText(), rda.getLicenseRef().toString());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case START_DATE:
|
case START_DATE:
|
||||||
properties.put(licenseNode.get("id").asText(), rda.getStartDate());
|
properties.put(licenseNode.get("id").asText(), rda.getStartDate());
|
||||||
|
|
Loading…
Reference in New Issue