Adds new properties on RDA export model.
This commit is contained in:
parent
8d343caf91
commit
06f43ef1a6
|
@ -894,9 +894,7 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
public ResponseEntity<byte[]> getRDAJsonDocument(String id) throws IOException {
|
public ResponseEntity<byte[]> getRDAJsonDocument(String id) throws IOException {
|
||||||
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
||||||
DmpRDAExportModel dmpExport = new DmpRDAExportModel().fromDataModel(dmp);
|
RDAExportModel rdaExportModel = new RDAExportModel().fromDataModel(dmp);
|
||||||
RDAExportModel rdaExportModel = new RDAExportModel();
|
|
||||||
rdaExportModel.setDmp(dmpExport);
|
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String fileName = dmp.getLabel();
|
String fileName = dmp.getLabel();
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package eu.eudat.models.data.dmp;
|
|
||||||
|
|
||||||
public class RDAExportModel {
|
|
||||||
private DmpRDAExportModel dmp;
|
|
||||||
|
|
||||||
public DmpRDAExportModel getDmp() {
|
|
||||||
return dmp;
|
|
||||||
}
|
|
||||||
public void setDmp(DmpRDAExportModel dmp) {
|
|
||||||
this.dmp = dmp;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.dmp;
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
public class ContactIdRDAExportModel {
|
public class ContactIdRDAExportModel {
|
||||||
private String contact_id;
|
private String contact_id;
|
|
@ -1,7 +1,6 @@
|
||||||
package eu.eudat.models.data.dmp;
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
import eu.eudat.data.entities.UserInfo;
|
import eu.eudat.data.entities.UserInfo;
|
||||||
import eu.eudat.models.DataModel;
|
|
||||||
|
|
||||||
public class ContactRDAExportModel {
|
public class ContactRDAExportModel {
|
||||||
private String mail;
|
private String mail;
|
|
@ -0,0 +1,25 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasetIdRDAExportModel(String dataset_id, String dataset_id_type) {
|
||||||
|
this.dataset_id = dataset_id;
|
||||||
|
this.dataset_id_type = dataset_id_type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.Dataset;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DatasetRDAExportModel {
|
||||||
|
private DatasetIdRDAExportModel dataset_id;
|
||||||
|
private String description;
|
||||||
|
private Date issued; // created Date
|
||||||
|
private String language;
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public DatasetIdRDAExportModel getDataset_id() {
|
||||||
|
return dataset_id;
|
||||||
|
}
|
||||||
|
public void setDataset_id(DatasetIdRDAExportModel dataset_id) {
|
||||||
|
this.dataset_id = dataset_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getIssued() {
|
||||||
|
return issued;
|
||||||
|
}
|
||||||
|
public void setIssued(Date issued) {
|
||||||
|
this.issued = issued;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public DatasetRDAExportModel fromDataModel(Dataset dataset) {
|
||||||
|
this.title = dataset.getLabel();
|
||||||
|
this.issued = dataset.getCreated();
|
||||||
|
this.language = "en"; // mock data
|
||||||
|
this.dataset_id = new DatasetIdRDAExportModel(dataset.getId().toString(), "internal");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.dmp;
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
import eu.eudat.data.entities.DMP;
|
import eu.eudat.data.entities.DMP;
|
||||||
import eu.eudat.data.entities.UserDMP;
|
import eu.eudat.data.entities.UserDMP;
|
||||||
|
@ -12,10 +12,10 @@ public class DmpRDAExportModel {
|
||||||
private String description;
|
private String description;
|
||||||
private Date created;
|
private Date created;
|
||||||
private Date modified;
|
private Date modified;
|
||||||
//private grant;
|
|
||||||
private ContactRDAExportModel contact;
|
private ContactRDAExportModel contact;
|
||||||
private String language;
|
private String language;
|
||||||
private String ethical_issues_exist;
|
private String ethical_issues_exist;
|
||||||
|
private ProjectRDAExportModel project;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -73,6 +73,13 @@ public class DmpRDAExportModel {
|
||||||
this.ethical_issues_exist = ethical_issues_exist;
|
this.ethical_issues_exist = ethical_issues_exist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectRDAExportModel getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
public void setProject(ProjectRDAExportModel project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public DmpRDAExportModel fromDataModel(DMP entity) {
|
public DmpRDAExportModel fromDataModel(DMP entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
|
@ -81,9 +88,12 @@ public class DmpRDAExportModel {
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
this.modified = entity.getModified();
|
this.modified = entity.getModified();
|
||||||
this.contact = new ContactRDAExportModel().fromDataModel(entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
|
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.
|
// Mock up data on "language" and "ethical_issues" for now.
|
||||||
this.language = "en";
|
this.language = "en";
|
||||||
this.ethical_issues_exist = "no";
|
this.ethical_issues_exist = "unknown";
|
||||||
|
|
||||||
|
this.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.Funder;
|
||||||
|
import eu.eudat.data.entities.Grant;
|
||||||
|
|
||||||
|
public class FundingRDAExportModel {
|
||||||
|
private FunderIdRDAExportModel funder_id;
|
||||||
|
private GrantIdRDAExportModel grant_id;
|
||||||
|
private String funding_status;
|
||||||
|
|
||||||
|
public FunderIdRDAExportModel getFunder_id() {
|
||||||
|
return funder_id;
|
||||||
|
}
|
||||||
|
public void setFunder_id(FunderIdRDAExportModel funder_id) {
|
||||||
|
this.funder_id = funder_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrantIdRDAExportModel getGrant_id() {
|
||||||
|
return grant_id;
|
||||||
|
}
|
||||||
|
public void setGrant_id(GrantIdRDAExportModel grant_id) {
|
||||||
|
this.grant_id = grant_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFunding_status() {
|
||||||
|
return funding_status;
|
||||||
|
}
|
||||||
|
public void setFunding_status(String funding_status) {
|
||||||
|
this.funding_status = funding_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FundingRDAExportModel fromDataModel(Funder funder, Grant grant) {
|
||||||
|
this.funding_status = "planned"; // mock data
|
||||||
|
if (funder != null) {
|
||||||
|
this.funder_id = new FunderIdRDAExportModel();
|
||||||
|
this.funder_id.setFunder_id(funder.getReference());
|
||||||
|
}
|
||||||
|
if (grant != null) {
|
||||||
|
this.grant_id = new GrantIdRDAExportModel();
|
||||||
|
this.grant_id.setGrant_id(grant.getReference());
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.Grant;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class ProjectRDAExportModel {
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private Date project_start;
|
||||||
|
private Date project_end;
|
||||||
|
private FundingRDAExportModel funding;
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getProject_start() {
|
||||||
|
return project_start;
|
||||||
|
}
|
||||||
|
public void setProject_start(Date project_start) {
|
||||||
|
this.project_start = project_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getProject_end() {
|
||||||
|
return project_end;
|
||||||
|
}
|
||||||
|
public void setProject_end(Date project_end) {
|
||||||
|
this.project_end = project_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FundingRDAExportModel getFunding() {
|
||||||
|
return funding;
|
||||||
|
}
|
||||||
|
public void setFunding(FundingRDAExportModel funding) {
|
||||||
|
this.funding = funding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ProjectRDAExportModel fromDataModel(Grant grant) {
|
||||||
|
this.funding = new FundingRDAExportModel().fromDataModel(grant.getFunder(), grant);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package eu.eudat.models.data.rda;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.DMP;
|
||||||
|
import eu.eudat.data.entities.Dataset;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RDAExportModel {
|
||||||
|
private DmpRDAExportModel dmp;
|
||||||
|
private List<DatasetRDAExportModel> datasets;
|
||||||
|
|
||||||
|
public DmpRDAExportModel getDmp() {
|
||||||
|
return dmp;
|
||||||
|
}
|
||||||
|
public void setDmp(DmpRDAExportModel dmp) {
|
||||||
|
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()) {
|
||||||
|
this.datasets.add(new DatasetRDAExportModel().fromDataModel(dataset));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue