2017-12-15 00:01:26 +01:00
|
|
|
package eu.eudat.models.project;
|
2017-12-14 18:07:09 +01:00
|
|
|
|
2018-03-21 11:57:56 +01:00
|
|
|
import eu.eudat.data.entities.UserInfo;
|
2017-12-15 00:01:26 +01:00
|
|
|
import eu.eudat.models.DataModel;
|
|
|
|
import eu.eudat.models.dmp.DataManagementPlan;
|
2018-03-19 13:40:04 +01:00
|
|
|
import eu.eudat.models.files.ContentFile;
|
2017-12-14 18:07:09 +01:00
|
|
|
|
2018-03-19 13:40:04 +01:00
|
|
|
import java.util.Arrays;
|
2018-02-16 11:34:02 +01:00
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
2017-12-18 16:55:12 +01:00
|
|
|
|
2018-03-21 11:57:56 +01:00
|
|
|
public class Project implements DataModel<eu.eudat.data.entities.Project, Project> {
|
2018-01-17 13:03:51 +01:00
|
|
|
|
|
|
|
private UUID id;
|
|
|
|
|
|
|
|
private List<DataManagementPlan> dmps;
|
|
|
|
|
|
|
|
private String label;
|
|
|
|
|
2018-05-28 11:50:42 +02:00
|
|
|
private int type;
|
|
|
|
|
2018-01-17 13:03:51 +01:00
|
|
|
private String abbreviation;
|
|
|
|
|
|
|
|
private String reference;
|
|
|
|
|
|
|
|
private String uri;
|
|
|
|
|
|
|
|
private String definition;
|
|
|
|
|
|
|
|
private Date startDate;
|
|
|
|
|
|
|
|
private Date endDate;
|
|
|
|
|
2018-03-21 11:57:56 +01:00
|
|
|
private eu.eudat.data.entities.Project.Status status;
|
2018-01-17 13:03:51 +01:00
|
|
|
|
|
|
|
private UserInfo creationUser;
|
|
|
|
|
|
|
|
private Date created;
|
|
|
|
|
|
|
|
private Date modified;
|
|
|
|
|
|
|
|
private String description;
|
|
|
|
|
2018-03-19 13:40:04 +01:00
|
|
|
private List<ContentFile> files;
|
|
|
|
|
2018-01-17 13:03:51 +01:00
|
|
|
|
|
|
|
public UUID getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(UUID id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
2018-05-28 11:50:42 +02:00
|
|
|
public int getType() {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setType(int type) {
|
|
|
|
this.type = type;
|
|
|
|
}
|
|
|
|
|
2018-01-17 13:03:51 +01:00
|
|
|
public List<DataManagementPlan> getDmps() {
|
|
|
|
return dmps;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDmps(List<DataManagementPlan> dmps) {
|
|
|
|
this.dmps = dmps;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getAbbreviation() {
|
|
|
|
return abbreviation;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAbbreviation(String abbreviation) {
|
|
|
|
this.abbreviation = abbreviation;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getReference() {
|
|
|
|
return reference;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setReference(String reference) {
|
|
|
|
this.reference = reference;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getUri() {
|
|
|
|
return uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUri(String uri) {
|
|
|
|
this.uri = uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDefinition() {
|
|
|
|
return definition;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDefinition(String definition) {
|
|
|
|
this.definition = definition;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getStartDate() {
|
|
|
|
return startDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStartDate(Date startDate) {
|
|
|
|
this.startDate = startDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getEndDate() {
|
|
|
|
return endDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEndDate(Date endDate) {
|
|
|
|
this.endDate = endDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public short getStatus() {
|
|
|
|
return status.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStatus(Short status) {
|
2018-03-21 11:57:56 +01:00
|
|
|
this.status = eu.eudat.data.entities.Project.Status.fromInteger(status);
|
2018-01-17 13:03:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public UserInfo getCreationUser() {
|
|
|
|
return creationUser;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCreationUser(UserInfo creationUser) {
|
|
|
|
this.creationUser = creationUser;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2018-03-19 13:40:04 +01:00
|
|
|
public List<ContentFile> getFiles() {
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFiles(List<ContentFile> files) {
|
|
|
|
this.files = files;
|
|
|
|
}
|
|
|
|
|
2018-01-17 13:03:51 +01:00
|
|
|
@Override
|
2018-03-21 11:57:56 +01:00
|
|
|
public Project fromDataModel(eu.eudat.data.entities.Project entity) {
|
2018-01-17 13:03:51 +01:00
|
|
|
this.id = entity.getId();
|
|
|
|
this.label = entity.getLabel();
|
|
|
|
this.abbreviation = entity.getAbbreviation();
|
|
|
|
this.reference = entity.getReference();
|
|
|
|
this.uri = entity.getUri();
|
2018-05-28 11:50:42 +02:00
|
|
|
this.type = entity.getType();
|
2018-01-17 13:03:51 +01:00
|
|
|
this.definition = entity.getDefinition();
|
|
|
|
this.startDate = entity.getStartdate();
|
|
|
|
this.endDate = entity.getEnddate();
|
|
|
|
this.setStatus(entity.getStatus());
|
|
|
|
this.created = entity.getCreated();
|
|
|
|
this.modified = entity.getModified();
|
|
|
|
this.description = entity.getDescription();
|
2018-03-19 13:40:04 +01:00
|
|
|
this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null));
|
2018-02-16 08:45:18 +01:00
|
|
|
return this;
|
2018-01-17 13:03:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-03-21 11:57:56 +01:00
|
|
|
public eu.eudat.data.entities.Project toDataModel() {
|
|
|
|
eu.eudat.data.entities.Project entity = new eu.eudat.data.entities.Project();
|
2018-01-17 13:03:51 +01:00
|
|
|
entity.setId(this.id);
|
|
|
|
entity.setAbbreviation(this.abbreviation);
|
|
|
|
entity.setLabel(this.label);
|
2018-05-28 11:50:42 +02:00
|
|
|
entity.setType(this.type);
|
2018-02-16 11:34:02 +01:00
|
|
|
entity.setReference(this.reference == null ? "dmp:" + this.label : this.reference);
|
2018-01-17 13:03:51 +01:00
|
|
|
entity.setUri(this.uri);
|
|
|
|
entity.setDefinition(this.definition);
|
|
|
|
entity.setStartdate(this.startDate);
|
|
|
|
entity.setCreated(this.created == null ? new Date() : this.created);
|
|
|
|
entity.setEnddate(this.endDate);
|
2018-03-21 11:57:56 +01:00
|
|
|
entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.data.entities.Project.Status.ACTIVE.getValue());
|
2018-01-17 13:03:51 +01:00
|
|
|
entity.setModified(new Date());
|
|
|
|
entity.setDescription(this.description);
|
|
|
|
return entity;
|
|
|
|
}
|
2018-01-19 10:31:05 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getHint() {
|
|
|
|
return null;
|
|
|
|
}
|
2017-12-14 18:07:09 +01:00
|
|
|
}
|