argos/dmp-backend/src/main/java/eu/eudat/models/project/ProjectListingModel.java

195 lines
4.4 KiB
Java
Raw Normal View History

2018-01-17 13:03:51 +01:00
package eu.eudat.models.project;
2018-01-19 12:11:22 +01:00
import eu.eudat.entities.Project;
2018-02-16 11:34:02 +01:00
import eu.eudat.entities.UserInfo;
2018-01-17 13:03:51 +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;
2018-01-17 13:03:51 +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.List;
import java.util.UUID;
2018-01-17 13:03:51 +01:00
2018-02-16 11:34:02 +01:00
public class ProjectListingModel implements DataModel<eu.eudat.entities.Project, ProjectListingModel> {
2018-01-17 13:03:51 +01:00
private UUID id;
private List<DataManagementPlan> dmps;
private String label;
private String abbreviation;
private String reference;
private String uri;
private String definition;
private String startDate;
private String endDate;
2018-01-19 12:11:22 +01:00
private Project.Status status;
2018-01-17 13:03:51 +01:00
private UserInfo creationUser;
private String created;
private String 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;
}
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 short getStatus() {
return status.getValue();
}
public void setStatus(Short status) {
2018-01-19 12:11:22 +01:00
this.status = 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 String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getModified() {
return modified;
}
public void setModified(String 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-02-16 08:45:18 +01:00
public ProjectListingModel fromDataModel(eu.eudat.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();
this.definition = entity.getDefinition();
2018-01-23 16:21:38 +01:00
this.startDate = entity.getStartdate() != null ? entity.getStartdate().toString() : null;
this.endDate = entity.getEnddate() != null ? entity.getEnddate().toString() : null;
2018-01-17 13:03:51 +01:00
this.setStatus(entity.getStatus());
this.created = entity.getCreated().toString();
this.modified = entity.getModified().toString();
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
public eu.eudat.entities.Project toDataModel() throws Exception {
2018-01-23 16:21:38 +01:00
throw new Exception("Not Implemented");
2018-01-17 13:03:51 +01:00
}
2018-01-19 10:31:05 +01:00
@Override
public String getHint() {
return null;
}
2018-01-17 13:03:51 +01:00
}