Adds new models for exposing the Dataset and Dataset Template informations.

This commit is contained in:
gkolokythas 2019-05-20 14:20:06 +03:00
parent 8a2f6b3c28
commit c28ec47537
3 changed files with 110 additions and 5 deletions

View File

@ -0,0 +1,63 @@
package eu.eudat.models.data.dataset;
import eu.eudat.data.entities.Dataset;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import java.util.UUID;
public class DatasetOverviewModel implements DataModel<Dataset, DatasetOverviewModel> {
private UUID id;
private String label;
private short status;
private DatasetProfileOverviewModel datasetTemplate;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public short getStatus() {
return status;
}
public void setStatus(short status) {
this.status = status;
}
public DatasetProfileOverviewModel getDatasetTemplate() {
return datasetTemplate;
}
public void setDatasetTemplate(DatasetProfileOverviewModel datasetTemplate) {
this.datasetTemplate = datasetTemplate;
}
@Override
public DatasetOverviewModel fromDataModel(Dataset entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.status = entity.getStatus();
this.datasetTemplate = new DatasetProfileOverviewModel().fromDataModel(entity.getProfile());
return this;
}
@Override
public Dataset toDataModel() throws Exception {
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -0,0 +1,42 @@
package eu.eudat.models.data.datasetprofile;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.models.DataModel;
import java.util.UUID;
public class DatasetProfileOverviewModel implements DataModel<DatasetProfile, DatasetProfileOverviewModel> {
private UUID id;
private String label;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public DatasetProfileOverviewModel fromDataModel(DatasetProfile entity) {
this.id = entity.getId();
this.label = entity.getLabel();
return this;
}
@Override
public DatasetProfile toDataModel() throws Exception {
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -3,6 +3,7 @@ package eu.eudat.models.data.listingmodels;
import eu.eudat.data.entities.DMP;
import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.dataset.DatasetOverviewModel;
import eu.eudat.models.data.dmp.AssociatedProfile;
import eu.eudat.models.data.dmp.Organisation;
import eu.eudat.models.data.dmp.Researcher;
@ -30,14 +31,13 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
private int version;
private int status;
private UUID groupId;
private List<DatasetUrlListing> datasets;
private List<DatasetOverviewModel> datasets;
private List<AssociatedProfile> associatedProfiles;
private List<Researcher> researchers;
private List<UserInfoListingModel> users;
private String description;
public String getId() {
return id;
}
@ -101,10 +101,10 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.groupId = groupId;
}
public List<DatasetUrlListing> getDatasets() {
public List<DatasetOverviewModel> getDatasets() {
return datasets;
}
public void setDatasets(List<DatasetUrlListing> datasets) {
public void setDatasets(List<DatasetOverviewModel> datasets) {
this.datasets = datasets;
}
@ -160,7 +160,7 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.creationTime = entity.getCreated();
this.modifiedTime = entity.getModified();
this.organisations = entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList());
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
this.datasets = entity.getDataset().stream().map(x-> new DatasetOverviewModel().fromDataModel(x)).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
this.description = entity.getDescription();
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());