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

122 lines
3.0 KiB
Java
Raw Normal View History

2018-06-27 12:29:21 +02:00
package eu.eudat.models.data.listingmodels;
2017-12-19 15:09:49 +01:00
2018-03-21 11:57:56 +01:00
import eu.eudat.data.entities.DMP;
2017-12-19 15:09:49 +01:00
import eu.eudat.models.DataModel;
2018-06-27 12:29:21 +02:00
import eu.eudat.models.data.dmp.Organisation;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
2018-07-23 15:09:19 +02:00
import eu.eudat.models.data.urls.DatasetUrlListing;
2017-12-19 15:09:49 +01:00
2018-10-02 16:33:58 +02:00
import java.util.Date;
2018-07-23 15:09:19 +02:00
import java.util.List;
2018-02-08 09:42:02 +01:00
import java.util.UUID;
2017-12-19 15:09:49 +01:00
import java.util.stream.Collectors;
2018-02-01 10:08:06 +01:00
2018-02-16 11:34:02 +01:00
public class DataManagementPlanListingModel implements DataModel<DMP, DataManagementPlanListingModel> {
2017-12-19 15:09:49 +01:00
private String id;
private String label;
private String project;
private String profile;
2018-10-02 16:33:58 +02:00
private Date creationTime;
2017-12-19 15:09:49 +01:00
private String organisations;
2018-10-02 16:33:58 +02:00
private int version;
2018-02-08 09:42:02 +01:00
private UUID groupId;
2018-07-23 15:09:19 +02:00
private List<DatasetUrlListing> datasets;
2017-12-19 15:09:49 +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;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
2018-10-02 16:33:58 +02:00
public Date getCreationTime() {
2018-02-02 12:09:38 +01:00
return creationTime;
2017-12-19 15:09:49 +01:00
}
2018-10-02 16:33:58 +02:00
public void setCreationTime(Date creationTime) {
2018-02-02 12:09:38 +01:00
this.creationTime = creationTime;
2017-12-19 15:09:49 +01:00
}
public String getOrganisations() {
return organisations;
}
public void setOrganisations(String organisations) {
this.organisations = organisations;
}
2018-10-02 16:33:58 +02:00
public int getVersion() {
2017-12-19 15:09:49 +01:00
return version;
}
2018-10-02 16:33:58 +02:00
public void setVersion(int version) {
2017-12-19 15:09:49 +01:00
this.version = version;
}
2018-02-08 09:42:02 +01:00
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
2018-07-23 15:09:19 +02:00
public List<DatasetUrlListing> getDatasets() {
return datasets;
2018-01-23 16:21:38 +01:00
}
2018-07-23 15:09:19 +02:00
public void setDatasets(List<DatasetUrlListing> datasets) {
this.datasets = datasets;
2018-01-23 16:21:38 +01:00
}
2017-12-19 15:09:49 +01:00
@Override
2018-02-16 08:45:18 +01:00
public DataManagementPlanListingModel fromDataModel(DMP entity) {
2017-12-19 15:09:49 +01:00
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.project = entity.getProject().getLabel();
2018-02-16 11:34:02 +01:00
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
2018-10-02 16:33:58 +02:00
this.creationTime = entity.getCreated();
this.version = entity.getVersion();
2018-02-08 09:42:02 +01:00
this.groupId = entity.getGroupId();
2018-07-23 15:09:19 +02:00
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
2018-02-16 08:45:18 +01:00
return this;
2017-12-19 15:09:49 +01:00
}
@Override
public DMP toDataModel() {
return null;
}
2018-01-19 10:31:05 +01:00
@Override
public String getHint() {
return "dataManagementPlanListingModel";
}
2017-12-19 15:09:49 +01:00
}