Minor changes to Recent Activity Model
This commit is contained in:
parent
b57f6fb73c
commit
71279a716e
|
@ -1,6 +1,9 @@
|
|||
package eu.eudat.models.data.dashboard.recent.model;
|
||||
|
||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class RecentActivityModel<T> {
|
||||
private String id;
|
||||
|
@ -17,6 +20,8 @@ public abstract class RecentActivityModel<T> {
|
|||
private Date publishedAt;
|
||||
private String profile;
|
||||
private RecentActivityType type;
|
||||
private List<UserInfoListingModel> users;
|
||||
private Boolean isPublic;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -130,6 +135,22 @@ public abstract class RecentActivityModel<T> {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public List<UserInfoListingModel> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UserInfoListingModel> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Boolean getPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(Boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
public abstract RecentActivityModel fromEntity(T entity);
|
||||
|
||||
public enum RecentActivityType {
|
||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.data.entities.Dataset;
|
|||
import eu.eudat.logic.utilities.helpers.LabelBuilder;
|
||||
import eu.eudat.models.data.dataset.DataRepository;
|
||||
import eu.eudat.models.data.dataset.Service;
|
||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -75,6 +76,8 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset> {
|
|||
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
|
||||
this.setRegistries(LabelBuilder.getLabel(entity.getRegistries().stream().map(item -> new eu.eudat.models.data.dataset.Registry().fromDataModel(item)).collect(Collectors.toList())));
|
||||
this.setServices(LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList())));
|
||||
this.setPublic(entity.getDmp().isPublic());
|
||||
this.setUsers(entity.getDmp().getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ public class RecentDmpModel extends RecentActivityModel<DMP> {
|
|||
private List<AssociatedProfile> associatedProfiles;
|
||||
private String organisations;
|
||||
private UUID groupId;
|
||||
private List<UserInfoListingModel> users;
|
||||
private Boolean isPublic;
|
||||
|
||||
|
||||
public String getDoi() {
|
||||
|
@ -71,22 +69,6 @@ public class RecentDmpModel extends RecentActivityModel<DMP> {
|
|||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public List<UserInfoListingModel> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UserInfoListingModel> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Boolean getPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(Boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public RecentActivityModel fromEntity(DMP entity) {
|
||||
|
@ -105,11 +87,11 @@ public class RecentDmpModel extends RecentActivityModel<DMP> {
|
|||
this.setGrantAbbreviation(entity.getGrant().getAbbreviation());
|
||||
this.setGrantId(entity.getGrant().getId().toString());
|
||||
this.groupId = entity.getGroupId();
|
||||
this.isPublic = entity.isPublic();
|
||||
this.setPublic(entity.isPublic());
|
||||
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
|
||||
if (entity.getProfile() != null) this.setProfile(entity.getProfile().getLabel());
|
||||
this.setPublishedAt(entity.getPublishedAt());
|
||||
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
||||
this.setUsers(entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue