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
|
|
|
|
|
|
|
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 dmp;
|
|
|
|
private String profile;
|
|
|
|
private String dataRepositories;
|
|
|
|
private String registries;
|
|
|
|
private String services;
|
|
|
|
private String status;
|
|
|
|
private String created;
|
|
|
|
private String description;
|
|
|
|
|
|
|
|
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 getDmp() {
|
|
|
|
return dmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDmp(String dmp) {
|
|
|
|
this.dmp = dmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getStatus() {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStatus(String status) {
|
|
|
|
this.status = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getCreated() {
|
|
|
|
return created;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCreated(String created) {
|
|
|
|
this.created = created;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
|
|
|
@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();
|
|
|
|
this.created = entity.getCreated().toString();
|
2018-02-16 08:45:18 +01:00
|
|
|
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
|
|
|
|
this.profile = entity.getProfile() != null ? entity.getProfile().getLabel() : "";
|
2017-12-19 17:22:30 +01:00
|
|
|
this.description = entity.getDescription();
|
2018-02-16 08:45:18 +01:00
|
|
|
this.status = "" + entity.getStatus();
|
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
|
|
|
}
|