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;
|
||||
|
||||
public class ContactRDAExportModel {
|
||||
private String mail;
|
||||
private String mbox;
|
||||
private String name;
|
||||
private ContactIdRDAExportModel contact_id;
|
||||
private IdRDAExportModel contact_id;
|
||||
|
||||
public String getMail() {
|
||||
return mail;
|
||||
public String getMbox() {
|
||||
return mbox;
|
||||
}
|
||||
public void setMail(String mail) {
|
||||
this.mail = mail;
|
||||
public void setMbox(String mbox) {
|
||||
this.mbox = mbox;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -21,24 +21,24 @@ public class ContactRDAExportModel {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public ContactIdRDAExportModel getContact_id() {
|
||||
public IdRDAExportModel getContact_id() {
|
||||
return contact_id;
|
||||
}
|
||||
public void setContact_id(ContactIdRDAExportModel contact_id) {
|
||||
public void setContact_id(IdRDAExportModel contact_id) {
|
||||
this.contact_id = contact_id;
|
||||
}
|
||||
|
||||
|
||||
public ContactRDAExportModel fromDataModel(UserInfo entity) {
|
||||
this.mail = entity.getEmail();
|
||||
this.name = entity.getName();
|
||||
ContactRDAExportModel contact = new ContactRDAExportModel();
|
||||
contact.mbox = entity.getEmail();
|
||||
contact.name = entity.getName();
|
||||
// TODO: we should use a contact_id and not our UUID.
|
||||
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 {
|
||||
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 {
|
||||
private String description; // Not mandatory.
|
||||
private String language;
|
||||
private DatasetMetadataIdRDAExportModel metadata_id;
|
||||
private IdRDAExportModel metadata_standard_id;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
|
@ -19,17 +19,17 @@ public class DatasetMetadataRDAExportModel {
|
|||
this.language = language;
|
||||
}
|
||||
|
||||
public DatasetMetadataIdRDAExportModel getMetadata_id() {
|
||||
return metadata_id;
|
||||
public IdRDAExportModel getMetadata_standard_id() {
|
||||
return metadata_standard_id;
|
||||
}
|
||||
public void setMetadata_id(DatasetMetadataIdRDAExportModel metadata_id) {
|
||||
this.metadata_id = metadata_id;
|
||||
public void setMetadata_standard_id(IdRDAExportModel metadata_standard_id) {
|
||||
this.metadata_standard_id = metadata_standard_id;
|
||||
}
|
||||
|
||||
public DatasetMetadataRDAExportModel fromDataModel(String key, Object value) {
|
||||
DatasetMetadataRDAExportModel metadataRDAExportModel = new DatasetMetadataRDAExportModel();
|
||||
if (key.contains("metadata_id"))
|
||||
metadataRDAExportModel.setMetadata_id(new DatasetMetadataIdRDAExportModel().fromDataModel(key, value));
|
||||
if (key.contains("metadata_standard_id"))
|
||||
metadataRDAExportModel.setMetadata_standard_id(new IdRDAExportModel(value.toString(), value.toString()));
|
||||
else if (key.contains("language"))
|
||||
metadataRDAExportModel.setLanguage(value.toString());
|
||||
else if (key.contains("description"))
|
||||
|
|
|
@ -6,31 +6,48 @@ import eu.eudat.data.entities.Dataset;
|
|||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||
import org.apache.commons.collections4.MultiValuedMap;
|
||||
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.json.JSONObject;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.xpath.*;
|
||||
import java.text.DateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class DatasetRDAExportModel {
|
||||
|
||||
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 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 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;
|
||||
}
|
||||
public void setDataset_id(DatasetIdRDAExportModel dataset_id) {
|
||||
public void setDataset_id(IdRDAExportModel dataset_id) {
|
||||
this.dataset_id = dataset_id;
|
||||
}
|
||||
|
||||
|
@ -41,13 +58,27 @@ public class DatasetRDAExportModel {
|
|||
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;
|
||||
}
|
||||
public void setIssued(Date issued) {
|
||||
public void setIssued(String issued) {
|
||||
this.issued = issued;
|
||||
}
|
||||
|
||||
public List<String> getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
public void setKeyword(List<String> keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
@ -55,11 +86,32 @@ public class DatasetRDAExportModel {
|
|||
this.language = language;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
public List<DatasetMetadataRDAExportModel> getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
public void setMetadata(List<DatasetMetadataRDAExportModel> metadata) {
|
||||
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() {
|
||||
|
@ -69,67 +121,45 @@ public class DatasetRDAExportModel {
|
|||
this.sensitive_data = sensitive_data;
|
||||
}
|
||||
|
||||
public String getData_quality_assurance() {
|
||||
return data_quality_assurance;
|
||||
public List<DatasetTechnicalResourceRDAExportModel> getTechnical_resource() {
|
||||
return technical_resource;
|
||||
}
|
||||
public void setData_quality_assurance(String data_quality_assurance) {
|
||||
this.data_quality_assurance = data_quality_assurance;
|
||||
public void setTechnical_resource(List<DatasetTechnicalResourceRDAExportModel> technical_resource) {
|
||||
this.technical_resource = technical_resource;
|
||||
}
|
||||
|
||||
public List<DatasetMetadataRDAExportModel> getMetadata() {
|
||||
return metadata;
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setMetadata(List<DatasetMetadataRDAExportModel> metadata) {
|
||||
this.metadata = metadata;
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
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);
|
||||
this.rdaToValueMap = getRdaValueMap(dataset);
|
||||
List<DatasetDistributionRDAExportModel> distributions = getDatasetDistribution();
|
||||
List<DatasetMetadataRDAExportModel> datasetMetadata = getDatasetMetadata();
|
||||
List<DatasetSecurityAndPrivacyRDAExportModel> securityAndPrivacy = getSecurityAndPrivacy();
|
||||
List<DatasetTechnicalResourceRDAExportModel> technicalResources = getTechnicalResource();
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
|
||||
// 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 datasetRDAExportModel = mapper.convertValue(this.rdaToValueMap, DatasetRDAExportModel.class);
|
||||
datasetRDAExportModel.setDataset_id(new IdRDAExportModel(dataset.getId().toString(), "other"));
|
||||
datasetRDAExportModel.setDescription(dataset.getDescription());
|
||||
datasetRDAExportModel.setIssued(DateFormat.getDateInstance(DateFormat.SHORT).format(dataset.getCreated()));
|
||||
datasetRDAExportModel.setLanguage("en"); // mock data;
|
||||
datasetRDAExportModel.setDataset_id(new DatasetIdRDAExportModel(dataset.getId().toString(), "argos_internal"));
|
||||
|
||||
List<DatasetMetadataRDAExportModel> datasetMetadataRDAExportModels = new LinkedList<>();
|
||||
for (String key : metadataJsonMap.keySet()) {
|
||||
for (String value : metadataJsonMap.get(key)) {
|
||||
datasetMetadataRDAExportModels.add(new DatasetMetadataRDAExportModel().fromDataModel(key,value));
|
||||
}
|
||||
}
|
||||
datasetRDAExportModel.setMetadata(datasetMetadataRDAExportModels);
|
||||
datasetRDAExportModel.setTitle(dataset.getLabel());
|
||||
datasetRDAExportModel.setDistribution(distributions);
|
||||
datasetRDAExportModel.setMetadata(datasetMetadata);
|
||||
datasetRDAExportModel.setSecurity_and_privacy(securityAndPrivacy);
|
||||
datasetRDAExportModel.setTechnical_resource(technicalResources);
|
||||
|
||||
return datasetRDAExportModel;
|
||||
}
|
||||
|
@ -162,4 +192,107 @@ public class DatasetRDAExportModel {
|
|||
}
|
||||
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;
|
||||
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
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.UUID;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DmpRDAExportModel {
|
||||
private DmpIdRDAExportModel dmp_id;
|
||||
private String title;
|
||||
private String description;
|
||||
private Date created;
|
||||
private Date modified;
|
||||
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 ethical_issues_exist;
|
||||
private String modified;
|
||||
private ProjectRDAExportModel project;
|
||||
private String title;
|
||||
|
||||
public DmpIdRDAExportModel getDmp_id() {
|
||||
return dmp_id;
|
||||
public ContactRDAExportModel getContact() {
|
||||
return contact;
|
||||
}
|
||||
public void setDmp_id(DmpIdRDAExportModel dmp_id) {
|
||||
this.dmp_id = dmp_id;
|
||||
public void setContact(ContactRDAExportModel contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
public List<DmpContributorRDAExportModel> getContributor() {
|
||||
return contributor;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
public void setContributor(List<DmpContributorRDAExportModel> contributor) {
|
||||
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() {
|
||||
|
@ -38,32 +70,18 @@ public class DmpRDAExportModel {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
public IdRDAExportModel getDmp_id() {
|
||||
return dmp_id;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
public void setDmp_id(IdRDAExportModel dmp_id) {
|
||||
this.dmp_id = dmp_id;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
public String getEthical_issues_description() {
|
||||
return ethical_issues_description;
|
||||
}
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
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 void setEthical_issues_description(String ethical_issues_description) {
|
||||
this.ethical_issues_description = ethical_issues_description;
|
||||
}
|
||||
|
||||
public String getEthical_issues_exist() {
|
||||
|
@ -73,6 +91,27 @@ public class DmpRDAExportModel {
|
|||
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() {
|
||||
return project;
|
||||
}
|
||||
|
@ -80,25 +119,46 @@ public class DmpRDAExportModel {
|
|||
this.project = project;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public DmpRDAExportModel fromDataModel(DMP entity) {
|
||||
if (entity.getDoi() != null)
|
||||
this.dmp_id = new DmpIdRDAExportModel(entity.getDoi(), "zenodo");
|
||||
else
|
||||
this.dmp_id = new DmpIdRDAExportModel(entity.getId().toString(), "argos_internal");
|
||||
DmpRDAExportModel dmpRda = new DmpRDAExportModel();
|
||||
dmpRda.contact = new ContactRDAExportModel().fromDataModel(entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
|
||||
if (entity.getUsers().stream().anyMatch(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue()))) {
|
||||
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();
|
||||
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;
|
||||
return dmpRda;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class FundingRDAExportModel {
|
||||
private FunderIdRDAExportModel funder_id;
|
||||
private GrantIdRDAExportModel grant_id;
|
||||
private IdRDAExportModel funder_id;
|
||||
private IdRDAExportModel grant_id;
|
||||
private String funding_status;
|
||||
|
||||
public FunderIdRDAExportModel getFunder_id() {
|
||||
public IdRDAExportModel getFunder_id() {
|
||||
return funder_id;
|
||||
}
|
||||
public void setFunder_id(FunderIdRDAExportModel funder_id) {
|
||||
public void setFunder_id(IdRDAExportModel funder_id) {
|
||||
this.funder_id = funder_id;
|
||||
}
|
||||
|
||||
public GrantIdRDAExportModel getGrant_id() {
|
||||
public IdRDAExportModel getGrant_id() {
|
||||
return grant_id;
|
||||
}
|
||||
public void setGrant_id(GrantIdRDAExportModel grant_id) {
|
||||
public void setGrant_id(IdRDAExportModel grant_id) {
|
||||
this.grant_id = grant_id;
|
||||
}
|
||||
|
||||
|
@ -30,13 +30,14 @@ public class FundingRDAExportModel {
|
|||
}
|
||||
|
||||
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) {
|
||||
this.funder_id = new FunderIdRDAExportModel(funder.getReference(), "argos_internal");
|
||||
funding.funder_id = new IdRDAExportModel(funder.getReference(), "other");
|
||||
}
|
||||
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 {
|
||||
private DmpRDAExportModel dmp;
|
||||
private List<DatasetRDAExportModel> datasets;
|
||||
|
||||
public DmpRDAExportModel getDmp() {
|
||||
return dmp;
|
||||
|
@ -17,20 +16,8 @@ public class RDAExportModel {
|
|||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public List<DatasetRDAExportModel> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
public void setDatasets(List<DatasetRDAExportModel> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
public RDAExportModel fromDataModel(DMP 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
ethical_issues_exist
|
||||
cost
|
||||
cost.title
|
||||
cost.description
|
||||
cost.value
|
||||
cost.currency_code
|
||||
contact
|
||||
contact.mail
|
||||
contact.name
|
||||
contact.contact_id
|
||||
contact.contact_id.contact_id
|
||||
contact.contact_id.contact_id_type
|
||||
project
|
||||
project.title
|
||||
project.project_start
|
||||
project.project_end
|
||||
project.funding
|
||||
project.funding.funder_id
|
||||
project.funding.funder_id.funder_id
|
||||
project.funding.funder_id.funder_id_type
|
||||
project.funding.grant_id
|
||||
project.funding.grant_id.grant_id
|
||||
project.funding.grant_id.grant_id_type
|
||||
dataset
|
||||
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.data_quality_assurance
|
||||
dataset.distribution.access_url
|
||||
dataset.distribution.available_till
|
||||
dataset.distribution.byte_size
|
||||
dataset.distribution.data_access
|
||||
dataset.distribution.description
|
||||
dataset.distribution.download_url
|
||||
dataset.distribution.format
|
||||
dataset.distribution.host.availability
|
||||
dataset.distribution.host.backup_frequency
|
||||
dataset.distribution.host.backup_type
|
||||
dataset.distribution.host.certified_with
|
||||
dataset.distribution.host.description
|
||||
dataset.distribution.host.geo_location
|
||||
dataset.distribution.host.pid_system
|
||||
dataset.distribution.host.storage_type
|
||||
dataset.distribution.host.supports_versioning
|
||||
dataset.distribution.host.title
|
||||
dataset.distribution.host.url
|
||||
dataset.distribution.license.license_ref
|
||||
dataset.distribution.license.start_date
|
||||
dataset.distribution.title
|
||||
dataset.keyword
|
||||
dataset.language
|
||||
dataset.metadata.language
|
||||
dataset.metadata.metadata_id
|
||||
dataset.metadata.metadata_id.metadata_id
|
||||
dataset.metadata.metadata_id.metadata_id_type
|
||||
dataset.metadata.metadata_standard_id
|
||||
dataset.metadata.metadata_standard_id.identifier
|
||||
dataset.metadata.metadata_standard_id.type
|
||||
dataset.personal_data
|
||||
dataset.preservation_statement
|
||||
dataset.security_and_privacy
|
||||
dataset.security_and_privacy.description
|
||||
dataset.security_and_privacy.title
|
||||
dataset.security_and_privacy.description
|
||||
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