Add users on DatasetListingModel

This commit is contained in:
George Kalampokis 2020-06-30 14:37:35 +03:00
parent 3bf6c2d927
commit 3c18ed4a0c
1 changed files with 12 additions and 0 deletions

View File

@ -6,7 +6,9 @@ import eu.eudat.models.data.dataset.DataRepository;
import eu.eudat.models.data.dataset.Service; import eu.eudat.models.data.dataset.Service;
import eu.eudat.logic.utilities.helpers.LabelBuilder; import eu.eudat.logic.utilities.helpers.LabelBuilder;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -29,6 +31,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private Date finalizedAt; private Date finalizedAt;
private Date dmpPublishedAt; private Date dmpPublishedAt;
private int version; private int version;
private List<UserInfoListingModel> users;
public String getId() { public String getId() {
return id; return id;
@ -156,6 +159,14 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.version = version; this.version = version;
} }
public List<UserInfoListingModel> getUsers() {
return users;
}
public void setUsers(List<UserInfoListingModel> users) {
this.users = users;
}
@Override @Override
public DatasetListingModel fromDataModel(Dataset entity) { public DatasetListingModel fromDataModel(Dataset entity) {
this.id = entity.getId() != null ? entity.getId().toString() : ""; this.id = entity.getId() != null ? entity.getId().toString() : "";
@ -176,6 +187,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.finalizedAt = entity.getFinalizedAt(); this.finalizedAt = entity.getFinalizedAt();
this.dmpPublishedAt = entity.getDmp().getPublishedAt(); this.dmpPublishedAt = entity.getDmp().getPublishedAt();
this.version = entity.getDmp().getVersion(); this.version = entity.getDmp().getVersion();
this.users = entity.getDmp() != null ? entity.getDmp().getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()) : new ArrayList<>();
return this; return this;
} }