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;
|
2018-10-09 12:58:36 +02:00
|
|
|
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;
|
2019-04-25 17:12:08 +02:00
|
|
|
private Date modified;
|
2017-12-19 17:22:30 +01:00
|
|
|
private String description;
|
2019-05-15 17:24:31 +02:00
|
|
|
private String projectAbbreviation;
|
2019-05-16 09:10:54 +02:00
|
|
|
private String projectId;
|
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;
|
|
|
|
}
|
|
|
|
|
2018-10-09 12:58:36 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-04-25 17:12:08 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-05-15 17:24:31 +02:00
|
|
|
public String getProjectAbbreviation() {
|
|
|
|
return projectAbbreviation;
|
|
|
|
}
|
|
|
|
public void setProjectAbbreviation(String projectAbbreviation) {
|
|
|
|
this.projectAbbreviation = projectAbbreviation;
|
|
|
|
}
|
|
|
|
|
2019-05-16 09:10:54 +02:00
|
|
|
public String getProjectId() {
|
|
|
|
return projectId;
|
|
|
|
}
|
|
|
|
public void setProjectId(String projectId) {
|
|
|
|
this.projectId = projectId;
|
|
|
|
}
|
|
|
|
|
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();
|
2019-04-25 17:12:08 +02:00
|
|
|
this.modified = entity.getModified();
|
2018-10-09 12:58:36 +02:00
|
|
|
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();
|
2019-05-15 17:24:31 +02:00
|
|
|
this.projectAbbreviation = entity.getDmp().getProject().getAbbreviation();
|
2019-05-16 09:10:54 +02:00
|
|
|
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()));
|
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
|
|
|
}
|