2019-10-11 15:39:29 +02:00
|
|
|
package eu.eudat.models.data.rda;
|
2019-06-04 16:04:04 +02:00
|
|
|
|
|
|
|
import eu.eudat.data.entities.DMP;
|
|
|
|
import eu.eudat.data.entities.UserDMP;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
public class DmpRDAExportModel {
|
2019-10-15 12:46:49 +02:00
|
|
|
private DmpIdRDAExportModel dmp_id;
|
2019-06-04 16:04:04 +02:00
|
|
|
private String title;
|
|
|
|
private String description;
|
|
|
|
private Date created;
|
|
|
|
private Date modified;
|
|
|
|
private ContactRDAExportModel contact;
|
|
|
|
private String language;
|
|
|
|
private String ethical_issues_exist;
|
2019-10-11 15:39:29 +02:00
|
|
|
private ProjectRDAExportModel project;
|
2019-06-04 16:04:04 +02:00
|
|
|
|
2019-10-15 12:46:49 +02:00
|
|
|
public DmpIdRDAExportModel getDmp_id() {
|
|
|
|
return dmp_id;
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
2019-10-15 12:46:49 +02:00
|
|
|
public void setDmp_id(DmpIdRDAExportModel dmp_id) {
|
|
|
|
this.dmp_id = dmp_id;
|
2019-06-04 16:04:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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 getCreated() {
|
|
|
|
return created;
|
|
|
|
}
|
|
|
|
public void setCreated(Date created) {
|
|
|
|
this.created = created;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getModified() {
|
|
|
|
return modified;
|
|
|
|
}
|
|
|
|
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 String getEthical_issues_exist() {
|
|
|
|
return ethical_issues_exist;
|
|
|
|
}
|
|
|
|
public void setEthical_issues_exist(String ethical_issues_exist) {
|
|
|
|
this.ethical_issues_exist = ethical_issues_exist;
|
|
|
|
}
|
|
|
|
|
2019-10-11 15:39:29 +02:00
|
|
|
public ProjectRDAExportModel getProject() {
|
|
|
|
return project;
|
|
|
|
}
|
|
|
|
public void setProject(ProjectRDAExportModel project) {
|
|
|
|
this.project = project;
|
|
|
|
}
|
|
|
|
|
2019-06-04 16:04:04 +02:00
|
|
|
|
|
|
|
public DmpRDAExportModel fromDataModel(DMP entity) {
|
2019-10-31 11:21:18 +01:00
|
|
|
if (entity.getDoi() != null)
|
|
|
|
this.dmp_id = new DmpIdRDAExportModel(entity.getDoi(), "zenodo");
|
|
|
|
else
|
|
|
|
this.dmp_id = new DmpIdRDAExportModel(entity.getId().toString(), "argos_internal");
|
|
|
|
|
2019-06-04 16:04:04 +02:00
|
|
|
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());
|
2019-10-11 15:39:29 +02:00
|
|
|
|
2019-06-04 16:04:04 +02:00
|
|
|
// Mock up data on "language" and "ethical_issues" for now.
|
|
|
|
this.language = "en";
|
2019-10-11 15:39:29 +02:00
|
|
|
this.ethical_issues_exist = "unknown";
|
|
|
|
|
|
|
|
this.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
|
2019-06-04 16:04:04 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|