Refactors RDA export model.
This commit is contained in:
parent
247aac72fe
commit
3dd520fea3
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class ContactIdRDAExportModel {
|
|
||||||
private String contact_id;
|
|
||||||
private String contact_id_type;
|
|
||||||
|
|
||||||
public String getContact_id() {
|
|
||||||
return contact_id;
|
|
||||||
}
|
|
||||||
public void setContact_id(String contact_id) {
|
|
||||||
this.contact_id = contact_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContact_id_type() {
|
|
||||||
return contact_id_type;
|
|
||||||
}
|
|
||||||
public void setContact_id_type(String contact_id_type) {
|
|
||||||
this.contact_id_type = contact_id_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContactIdRDAExportModel(String contact_id, String contact_id_type) {
|
|
||||||
this.contact_id = contact_id;
|
|
||||||
this.contact_id_type = contact_id_type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,15 +3,15 @@ package eu.eudat.models.data.rda;
|
||||||
import eu.eudat.data.entities.UserInfo;
|
import eu.eudat.data.entities.UserInfo;
|
||||||
|
|
||||||
public class ContactRDAExportModel {
|
public class ContactRDAExportModel {
|
||||||
private String mail;
|
private String mbox;
|
||||||
private String name;
|
private String name;
|
||||||
private ContactIdRDAExportModel contact_id;
|
private IdRDAExportModel contact_id;
|
||||||
|
|
||||||
public String getMail() {
|
public String getMbox() {
|
||||||
return mail;
|
return mbox;
|
||||||
}
|
}
|
||||||
public void setMail(String mail) {
|
public void setMbox(String mbox) {
|
||||||
this.mail = mail;
|
this.mbox = mbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -21,24 +21,24 @@ public class ContactRDAExportModel {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContactIdRDAExportModel getContact_id() {
|
public IdRDAExportModel getContact_id() {
|
||||||
return contact_id;
|
return contact_id;
|
||||||
}
|
}
|
||||||
public void setContact_id(ContactIdRDAExportModel contact_id) {
|
public void setContact_id(IdRDAExportModel contact_id) {
|
||||||
this.contact_id = contact_id;
|
this.contact_id = contact_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ContactRDAExportModel fromDataModel(UserInfo entity) {
|
public ContactRDAExportModel fromDataModel(UserInfo entity) {
|
||||||
this.mail = entity.getEmail();
|
ContactRDAExportModel contact = new ContactRDAExportModel();
|
||||||
this.name = entity.getName();
|
contact.mbox = entity.getEmail();
|
||||||
|
contact.name = entity.getName();
|
||||||
// TODO: we should use a contact_id and not our UUID.
|
// TODO: we should use a contact_id and not our UUID.
|
||||||
if (!entity.getId().toString().isEmpty()) {
|
if (!entity.getId().toString().isEmpty()) {
|
||||||
this.contact_id = new ContactIdRDAExportModel(entity.getId().toString(), "argos_internal");
|
contact.contact_id = new IdRDAExportModel(entity.getId().toString(), "other");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.contact_id = null;
|
contact.contact_id = null;
|
||||||
}
|
}
|
||||||
return this;
|
return contact;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DatasetDistributionRDAExportModel {
|
||||||
|
private String access_url;
|
||||||
|
private String available_till;
|
||||||
|
private int byte_size;
|
||||||
|
private String data_access; // Allowed values: open / shared / closed
|
||||||
|
private String description;
|
||||||
|
private String download_url;
|
||||||
|
private List<String> format; // Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format
|
||||||
|
private HostRDAExportModel host;
|
||||||
|
private List<LicenseRDAExportModel> license;
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public String getAccess_url() {
|
||||||
|
return access_url;
|
||||||
|
}
|
||||||
|
public void setAccess_url(String access_url) {
|
||||||
|
this.access_url = access_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvailable_till() {
|
||||||
|
return available_till;
|
||||||
|
}
|
||||||
|
public void setAvailable_till(String available_till) {
|
||||||
|
this.available_till = available_till;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getByte_size() {
|
||||||
|
return byte_size;
|
||||||
|
}
|
||||||
|
public void setByte_size(int byte_size) {
|
||||||
|
this.byte_size = byte_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getData_access() {
|
||||||
|
return data_access;
|
||||||
|
}
|
||||||
|
public void setData_access(String data_access) {
|
||||||
|
this.data_access = data_access;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDownload_url() {
|
||||||
|
return download_url;
|
||||||
|
}
|
||||||
|
public void setDownload_url(String download_url) {
|
||||||
|
this.download_url = download_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getFormat() {
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
public void setFormat(List<String> format) {
|
||||||
|
this.format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HostRDAExportModel getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
public void setHost(HostRDAExportModel host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LicenseRDAExportModel> getLicense() {
|
||||||
|
return license;
|
||||||
|
}
|
||||||
|
public void setLicense(List<LicenseRDAExportModel> license) {
|
||||||
|
this.license = license;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasetDistributionRDAExportModel fromDataModel(String key, Object value) {
|
||||||
|
DatasetDistributionRDAExportModel distributionModel = new DatasetDistributionRDAExportModel();
|
||||||
|
switch (key) {
|
||||||
|
case "access_url":
|
||||||
|
distributionModel.setAccess_url(value.toString());
|
||||||
|
break;
|
||||||
|
case "available_till":
|
||||||
|
distributionModel.setAvailable_till(value.toString());
|
||||||
|
break;
|
||||||
|
case "byte_size":
|
||||||
|
try { distributionModel.setByte_size(Integer.parseInt(value.toString())); }
|
||||||
|
catch (NumberFormatException e) { e.printStackTrace(); }
|
||||||
|
break;
|
||||||
|
case "data_access":
|
||||||
|
distributionModel.setData_access(value.toString());
|
||||||
|
break;
|
||||||
|
case "description":
|
||||||
|
distributionModel.setDescription(value.toString());
|
||||||
|
break;
|
||||||
|
case "download_url":
|
||||||
|
distributionModel.setDownload_url(value.toString());
|
||||||
|
break;
|
||||||
|
case "format":
|
||||||
|
break;
|
||||||
|
case "host":
|
||||||
|
break;
|
||||||
|
case "license":
|
||||||
|
break;
|
||||||
|
case "title":
|
||||||
|
distributionModel.setTitle(value.toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return distributionModel;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class DatasetIdRDAExportModel {
|
|
||||||
private String dataset_id;
|
|
||||||
private String dataset_id_type;
|
|
||||||
|
|
||||||
public String getDataset_id() {
|
|
||||||
return dataset_id;
|
|
||||||
}
|
|
||||||
public void setDataset_id(String dataset_id) {
|
|
||||||
this.dataset_id = dataset_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataset_id_type() {
|
|
||||||
return dataset_id_type;
|
|
||||||
}
|
|
||||||
public void setDataset_id_type(String dataset_id_type) {
|
|
||||||
this.dataset_id_type = dataset_id_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
DatasetIdRDAExportModel(String dataset_id, String dataset_id_type) {
|
|
||||||
this.dataset_id = dataset_id;
|
|
||||||
this.dataset_id_type = dataset_id_type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@ package eu.eudat.models.data.rda;
|
||||||
public class DatasetMetadataRDAExportModel {
|
public class DatasetMetadataRDAExportModel {
|
||||||
private String description; // Not mandatory.
|
private String description; // Not mandatory.
|
||||||
private String language;
|
private String language;
|
||||||
private DatasetMetadataIdRDAExportModel metadata_id;
|
private IdRDAExportModel metadata_standard_id;
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
|
@ -19,17 +19,17 @@ public class DatasetMetadataRDAExportModel {
|
||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasetMetadataIdRDAExportModel getMetadata_id() {
|
public IdRDAExportModel getMetadata_standard_id() {
|
||||||
return metadata_id;
|
return metadata_standard_id;
|
||||||
}
|
}
|
||||||
public void setMetadata_id(DatasetMetadataIdRDAExportModel metadata_id) {
|
public void setMetadata_standard_id(IdRDAExportModel metadata_standard_id) {
|
||||||
this.metadata_id = metadata_id;
|
this.metadata_standard_id = metadata_standard_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasetMetadataRDAExportModel fromDataModel(String key, Object value) {
|
public DatasetMetadataRDAExportModel fromDataModel(String key, Object value) {
|
||||||
DatasetMetadataRDAExportModel metadataRDAExportModel = new DatasetMetadataRDAExportModel();
|
DatasetMetadataRDAExportModel metadataRDAExportModel = new DatasetMetadataRDAExportModel();
|
||||||
if (key.contains("metadata_id"))
|
if (key.contains("metadata_standard_id"))
|
||||||
metadataRDAExportModel.setMetadata_id(new DatasetMetadataIdRDAExportModel().fromDataModel(key, value));
|
metadataRDAExportModel.setMetadata_standard_id(new IdRDAExportModel(value.toString(), value.toString()));
|
||||||
else if (key.contains("language"))
|
else if (key.contains("language"))
|
||||||
metadataRDAExportModel.setLanguage(value.toString());
|
metadataRDAExportModel.setLanguage(value.toString());
|
||||||
else if (key.contains("description"))
|
else if (key.contains("description"))
|
||||||
|
|
|
@ -6,31 +6,48 @@ import eu.eudat.data.entities.Dataset;
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||||
import org.apache.commons.collections4.MultiValuedMap;
|
import org.apache.commons.collections4.MultiValuedMap;
|
||||||
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
|
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import javax.xml.xpath.*;
|
import javax.xml.xpath.*;
|
||||||
|
import java.text.DateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class DatasetRDAExportModel {
|
public class DatasetRDAExportModel {
|
||||||
|
|
||||||
private static final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
private static final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
private MultiValuedMap<String, String> rdaToValueMap;
|
||||||
|
|
||||||
private DatasetIdRDAExportModel dataset_id;
|
|
||||||
private String description;
|
|
||||||
private Date issued; // Created Date, could also use finalized one.
|
|
||||||
private String language;
|
|
||||||
private String title;
|
|
||||||
private String sensitive_data;
|
|
||||||
private String data_quality_assurance;
|
private String data_quality_assurance;
|
||||||
|
private IdRDAExportModel dataset_id;
|
||||||
|
private String description;
|
||||||
|
private List<DatasetDistributionRDAExportModel> distribution;
|
||||||
|
private String issued; // Created Date, could also use finalized one.
|
||||||
|
private List<String> keyword;
|
||||||
|
private String language;
|
||||||
private List<DatasetMetadataRDAExportModel> metadata;
|
private List<DatasetMetadataRDAExportModel> metadata;
|
||||||
|
private String personal_data; // Allowed Values: yes no unknown.
|
||||||
|
private String preservation_statement;
|
||||||
|
private List<DatasetSecurityAndPrivacyRDAExportModel> security_and_privacy;
|
||||||
|
private String sensitive_data; // Allowed Values: yes no unknown.
|
||||||
|
private List<DatasetTechnicalResourceRDAExportModel> technical_resource;
|
||||||
|
private String title;
|
||||||
|
private String type; // Type according to: http://vocabularies.coar-repositories.org/pubby/resource_type.html
|
||||||
|
|
||||||
public DatasetIdRDAExportModel getDataset_id() {
|
public String getData_quality_assurance() {
|
||||||
|
return data_quality_assurance;
|
||||||
|
}
|
||||||
|
public void setData_quality_assurance(String data_quality_assurance) {
|
||||||
|
this.data_quality_assurance = data_quality_assurance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IdRDAExportModel getDataset_id() {
|
||||||
return dataset_id;
|
return dataset_id;
|
||||||
}
|
}
|
||||||
public void setDataset_id(DatasetIdRDAExportModel dataset_id) {
|
public void setDataset_id(IdRDAExportModel dataset_id) {
|
||||||
this.dataset_id = dataset_id;
|
this.dataset_id = dataset_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,13 +58,27 @@ public class DatasetRDAExportModel {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getIssued() {
|
public List<DatasetDistributionRDAExportModel> getDistribution() {
|
||||||
|
return distribution;
|
||||||
|
}
|
||||||
|
public void setDistribution(List<DatasetDistributionRDAExportModel> distribution) {
|
||||||
|
this.distribution = distribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIssued() {
|
||||||
return issued;
|
return issued;
|
||||||
}
|
}
|
||||||
public void setIssued(Date issued) {
|
public void setIssued(String issued) {
|
||||||
this.issued = issued;
|
this.issued = issued;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getKeyword() {
|
||||||
|
return keyword;
|
||||||
|
}
|
||||||
|
public void setKeyword(List<String> keyword) {
|
||||||
|
this.keyword = keyword;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
@ -55,11 +86,32 @@ public class DatasetRDAExportModel {
|
||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public List<DatasetMetadataRDAExportModel> getMetadata() {
|
||||||
return title;
|
return metadata;
|
||||||
}
|
}
|
||||||
public void setTitle(String title) {
|
public void setMetadata(List<DatasetMetadataRDAExportModel> metadata) {
|
||||||
this.title = title;
|
this.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPersonal_data() {
|
||||||
|
return personal_data;
|
||||||
|
}
|
||||||
|
public void setPersonal_data(String personal_data) {
|
||||||
|
this.personal_data = personal_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPreservation_statement() {
|
||||||
|
return preservation_statement;
|
||||||
|
}
|
||||||
|
public void setPreservation_statement(String preservation_statement) {
|
||||||
|
this.preservation_statement = preservation_statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DatasetSecurityAndPrivacyRDAExportModel> getSecurity_and_privacy() {
|
||||||
|
return security_and_privacy;
|
||||||
|
}
|
||||||
|
public void setSecurity_and_privacy(List<DatasetSecurityAndPrivacyRDAExportModel> security_and_privacy) {
|
||||||
|
this.security_and_privacy = security_and_privacy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSensitive_data() {
|
public String getSensitive_data() {
|
||||||
|
@ -69,67 +121,45 @@ public class DatasetRDAExportModel {
|
||||||
this.sensitive_data = sensitive_data;
|
this.sensitive_data = sensitive_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getData_quality_assurance() {
|
public List<DatasetTechnicalResourceRDAExportModel> getTechnical_resource() {
|
||||||
return data_quality_assurance;
|
return technical_resource;
|
||||||
}
|
}
|
||||||
public void setData_quality_assurance(String data_quality_assurance) {
|
public void setTechnical_resource(List<DatasetTechnicalResourceRDAExportModel> technical_resource) {
|
||||||
this.data_quality_assurance = data_quality_assurance;
|
this.technical_resource = technical_resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DatasetMetadataRDAExportModel> getMetadata() {
|
public String getTitle() {
|
||||||
return metadata;
|
return title;
|
||||||
}
|
}
|
||||||
public void setMetadata(List<DatasetMetadataRDAExportModel> metadata) {
|
public void setTitle(String title) {
|
||||||
this.metadata = metadata;
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DatasetRDAExportModel fromDataModel(Dataset dataset) {
|
public DatasetRDAExportModel fromDataModel(Dataset dataset) {
|
||||||
// Parsing dataset template definition to create a map of which question of the template corresponds to the RDA common standard. Map: TemplateId -> rdaProperty
|
this.rdaToValueMap = getRdaValueMap(dataset);
|
||||||
List<String> rdaPropertiesThatExistOnDatasetTemplate = xmlNodeListFromExpression(dataset.getProfile().getDefinition(), "//rdaCommonStandard/text()");
|
List<DatasetDistributionRDAExportModel> distributions = getDatasetDistribution();
|
||||||
List<String> rdaProperties = new LinkedList<>();
|
List<DatasetMetadataRDAExportModel> datasetMetadata = getDatasetMetadata();
|
||||||
for (String item : rdaPropertiesThatExistOnDatasetTemplate) {
|
List<DatasetSecurityAndPrivacyRDAExportModel> securityAndPrivacy = getSecurityAndPrivacy();
|
||||||
item = item.replace("dataset.", "");
|
List<DatasetTechnicalResourceRDAExportModel> technicalResources = getTechnicalResource();
|
||||||
rdaProperties.add(item);
|
|
||||||
}
|
|
||||||
List<String> datasetTemplateIdsWithRdaProperties = xmlNodeListFromExpression(dataset.getProfile().getDefinition(), "//rdaCommonStandard/text()/ancestor::field/@id");
|
|
||||||
Map<String, String> templateIdsToRDAProperties = combineListsIntoOrderedMap(datasetTemplateIdsWithRdaProperties, rdaProperties);
|
|
||||||
|
|
||||||
// Parsing dataset answers from json to map. Map: TemplateId -> datasetValue
|
DatasetRDAExportModel datasetRDAExportModel = mapper.convertValue(this.rdaToValueMap, DatasetRDAExportModel.class);
|
||||||
JSONObject jObject = new JSONObject(dataset.getProperties());
|
datasetRDAExportModel.setDataset_id(new IdRDAExportModel(dataset.getId().toString(), "other"));
|
||||||
Map<String, Object> templateIdsToValues = jObject.toMap();
|
datasetRDAExportModel.setDescription(dataset.getDescription());
|
||||||
|
datasetRDAExportModel.setIssued(DateFormat.getDateInstance(DateFormat.SHORT).format(dataset.getCreated()));
|
||||||
// Map: rdaProperty -> datasetValue
|
|
||||||
MultiValuedMap<String, String> rdaToValueMap = new ArrayListValuedHashMap<>();
|
|
||||||
for (String templateId : templateIdsToRDAProperties.keySet()) {
|
|
||||||
if (templateIdsToValues.containsKey(templateId)) {
|
|
||||||
rdaToValueMap.put(templateIdsToRDAProperties.get(templateId), templateIdsToValues.get(templateId).toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates and fills a map to include metadata keys and values.
|
|
||||||
MultiValuedMap<String, String> metadataJsonMap = new ArrayListValuedHashMap<>();
|
|
||||||
for (String key : rdaToValueMap.keySet()) {
|
|
||||||
if (key.startsWith("metadata.")) {
|
|
||||||
metadataJsonMap.putAll(key.replace("metadata.", ""), rdaToValueMap.get(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Removes metadata keys from rdaToValueMap.
|
|
||||||
for (String metadataKey : metadataJsonMap.keySet()) rdaToValueMap.remove(metadataKey);
|
|
||||||
|
|
||||||
DatasetRDAExportModel datasetRDAExportModel = mapper.convertValue(rdaToValueMap, DatasetRDAExportModel.class);
|
|
||||||
datasetRDAExportModel.setTitle(dataset.getLabel());
|
|
||||||
datasetRDAExportModel.setIssued(dataset.getCreated());
|
|
||||||
datasetRDAExportModel.setLanguage("en"); // mock data;
|
datasetRDAExportModel.setLanguage("en"); // mock data;
|
||||||
datasetRDAExportModel.setDataset_id(new DatasetIdRDAExportModel(dataset.getId().toString(), "argos_internal"));
|
datasetRDAExportModel.setTitle(dataset.getLabel());
|
||||||
|
datasetRDAExportModel.setDistribution(distributions);
|
||||||
List<DatasetMetadataRDAExportModel> datasetMetadataRDAExportModels = new LinkedList<>();
|
datasetRDAExportModel.setMetadata(datasetMetadata);
|
||||||
for (String key : metadataJsonMap.keySet()) {
|
datasetRDAExportModel.setSecurity_and_privacy(securityAndPrivacy);
|
||||||
for (String value : metadataJsonMap.get(key)) {
|
datasetRDAExportModel.setTechnical_resource(technicalResources);
|
||||||
datasetMetadataRDAExportModels.add(new DatasetMetadataRDAExportModel().fromDataModel(key,value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datasetRDAExportModel.setMetadata(datasetMetadataRDAExportModels);
|
|
||||||
|
|
||||||
return datasetRDAExportModel;
|
return datasetRDAExportModel;
|
||||||
}
|
}
|
||||||
|
@ -162,4 +192,107 @@ public class DatasetRDAExportModel {
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MultiValuedMap<String, String> getRdaValueMap(Dataset dataset) {
|
||||||
|
// Parsing dataset template definition to create a map of which question of the template corresponds to the RDA common standard. Map: TemplateId -> rdaProperty
|
||||||
|
List<String> rdaPropertiesThatExistOnDatasetTemplate = xmlNodeListFromExpression(dataset.getProfile().getDefinition(), "//rdaCommonStandard/text()");
|
||||||
|
List<String> rdaProperties = new LinkedList<>();
|
||||||
|
for (String item : rdaPropertiesThatExistOnDatasetTemplate) {
|
||||||
|
item = item.replace("dataset.", "");
|
||||||
|
rdaProperties.add(item);
|
||||||
|
}
|
||||||
|
List<String> datasetTemplateIdsWithRdaProperties = xmlNodeListFromExpression(dataset.getProfile().getDefinition(), "//rdaCommonStandard/text()/ancestor::field/@id");
|
||||||
|
Map<String, String> templateIdsToRDAProperties = combineListsIntoOrderedMap(datasetTemplateIdsWithRdaProperties, rdaProperties);
|
||||||
|
|
||||||
|
// Parsing dataset answers from json to map. Map: TemplateId -> datasetValue
|
||||||
|
JSONObject jObject = new JSONObject(dataset.getProperties());
|
||||||
|
Map<String, Object> templateIdsToValues = jObject.toMap();
|
||||||
|
|
||||||
|
// Map: rdaProperty -> datasetValue
|
||||||
|
MultiValuedMap<String, String> rdaToValueMap = new ArrayListValuedHashMap<>();
|
||||||
|
for (String templateId : templateIdsToRDAProperties.keySet()) {
|
||||||
|
if (templateIdsToValues.containsKey(templateId)) {
|
||||||
|
rdaToValueMap.put(templateIdsToRDAProperties.get(templateId), templateIdsToValues.get(templateId).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rdaToValueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DatasetDistributionRDAExportModel> getDatasetDistribution() {
|
||||||
|
// Creates and fills a map to include distribution keys and values.
|
||||||
|
MultiValuedMap<String, String> distributionJsonMap = new ArrayListValuedHashMap<>();
|
||||||
|
for (String key : this.rdaToValueMap.keySet()) {
|
||||||
|
if (key.startsWith("distribution.")) {
|
||||||
|
distributionJsonMap.putAll(key.replace("distribution.", ""), this.rdaToValueMap.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Removes distribution keys from rdaToValueMap.
|
||||||
|
for (String distributionKey : distributionJsonMap.keySet()) this.rdaToValueMap.remove(distributionKey);
|
||||||
|
List<DatasetDistributionRDAExportModel> distributionModels = new LinkedList<>();
|
||||||
|
for (String key : distributionJsonMap.keySet()) {
|
||||||
|
for (String value : distributionJsonMap.get(key)) {
|
||||||
|
distributionModels.add(new DatasetDistributionRDAExportModel().fromDataModel(key, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return distributionModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DatasetMetadataRDAExportModel> getDatasetMetadata() {
|
||||||
|
// Creates and fills a map to include metadata keys and values.
|
||||||
|
MultiValuedMap<String, String> metadataJsonMap = new ArrayListValuedHashMap<>();
|
||||||
|
for (String key : this.rdaToValueMap.keySet()) {
|
||||||
|
if (key.startsWith("metadata.")) {
|
||||||
|
metadataJsonMap.putAll(key.replace("metadata.", ""), this.rdaToValueMap.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Removes metadata keys from rdaToValueMap.
|
||||||
|
for (String metadataKey : metadataJsonMap.keySet()) this.rdaToValueMap.remove(metadataKey);
|
||||||
|
List<DatasetMetadataRDAExportModel> datasetMetadataRDAExportModels = new LinkedList<>();
|
||||||
|
for (String key : metadataJsonMap.keySet()) {
|
||||||
|
for (String value : metadataJsonMap.get(key)) {
|
||||||
|
datasetMetadataRDAExportModels.add(new DatasetMetadataRDAExportModel().fromDataModel(key, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return datasetMetadataRDAExportModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DatasetSecurityAndPrivacyRDAExportModel> getSecurityAndPrivacy() {
|
||||||
|
// Creates and fills a map to include SecurityAndPrivacy keys and values.
|
||||||
|
MultiValuedMap<String, String> securityAndPrivacyJsonMap = new ArrayListValuedHashMap<>();
|
||||||
|
for (String key : this.rdaToValueMap.keySet()) {
|
||||||
|
if (key.startsWith("security_and_privacy.")) {
|
||||||
|
securityAndPrivacyJsonMap.putAll(key.replace("security_and_privacy.", ""), this.rdaToValueMap.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Removes SecurityAndPrivacy keys from rdaToValueMap.
|
||||||
|
for (String securityAndPrivacy : securityAndPrivacyJsonMap.keySet()) this.rdaToValueMap.remove(securityAndPrivacy);
|
||||||
|
List<DatasetSecurityAndPrivacyRDAExportModel> securityAndPrivacyList= new LinkedList<>();
|
||||||
|
for (String key : securityAndPrivacyJsonMap.keySet()) {
|
||||||
|
for (String value : securityAndPrivacyJsonMap.get(key)) {
|
||||||
|
securityAndPrivacyList.add(new DatasetSecurityAndPrivacyRDAExportModel().fromDataModel(key, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return securityAndPrivacyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DatasetTechnicalResourceRDAExportModel> getTechnicalResource() {
|
||||||
|
// Creates and fills a map to include Technical_Resource keys and values.
|
||||||
|
MultiValuedMap<String, String> technicalResourceJsonMap = new ArrayListValuedHashMap<>();
|
||||||
|
for (String key : this.rdaToValueMap.keySet()) {
|
||||||
|
if (key.startsWith("technical_resource.")) {
|
||||||
|
technicalResourceJsonMap.putAll(key.replace("technical_resource.", ""), this.rdaToValueMap.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Removes Technical_Resource keys from rdaToValueMap.
|
||||||
|
for (String techResource : technicalResourceJsonMap.keySet()) this.rdaToValueMap.remove(techResource);
|
||||||
|
List<DatasetTechnicalResourceRDAExportModel> datasetTechnicalResourceRDAExportModel= new LinkedList<>();
|
||||||
|
for (String key : technicalResourceJsonMap.keySet()) {
|
||||||
|
for (String value : technicalResourceJsonMap.get(key)) {
|
||||||
|
datasetTechnicalResourceRDAExportModel.add(new DatasetTechnicalResourceRDAExportModel().fromDataModel(key, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return datasetTechnicalResourceRDAExportModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
public class DatasetSecurityAndPrivacyRDAExportModel {
|
||||||
|
private String description;
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasetSecurityAndPrivacyRDAExportModel fromDataModel(String key, Object value) {
|
||||||
|
DatasetSecurityAndPrivacyRDAExportModel securityAndPrivacy = new DatasetSecurityAndPrivacyRDAExportModel();
|
||||||
|
if (key.contains("description"))
|
||||||
|
securityAndPrivacy.setDescription(value.toString());
|
||||||
|
else if (key.contains("title"))
|
||||||
|
securityAndPrivacy.setTitle(value.toString());
|
||||||
|
return securityAndPrivacy;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
public class DatasetTechnicalResourceRDAExportModel {
|
||||||
|
private String description;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasetTechnicalResourceRDAExportModel fromDataModel(String key, Object value) {
|
||||||
|
DatasetTechnicalResourceRDAExportModel technicalResource = new DatasetTechnicalResourceRDAExportModel();
|
||||||
|
if (key.contains("description"))
|
||||||
|
technicalResource.setDescription(value.toString());
|
||||||
|
else if (key.contains("name"))
|
||||||
|
technicalResource.setName(value.toString());
|
||||||
|
return technicalResource;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.UserInfo;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DmpContributorRDAExportModel {
|
||||||
|
private IdRDAExportModel contributor_id;
|
||||||
|
private String mbox;
|
||||||
|
private String name;
|
||||||
|
private List<String> role;
|
||||||
|
|
||||||
|
public IdRDAExportModel getContributor_id() {
|
||||||
|
return contributor_id;
|
||||||
|
}
|
||||||
|
public void setContributor_id(IdRDAExportModel contributor_id) {
|
||||||
|
this.contributor_id = contributor_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMbox() {
|
||||||
|
return mbox;
|
||||||
|
}
|
||||||
|
public void setMbox(String mbox) {
|
||||||
|
this.mbox = mbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
public void setRole(List<String> role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpContributorRDAExportModel fromDataModel(UserInfo user, String role) {
|
||||||
|
DmpContributorRDAExportModel contributor = new DmpContributorRDAExportModel();
|
||||||
|
contributor.contributor_id = new IdRDAExportModel(user.getId().toString(), "other");
|
||||||
|
contributor.mbox = user.getEmail();
|
||||||
|
contributor.name = user.getName();
|
||||||
|
contributor.role = new LinkedList<>();
|
||||||
|
contributor.role.add(role);
|
||||||
|
|
||||||
|
return contributor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
public class DmpCostRDAExportModel {
|
||||||
|
private String currency_code; //Allowed values defined by ISO 4217.
|
||||||
|
private String description;
|
||||||
|
private String title;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getCurrency_code() {
|
||||||
|
return currency_code;
|
||||||
|
}
|
||||||
|
public void setCurrency_code(String currency_code) {
|
||||||
|
this.currency_code = currency_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class DmpIdRDAExportModel {
|
|
||||||
private String dmp_id;
|
|
||||||
private String dmp_id_type;
|
|
||||||
|
|
||||||
public String getDmp_id() {
|
|
||||||
return dmp_id;
|
|
||||||
}
|
|
||||||
public void setDmp_id(String dmp_id) {
|
|
||||||
this.dmp_id = dmp_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDmp_id_type() {
|
|
||||||
return dmp_id_type;
|
|
||||||
}
|
|
||||||
public void setDmp_id_type(String dmp_id_type) {
|
|
||||||
this.dmp_id_type = dmp_id_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
DmpIdRDAExportModel(String dmp_id, String dmp_id_type) {
|
|
||||||
this.dmp_id = dmp_id;
|
|
||||||
this.dmp_id_type = dmp_id_type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,34 +1,66 @@
|
||||||
package eu.eudat.models.data.rda;
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
import eu.eudat.data.entities.DMP;
|
import eu.eudat.data.entities.DMP;
|
||||||
|
import eu.eudat.data.entities.Dataset;
|
||||||
import eu.eudat.data.entities.UserDMP;
|
import eu.eudat.data.entities.UserDMP;
|
||||||
|
import eu.eudat.data.entities.UserInfo;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DmpRDAExportModel {
|
public class DmpRDAExportModel {
|
||||||
private DmpIdRDAExportModel dmp_id;
|
|
||||||
private String title;
|
|
||||||
private String description;
|
|
||||||
private Date created;
|
|
||||||
private Date modified;
|
|
||||||
private ContactRDAExportModel contact;
|
private ContactRDAExportModel contact;
|
||||||
|
private List<DmpContributorRDAExportModel> contributor;
|
||||||
|
private List<DmpCostRDAExportModel> cost;
|
||||||
|
private String created;
|
||||||
|
private List<DatasetRDAExportModel> dataset;
|
||||||
|
private String description;
|
||||||
|
private IdRDAExportModel dmp_id;
|
||||||
|
private String ethical_issues_description;
|
||||||
|
private String ethical_issues_exist; // Allowed Values: yes no unknown.
|
||||||
|
private String ethical_issues_report;
|
||||||
private String language;
|
private String language;
|
||||||
private String ethical_issues_exist;
|
private String modified;
|
||||||
private ProjectRDAExportModel project;
|
private ProjectRDAExportModel project;
|
||||||
|
private String title;
|
||||||
|
|
||||||
public DmpIdRDAExportModel getDmp_id() {
|
public ContactRDAExportModel getContact() {
|
||||||
return dmp_id;
|
return contact;
|
||||||
}
|
}
|
||||||
public void setDmp_id(DmpIdRDAExportModel dmp_id) {
|
public void setContact(ContactRDAExportModel contact) {
|
||||||
this.dmp_id = dmp_id;
|
this.contact = contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public List<DmpContributorRDAExportModel> getContributor() {
|
||||||
return title;
|
return contributor;
|
||||||
}
|
}
|
||||||
public void setTitle(String title) {
|
public void setContributor(List<DmpContributorRDAExportModel> contributor) {
|
||||||
this.title = title;
|
this.contributor = contributor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DmpCostRDAExportModel> getCost() {
|
||||||
|
return cost;
|
||||||
|
}
|
||||||
|
public void setCost(List<DmpCostRDAExportModel> cost) {
|
||||||
|
this.cost = cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
public void setCreated(String created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DatasetRDAExportModel> getDataset() {
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
public void setDataset(List<DatasetRDAExportModel> dataset) {
|
||||||
|
this.dataset = dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
@ -38,32 +70,18 @@ public class DmpRDAExportModel {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
public IdRDAExportModel getDmp_id() {
|
||||||
return created;
|
return dmp_id;
|
||||||
}
|
}
|
||||||
public void setCreated(Date created) {
|
public void setDmp_id(IdRDAExportModel dmp_id) {
|
||||||
this.created = created;
|
this.dmp_id = dmp_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getModified() {
|
public String getEthical_issues_description() {
|
||||||
return modified;
|
return ethical_issues_description;
|
||||||
}
|
}
|
||||||
public void setModified(Date modified) {
|
public void setEthical_issues_description(String ethical_issues_description) {
|
||||||
this.modified = modified;
|
this.ethical_issues_description = ethical_issues_description;
|
||||||
}
|
|
||||||
|
|
||||||
public ContactRDAExportModel getContact() {
|
|
||||||
return contact;
|
|
||||||
}
|
|
||||||
public void setContact(ContactRDAExportModel contact) {
|
|
||||||
this.contact = contact;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEthical_issues_exist() {
|
public String getEthical_issues_exist() {
|
||||||
|
@ -73,6 +91,27 @@ public class DmpRDAExportModel {
|
||||||
this.ethical_issues_exist = ethical_issues_exist;
|
this.ethical_issues_exist = ethical_issues_exist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEthical_issues_report() {
|
||||||
|
return ethical_issues_report;
|
||||||
|
}
|
||||||
|
public void setEthical_issues_report(String ethical_issues_report) {
|
||||||
|
this.ethical_issues_report = ethical_issues_report;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModified() {
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
public void setModified(String modified) {
|
||||||
|
this.modified = modified;
|
||||||
|
}
|
||||||
|
|
||||||
public ProjectRDAExportModel getProject() {
|
public ProjectRDAExportModel getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
@ -80,25 +119,46 @@ public class DmpRDAExportModel {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
public DmpRDAExportModel fromDataModel(DMP entity) {
|
public DmpRDAExportModel fromDataModel(DMP entity) {
|
||||||
if (entity.getDoi() != null)
|
DmpRDAExportModel dmpRda = new DmpRDAExportModel();
|
||||||
this.dmp_id = new DmpIdRDAExportModel(entity.getDoi(), "zenodo");
|
dmpRda.contact = new ContactRDAExportModel().fromDataModel(entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
|
||||||
else
|
if (entity.getUsers().stream().anyMatch(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue()))) {
|
||||||
this.dmp_id = new DmpIdRDAExportModel(entity.getId().toString(), "argos_internal");
|
dmpRda.contributor = new LinkedList<>();
|
||||||
|
for (UserDMP userdmp : entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue())).collect(Collectors.toList())) {
|
||||||
|
dmpRda.contributor.add(new DmpContributorRDAExportModel().fromDataModel(userdmp.getUser(), UserDMP.UserDMPRoles.fromInteger(userdmp.getRole()).toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dmpRda.cost = null;
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
|
||||||
|
dmpRda.created = formatter.format(entity.getCreated());
|
||||||
|
dmpRda.dataset = new LinkedList<>();
|
||||||
|
for (Dataset dataset : entity.getDataset()) {
|
||||||
|
if (dataset.getStatus() != Dataset.Status.DELETED.getValue() && dataset.getStatus() != Dataset.Status.CANCELED.getValue())
|
||||||
|
dmpRda.dataset.add(new DatasetRDAExportModel().fromDataModel(dataset));
|
||||||
|
}
|
||||||
|
dmpRda.description = entity.getDescription();
|
||||||
|
if (entity.getDoi() != null) {
|
||||||
|
dmpRda.dmp_id = new IdRDAExportModel(entity.getDoi(), "zenodo");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dmpRda.dmp_id = new IdRDAExportModel(entity.getId().toString(), "other");
|
||||||
|
}
|
||||||
|
// Mock up data on "language" and "ethical_issues_*" for now.
|
||||||
|
// dmpRda.ethical_issues_description = null;
|
||||||
|
dmpRda.ethical_issues_exist = "unknown";
|
||||||
|
// dmpRda.ethical_issues_report = null;
|
||||||
|
dmpRda.language = "en";
|
||||||
|
dmpRda.modified = formatter.format(new Date());
|
||||||
|
dmpRda.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
|
||||||
|
dmpRda.title = entity.getLabel();
|
||||||
|
|
||||||
this.title = entity.getLabel();
|
return dmpRda;
|
||||||
this.description = entity.getDescription();
|
|
||||||
this.created = entity.getCreated();
|
|
||||||
this.modified = entity.getModified();
|
|
||||||
this.contact = new ContactRDAExportModel().fromDataModel(entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
|
|
||||||
|
|
||||||
// Mock up data on "language" and "ethical_issues" for now.
|
|
||||||
this.language = "en";
|
|
||||||
this.ethical_issues_exist = "unknown";
|
|
||||||
|
|
||||||
this.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class FunderIdRDAExportModel {
|
|
||||||
private String funder_id;
|
|
||||||
private String funder_id_type;
|
|
||||||
|
|
||||||
public String getFunder_id() {
|
|
||||||
return funder_id;
|
|
||||||
}
|
|
||||||
public void setFunder_id(String funder_id) {
|
|
||||||
this.funder_id = funder_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFunder_id_type() {
|
|
||||||
return funder_id_type;
|
|
||||||
}
|
|
||||||
public void setFunder_id_type(String funder_id_type) {
|
|
||||||
this.funder_id_type = funder_id_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
FunderIdRDAExportModel(String funder_id, String funder_id_type) {
|
|
||||||
this.funder_id = funder_id;
|
|
||||||
this.funder_id_type = funder_id_type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,21 +4,21 @@ import eu.eudat.data.entities.Funder;
|
||||||
import eu.eudat.data.entities.Grant;
|
import eu.eudat.data.entities.Grant;
|
||||||
|
|
||||||
public class FundingRDAExportModel {
|
public class FundingRDAExportModel {
|
||||||
private FunderIdRDAExportModel funder_id;
|
private IdRDAExportModel funder_id;
|
||||||
private GrantIdRDAExportModel grant_id;
|
private IdRDAExportModel grant_id;
|
||||||
private String funding_status;
|
private String funding_status;
|
||||||
|
|
||||||
public FunderIdRDAExportModel getFunder_id() {
|
public IdRDAExportModel getFunder_id() {
|
||||||
return funder_id;
|
return funder_id;
|
||||||
}
|
}
|
||||||
public void setFunder_id(FunderIdRDAExportModel funder_id) {
|
public void setFunder_id(IdRDAExportModel funder_id) {
|
||||||
this.funder_id = funder_id;
|
this.funder_id = funder_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GrantIdRDAExportModel getGrant_id() {
|
public IdRDAExportModel getGrant_id() {
|
||||||
return grant_id;
|
return grant_id;
|
||||||
}
|
}
|
||||||
public void setGrant_id(GrantIdRDAExportModel grant_id) {
|
public void setGrant_id(IdRDAExportModel grant_id) {
|
||||||
this.grant_id = grant_id;
|
this.grant_id = grant_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,13 +30,14 @@ public class FundingRDAExportModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FundingRDAExportModel fromDataModel(Funder funder, Grant grant) {
|
public FundingRDAExportModel fromDataModel(Funder funder, Grant grant) {
|
||||||
this.funding_status = "planned"; // mock data
|
FundingRDAExportModel funding = new FundingRDAExportModel();
|
||||||
|
funding.funding_status = "planned"; // mock data
|
||||||
if (funder != null) {
|
if (funder != null) {
|
||||||
this.funder_id = new FunderIdRDAExportModel(funder.getReference(), "argos_internal");
|
funding.funder_id = new IdRDAExportModel(funder.getReference(), "other");
|
||||||
}
|
}
|
||||||
if (grant != null) {
|
if (grant != null) {
|
||||||
this.grant_id = new GrantIdRDAExportModel(grant.getReference(), "argos_internal");
|
funding.grant_id = new IdRDAExportModel(grant.getReference(), "other");
|
||||||
}
|
}
|
||||||
return this;
|
return funding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class GrantIdRDAExportModel {
|
|
||||||
private String grant_id;
|
|
||||||
private String grant_id_type;
|
|
||||||
|
|
||||||
public String getGrant_id() {
|
|
||||||
return grant_id;
|
|
||||||
}
|
|
||||||
public void setGrant_id(String grant_id) {
|
|
||||||
this.grant_id = grant_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGrant_id_type() {
|
|
||||||
return grant_id_type;
|
|
||||||
}
|
|
||||||
public void setGrant_id_type(String grant_id_type) {
|
|
||||||
this.grant_id_type = grant_id_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
GrantIdRDAExportModel(String grant_id, String grant_id_type) {
|
|
||||||
this.grant_id = grant_id;
|
|
||||||
this.grant_id_type = grant_id_type;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HostRDAExportModel {
|
||||||
|
private String availability;
|
||||||
|
private String backup__frequency;
|
||||||
|
private String backup_type;
|
||||||
|
private String certified_with; // Repository certified with one the following standards: DIN31644 / DINI-Zertifikat / DSA / ISO16363 / ISO16919 /TRAC / WDS / CoreTrustSeal
|
||||||
|
private String description;
|
||||||
|
private String geo_location; // Physical location of the data expressed using ISO 3166-1 country code.
|
||||||
|
private List<String> pid_system; // PID System: ark arxiv bibcode doi ean13 eissn handle igsn isbn issn istc lissn lsid pmid purl upc url urn other
|
||||||
|
private String storage_type;
|
||||||
|
private String support_versioning; // Allowed values: yes / no / unknown
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public String getAvailability() {
|
||||||
|
return availability;
|
||||||
|
}
|
||||||
|
public void setAvailability(String availability) {
|
||||||
|
this.availability = availability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackup__frequency() {
|
||||||
|
return backup__frequency;
|
||||||
|
}
|
||||||
|
public void setBackup__frequency(String backup__frequency) {
|
||||||
|
this.backup__frequency = backup__frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackup_type() {
|
||||||
|
return backup_type;
|
||||||
|
}
|
||||||
|
public void setBackup_type(String backup_type) {
|
||||||
|
this.backup_type = backup_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCertified_with() {
|
||||||
|
return certified_with;
|
||||||
|
}
|
||||||
|
public void setCertified_with(String certified_with) {
|
||||||
|
this.certified_with = certified_with;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeo_location() {
|
||||||
|
return geo_location;
|
||||||
|
}
|
||||||
|
public void setGeo_location(String geo_location) {
|
||||||
|
this.geo_location = geo_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPid_system() {
|
||||||
|
return pid_system;
|
||||||
|
}
|
||||||
|
public void setPid_system(List<String> pid_system) {
|
||||||
|
this.pid_system = pid_system;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStorage_type() {
|
||||||
|
return storage_type;
|
||||||
|
}
|
||||||
|
public void setStorage_type(String storage_type) {
|
||||||
|
this.storage_type = storage_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSupport_versioning() {
|
||||||
|
return support_versioning;
|
||||||
|
}
|
||||||
|
public void setSupport_versioning(String support_versioning) {
|
||||||
|
this.support_versioning = support_versioning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
public class IdRDAExportModel {
|
||||||
|
private String identifier;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
public void setIdentifier(String identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
IdRDAExportModel(String identifier, String type) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
public class LicenseRDAExportModel {
|
||||||
|
private String license_ref;
|
||||||
|
private String start_date; // If date is set in the future, it indicates embargo period.
|
||||||
|
|
||||||
|
public String getLicense_ref() {
|
||||||
|
return license_ref;
|
||||||
|
}
|
||||||
|
public void setLicense_ref(String license_ref) {
|
||||||
|
this.license_ref = license_ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStart_date() {
|
||||||
|
return start_date;
|
||||||
|
}
|
||||||
|
public void setStart_date(String start_date) {
|
||||||
|
this.start_date = start_date;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class RDAExportModel {
|
public class RDAExportModel {
|
||||||
private DmpRDAExportModel dmp;
|
private DmpRDAExportModel dmp;
|
||||||
private List<DatasetRDAExportModel> datasets;
|
|
||||||
|
|
||||||
public DmpRDAExportModel getDmp() {
|
public DmpRDAExportModel getDmp() {
|
||||||
return dmp;
|
return dmp;
|
||||||
|
@ -17,20 +16,8 @@ public class RDAExportModel {
|
||||||
this.dmp = dmp;
|
this.dmp = dmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DatasetRDAExportModel> getDatasets() {
|
|
||||||
return datasets;
|
|
||||||
}
|
|
||||||
public void setDatasets(List<DatasetRDAExportModel> datasets) {
|
|
||||||
this.datasets = datasets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RDAExportModel fromDataModel(DMP dmp) {
|
public RDAExportModel fromDataModel(DMP dmp) {
|
||||||
this.dmp = new DmpRDAExportModel().fromDataModel(dmp);
|
this.dmp = new DmpRDAExportModel().fromDataModel(dmp);
|
||||||
this.datasets = new LinkedList<>();
|
|
||||||
for (Dataset dataset : dmp.getDataset()) {
|
|
||||||
if (dataset.getStatus() != Dataset.Status.DELETED.getValue() && dataset.getStatus() != Dataset.Status.CANCELED.getValue())
|
|
||||||
this.datasets.add(new DatasetRDAExportModel().fromDataModel(dataset));
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
ethical_issues_exist
|
dataset.data_quality_assurance
|
||||||
cost
|
dataset.distribution.access_url
|
||||||
cost.title
|
dataset.distribution.available_till
|
||||||
cost.description
|
dataset.distribution.byte_size
|
||||||
cost.value
|
dataset.distribution.data_access
|
||||||
cost.currency_code
|
dataset.distribution.description
|
||||||
contact
|
dataset.distribution.download_url
|
||||||
contact.mail
|
dataset.distribution.format
|
||||||
contact.name
|
dataset.distribution.host.availability
|
||||||
contact.contact_id
|
dataset.distribution.host.backup_frequency
|
||||||
contact.contact_id.contact_id
|
dataset.distribution.host.backup_type
|
||||||
contact.contact_id.contact_id_type
|
dataset.distribution.host.certified_with
|
||||||
project
|
dataset.distribution.host.description
|
||||||
project.title
|
dataset.distribution.host.geo_location
|
||||||
project.project_start
|
dataset.distribution.host.pid_system
|
||||||
project.project_end
|
dataset.distribution.host.storage_type
|
||||||
project.funding
|
dataset.distribution.host.supports_versioning
|
||||||
project.funding.funder_id
|
dataset.distribution.host.title
|
||||||
project.funding.funder_id.funder_id
|
dataset.distribution.host.url
|
||||||
project.funding.funder_id.funder_id_type
|
dataset.distribution.license.license_ref
|
||||||
project.funding.grant_id
|
dataset.distribution.license.start_date
|
||||||
project.funding.grant_id.grant_id
|
dataset.distribution.title
|
||||||
project.funding.grant_id.grant_id_type
|
dataset.keyword
|
||||||
dataset
|
dataset.language
|
||||||
dataset.title
|
|
||||||
dataset.type
|
|
||||||
dataset.personal_data
|
|
||||||
dataset.sensitive_data
|
|
||||||
dataset.dataset_id
|
|
||||||
dataset.dataset_id.dataset_id
|
|
||||||
dataset.dataset_id.dataset_id_type
|
|
||||||
dataset.metadata
|
|
||||||
dataset.metadata.language
|
dataset.metadata.language
|
||||||
dataset.metadata.metadata_id
|
dataset.metadata.metadata_standard_id
|
||||||
dataset.metadata.metadata_id.metadata_id
|
dataset.metadata.metadata_standard_id.identifier
|
||||||
dataset.metadata.metadata_id.metadata_id_type
|
dataset.metadata.metadata_standard_id.type
|
||||||
|
dataset.personal_data
|
||||||
|
dataset.preservation_statement
|
||||||
dataset.security_and_privacy
|
dataset.security_and_privacy
|
||||||
dataset.security_and_privacy.title
|
|
||||||
dataset.security_and_privacy.description
|
dataset.security_and_privacy.description
|
||||||
|
dataset.security_and_privacy.title
|
||||||
|
dataset.sensitive_data
|
||||||
|
dataset.technical_resource.description
|
||||||
|
dataset.technical_resource.technical_resource
|
||||||
|
dataset.technical_resource.technical_resource.description
|
||||||
|
dataset.technical_resource.technical_resource.name
|
||||||
|
dataset.type
|
Loading…
Reference in New Issue