argos/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DatasetListingModel.java

174 lines
4.9 KiB
Java
Raw Normal View History

2018-06-27 12:29:21 +02:00
package eu.eudat.models.data.listingmodels;
2017-12-19 17:22:30 +01:00
2018-03-21 11:57:56 +01:00
import eu.eudat.data.entities.Dataset;
2017-12-19 17:22:30 +01:00
import eu.eudat.models.DataModel;
2018-06-27 12:29:21 +02:00
import eu.eudat.models.data.dataset.DataRepository;
import eu.eudat.models.data.dataset.Service;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
2017-12-19 17:22:30 +01:00
2018-10-02 16:33:58 +02:00
import java.util.Date;
2017-12-19 17:22:30 +01:00
import java.util.stream.Collectors;
2018-02-01 10:08:06 +01:00
2018-02-16 08:45:18 +01:00
public class DatasetListingModel implements DataModel<Dataset, DatasetListingModel> {
2017-12-19 17:22:30 +01:00
private String id;
private String label;
private String project;
2017-12-19 17:22:30 +01:00
private String dmp;
2019-04-22 12:45:36 +02:00
private String dmpId;
2017-12-19 17:22:30 +01:00
private String profile;
private String dataRepositories;
private String registries;
private String services;
2018-10-02 16:33:58 +02:00
private int status;
private Date created;
private Date modified;
2017-12-19 17:22:30 +01:00
private String description;
private String projectAbbreviation;
private String projectId;
private Date finalizedDat;
2017-12-19 17:22:30 +01:00
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getProject() {
return project;
}
public void setProject(String project) {
this.project = project;
}
2017-12-19 17:22:30 +01:00
public String getDmp() {
return dmp;
}
public void setDmp(String dmp) {
this.dmp = dmp;
}
2019-04-22 12:45:36 +02:00
public String getDmpId() {
return dmpId;
}
public void setDmpId(String dmpId) {
this.dmpId = dmpId;
}
2017-12-19 17:22:30 +01:00
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public String getDataRepositories() {
return dataRepositories;
}
public void setDataRepositories(String dataRepositories) {
this.dataRepositories = dataRepositories;
}
public String getRegistries() {
return registries;
}
public void setRegistries(String registries) {
this.registries = registries;
}
public String getServices() {
return services;
}
public void setServices(String services) {
this.services = services;
}
2018-10-02 16:33:58 +02:00
public int getStatus() {
2017-12-19 17:22:30 +01:00
return status;
}
2018-10-02 16:33:58 +02:00
public void setStatus(int status) {
2017-12-19 17:22:30 +01:00
this.status = status;
}
2018-10-02 16:33:58 +02:00
public Date getCreated() {
2017-12-19 17:22:30 +01:00
return created;
}
2018-10-02 16:33:58 +02:00
public void setCreated(Date created) {
2017-12-19 17:22:30 +01:00
this.created = created;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
2017-12-19 17:22:30 +01:00
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getProjectAbbreviation() {
return projectAbbreviation;
}
public void setProjectAbbreviation(String projectAbbreviation) {
this.projectAbbreviation = projectAbbreviation;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public Date getFinalizedDat() {
return finalizedDat;
}
public void setFinalizedDat(Date finalizedDat) {
this.finalizedDat = finalizedDat;
}
2017-12-19 17:22:30 +01:00
@Override
2018-02-16 08:45:18 +01:00
public DatasetListingModel fromDataModel(Dataset entity) {
2017-12-19 17:22:30 +01:00
this.id = entity.getId().toString();
this.label = entity.getLabel();
2018-10-02 16:33:58 +02:00
this.created = entity.getCreated();
this.modified = entity.getModified();
this.project = entity.getDmp().getProject().getLabel();
2018-02-16 08:45:18 +01:00
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
2019-04-22 12:45:36 +02:00
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : "";
2018-02-16 08:45:18 +01:00
this.profile = entity.getProfile() != null ? entity.getProfile().getLabel() : "";
2017-12-19 17:22:30 +01:00
this.description = entity.getDescription();
2018-10-02 16:33:58 +02:00
this.status = entity.getStatus();
this.projectAbbreviation = entity.getDmp().getProject().getAbbreviation();
this.projectId = entity.getDmp().getProject().getId().toString();
2018-06-27 12:29:21 +02:00
this.registries = LabelBuilder.getLabel(entity.getRegistries().stream().map(item -> new eu.eudat.models.data.dataset.Registry().fromDataModel(item)).collect(Collectors.toList()));
2018-05-28 11:50:42 +02:00
this.dataRepositories = LabelBuilder.getLabel(entity.getDatasetDataRepositories().stream().map(item -> new DataRepository().fromDataModel(item.getDataRepository())).collect(Collectors.toList()));
this.services = LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()));
this.finalizedDat = entity.getFinalizedDat();
2018-02-16 08:45:18 +01:00
return this;
2017-12-19 17:22:30 +01:00
}
@Override
public Dataset toDataModel() {
return null;
}
2018-01-19 10:31:05 +01:00
@Override
public String getHint() {
return "datasetListingModel";
}
2017-12-19 17:22:30 +01:00
}