Improve RDA mapping (contributed by M.Aldo)
This commit is contained in:
parent
42c5dbb3b2
commit
316d0903c8
|
@ -89,7 +89,11 @@ public class DatasetRDAMapper {
|
|||
for (int i = 0; i < qaNodes.size(); i++) {
|
||||
rda.setAdditionalProperty("qaId" + (i + 1), qaNodes.get(i).get("id").asText());
|
||||
}*/
|
||||
rda.setDataQualityAssurance(Collections.singletonList(qaNodes.get(0).get("value").asText()));
|
||||
List<String> qaList = new ArrayList<>();
|
||||
for(JsonNode qaNode: qaNodes){
|
||||
qaList.add(qaNode.get("value").asText());
|
||||
}
|
||||
rda.setDataQualityAssurance(qaList);
|
||||
}
|
||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
|
||||
if (!preservationNodes.isEmpty()) {
|
||||
|
|
|
@ -20,10 +20,25 @@ public class DistributionRDAMapper {
|
|||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaValue = node.get("value").asText();
|
||||
Distribution rda = getRelative(rdaMap, node.get("numbering").asText());
|
||||
String key = node.get("numbering").asText();
|
||||
if(!key.contains("mult")){
|
||||
key = "0";
|
||||
}
|
||||
else{
|
||||
key = "" + key.charAt(4);
|
||||
}
|
||||
Distribution rda;
|
||||
if(rdaMap.containsKey(key)){
|
||||
rda = rdaMap.get(key);
|
||||
}
|
||||
else {
|
||||
rda = new Distribution();
|
||||
rdaMap.put(key, rda);
|
||||
}
|
||||
/* Distribution rda = getRelative(rdaMap, node.get("numbering").asText());
|
||||
if (!rdaMap.containsValue(rda)) {
|
||||
rdaMap.put(node.get("numbering").asText(), rda);
|
||||
}
|
||||
}*/
|
||||
for (ExportPropertyName exportPropertyName : ExportPropertyName.values()) {
|
||||
if (rdaProperty.contains(exportPropertyName.getName())) {
|
||||
switch (exportPropertyName) {
|
||||
|
@ -31,17 +46,19 @@ public class DistributionRDAMapper {
|
|||
rda.setAccessUrl(rdaValue);
|
||||
rda.setAdditionalProperty(ImportPropertyName.ACCESS_URL.getName(), node.get("id").asText());
|
||||
break;
|
||||
case AVAILABLE_UTIL:
|
||||
case AVAILABLE_UNTIL:
|
||||
rda.setAvailableUntil(rdaValue);
|
||||
rda.setAdditionalProperty(ImportPropertyName.AVAILABLE_UTIL.getName(), node.get("id").asText());
|
||||
rda.setAdditionalProperty(ImportPropertyName.AVAILABLE_UNTIL.getName(), node.get("id").asText());
|
||||
break;
|
||||
case DOWNLOAD_URL:
|
||||
rda.setDownloadUrl(URI.create(rdaValue));
|
||||
rda.setAdditionalProperty(ImportPropertyName.DOWNLOAD_URL.getName(), node.get("id").asText());
|
||||
break;
|
||||
case DESCRIPTION:
|
||||
rda.setDescription(rdaValue);
|
||||
rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText());
|
||||
if(!rdaProperty.contains("host")) {
|
||||
rda.setDescription(rdaValue);
|
||||
rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText());
|
||||
}
|
||||
break;
|
||||
case DATA_ACCESS:
|
||||
rda.setDataAccess(Distribution.DataAccess.fromValue(rdaValue));
|
||||
|
@ -60,8 +77,10 @@ public class DistributionRDAMapper {
|
|||
rda.setAdditionalProperty(ImportPropertyName.FORMAT.getName(), node.get("id").asText());
|
||||
break;
|
||||
case TITLE:
|
||||
rda.setTitle(rdaValue);
|
||||
rda.setAdditionalProperty(ImportPropertyName.TITLE.getName(), node.get("id").asText());
|
||||
if(!rdaProperty.contains("host")) {
|
||||
rda.setTitle(rdaValue);
|
||||
rda.setAdditionalProperty(ImportPropertyName.TITLE.getName(), node.get("id").asText());
|
||||
}
|
||||
break;
|
||||
case HOST:
|
||||
rda.setHost(HostRDAMapper.toRDA(nodes, node.get("numbering").asText()));
|
||||
|
@ -103,7 +122,7 @@ public class DistributionRDAMapper {
|
|||
case DOWNLOAD_URL:
|
||||
properties.put(entry.getValue().toString(), rda.getDownloadUrl().toString());
|
||||
break;
|
||||
case AVAILABLE_UTIL:
|
||||
case AVAILABLE_UNTIL:
|
||||
properties.put(entry.getValue().toString(), rda.getAvailableUntil());
|
||||
break;
|
||||
}
|
||||
|
@ -141,7 +160,7 @@ public class DistributionRDAMapper {
|
|||
case TITLE:
|
||||
properties.put(distributionNode.get("id").asText(), rda.getTitle());
|
||||
break;
|
||||
case AVAILABLE_UTIL:
|
||||
case AVAILABLE_UNTIL:
|
||||
properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil());
|
||||
break;
|
||||
case DOWNLOAD_URL:
|
||||
|
@ -197,7 +216,7 @@ public class DistributionRDAMapper {
|
|||
case TITLE:
|
||||
rda.setTitle(rdaValue);
|
||||
break;
|
||||
case AVAILABLE_UTIL:
|
||||
case AVAILABLE_UNTIL:
|
||||
rda.setAvailableUntil(rdaValue);
|
||||
break;
|
||||
case DOWNLOAD_URL:
|
||||
|
@ -265,7 +284,7 @@ public class DistributionRDAMapper {
|
|||
|
||||
private enum ExportPropertyName {
|
||||
ACCESS_URL("access_url"),
|
||||
AVAILABLE_UTIL("available_util"),
|
||||
AVAILABLE_UNTIL("available_until"),
|
||||
BYTE_SIZE("byte_size"),
|
||||
DATA_ACCESS("data_access"),
|
||||
DESCRIPTION("description"),
|
||||
|
@ -288,7 +307,7 @@ public class DistributionRDAMapper {
|
|||
|
||||
private enum ImportPropertyName {
|
||||
ACCESS_URL("accessurlId"),
|
||||
AVAILABLE_UTIL("availableUtilId"),
|
||||
AVAILABLE_UNTIL("availableUtilId"),
|
||||
BYTE_SIZE("byteSizeId"),
|
||||
DATA_ACCESS("dataAccessId"),
|
||||
DESCRIPTION("descriptionId"),
|
||||
|
|
|
@ -39,6 +39,9 @@ public class HostRDAMapper {
|
|||
rda.setBackupType(rdaValue);
|
||||
break;
|
||||
case CERTIFIED_WITH:
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
break;
|
||||
}
|
||||
rda.setCertifiedWith(Host.CertifiedWith.fromValue(rdaValue));
|
||||
rda.setAdditionalProperty(ImportPropertyName.CERTIFIED_WITH.getName(), node.get("id").asText());
|
||||
break;
|
||||
|
@ -47,6 +50,9 @@ public class HostRDAMapper {
|
|||
rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText());
|
||||
break;
|
||||
case GEO_LOCATION:
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
break;
|
||||
}
|
||||
rda.setGeoLocation(Host.GeoLocation.fromValue(rdaValue));
|
||||
rda.setAdditionalProperty(ImportPropertyName.GEO_LOCATION.getName(), node.get("id").asText());
|
||||
break;
|
||||
|
@ -59,6 +65,9 @@ public class HostRDAMapper {
|
|||
rda.setAdditionalProperty(ImportPropertyName.STORAGE_TYPE.getName(), node.get("id").asText());
|
||||
break;
|
||||
case SUPPORT_VERSIONING:
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
break;
|
||||
}
|
||||
rda.setSupportVersioning(Host.SupportVersioning.fromValue(rdaValue));
|
||||
rda.setAdditionalProperty(ImportPropertyName.SUPPORT_VERSIONING.getName(), node.get("id").asText());
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue