Adds datasets and dmp roles on DMP edit model.

(cherry picked from commit dd0b23580c)
This commit is contained in:
gkolokythas 2019-05-27 18:26:03 +03:00 committed by apapachristou
parent 23d85d0275
commit abb41b238d
1 changed files with 13 additions and 25 deletions

View File

@ -1,17 +1,14 @@
package eu.eudat.models.data.dmp; package eu.eudat.models.data.dmp;
import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.*;
import eu.eudat.data.entities.DMPProfile;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.entities.UserDMP;
import eu.eudat.logic.utilities.builders.XmlBuilder; import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.DataModel; import eu.eudat.models.DataModel;
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue; import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile; import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile;
import eu.eudat.models.data.helpermodels.Tuple; import eu.eudat.models.data.helpermodels.Tuple;
import eu.eudat.models.data.listingmodels.DatasetListingModel; import eu.eudat.models.data.listingmodels.DatasetListingModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import eu.eudat.models.data.project.Project; import eu.eudat.models.data.project.Project;
import eu.eudat.models.data.userinfo.UserInfo;
import eu.eudat.models.data.userinfo.UserListingModel; import eu.eudat.models.data.userinfo.UserListingModel;
import net.minidev.json.JSONObject; import net.minidev.json.JSONObject;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -42,11 +39,11 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
private Date created; private Date created;
private List<DynamicFieldWithValue> dynamicFields; private List<DynamicFieldWithValue> dynamicFields;
private Map<String, Object> properties; private Map<String, Object> properties;
private List<UserInfoListingModel> users;
public UUID getId() { public UUID getId() {
return id; return id;
} }
public void setId(UUID id) { public void setId(UUID id) {
this.id = id; this.id = id;
} }
@ -54,7 +51,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public Tuple<UUID, String> getProfile() { public Tuple<UUID, String> getProfile() {
return profile; return profile;
} }
public void setProfile(Tuple<UUID, String> profile) { public void setProfile(Tuple<UUID, String> profile) {
this.profile = profile; this.profile = profile;
} }
@ -62,7 +58,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public String getLabel() { public String getLabel() {
return label; return label;
} }
public void setLabel(String label) { public void setLabel(String label) {
this.label = label; this.label = label;
} }
@ -70,7 +65,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public UUID getGroupId() { public UUID getGroupId() {
return groupId; return groupId;
} }
public void setGroupId(UUID groupId) { public void setGroupId(UUID groupId) {
this.groupId = groupId; this.groupId = groupId;
} }
@ -78,7 +72,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public List<UserListingModel> getAssociatedUsers() { public List<UserListingModel> getAssociatedUsers() {
return associatedUsers; return associatedUsers;
} }
public void setAssociatedUsers(List<UserListingModel> associatedUsers) { public void setAssociatedUsers(List<UserListingModel> associatedUsers) {
this.associatedUsers = associatedUsers; this.associatedUsers = associatedUsers;
} }
@ -86,7 +79,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public int getVersion() { public int getVersion() {
return version; return version;
} }
public void setVersion(int version) { public void setVersion(int version) {
this.version = version; this.version = version;
} }
@ -94,7 +86,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public List<Organisation> getOrganisations() { public List<Organisation> getOrganisations() {
return organisations; return organisations;
} }
public void setOrganisations(List<Organisation> organizations) { public void setOrganisations(List<Organisation> organizations) {
this.organisations = organizations; this.organisations = organizations;
} }
@ -102,7 +93,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public List<Researcher> getResearchers() { public List<Researcher> getResearchers() {
return researchers; return researchers;
} }
public void setResearchers(List<Researcher> researchers) { public void setResearchers(List<Researcher> researchers) {
this.researchers = researchers; this.researchers = researchers;
} }
@ -110,7 +100,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public int getStatus() { public int getStatus() {
return status; return status;
} }
public void setStatus(int status) { public void setStatus(int status) {
this.status = status; this.status = status;
} }
@ -118,7 +107,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public Project getProject() { public Project getProject() {
return project; return project;
} }
public void setProject(Project project) { public void setProject(Project project) {
this.project = project; this.project = project;
} }
@ -126,7 +114,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public eu.eudat.models.data.userinfo.UserInfo getCreator() { public eu.eudat.models.data.userinfo.UserInfo getCreator() {
return creator; return creator;
} }
public void setCreator(eu.eudat.models.data.userinfo.UserInfo creator) { public void setCreator(eu.eudat.models.data.userinfo.UserInfo creator) {
this.creator = creator; this.creator = creator;
} }
@ -134,7 +121,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public List<AssociatedProfile> getProfiles() { public List<AssociatedProfile> getProfiles() {
return profiles; return profiles;
} }
public void setProfiles(List<AssociatedProfile> profiles) { public void setProfiles(List<AssociatedProfile> profiles) {
this.profiles = profiles; this.profiles = profiles;
} }
@ -142,7 +128,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public Date getCreated() { public Date getCreated() {
return created; return created;
} }
public void setCreated(Date created) { public void setCreated(Date created) {
this.created = created; this.created = created;
} }
@ -150,7 +135,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
@ -158,7 +142,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public DataManagementPlanProfile getDefinition() { public DataManagementPlanProfile getDefinition() {
return definition; return definition;
} }
public void setDefinition(DataManagementPlanProfile definition) { public void setDefinition(DataManagementPlanProfile definition) {
this.definition = definition; this.definition = definition;
} }
@ -166,7 +149,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public Map<String, Object> getProperties() { public Map<String, Object> getProperties() {
return properties; return properties;
} }
public void setProperties(Map<String, Object> properties) { public void setProperties(Map<String, Object> properties) {
this.properties = properties; this.properties = properties;
} }
@ -174,7 +156,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public List<DynamicFieldWithValue> getDynamicFields() { public List<DynamicFieldWithValue> getDynamicFields() {
return dynamicFields; return dynamicFields;
} }
public void setDynamicFields(List<DynamicFieldWithValue> dynamicFields) { public void setDynamicFields(List<DynamicFieldWithValue> dynamicFields) {
this.dynamicFields = dynamicFields; this.dynamicFields = dynamicFields;
} }
@ -182,7 +163,6 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public boolean getLockable() { public boolean getLockable() {
return lockable; return lockable;
} }
public void setLockable(boolean lockable) { public void setLockable(boolean lockable) {
this.lockable = lockable; this.lockable = lockable;
} }
@ -190,11 +170,17 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public List<DatasetListingModel> getDatasets() { public List<DatasetListingModel> getDatasets() {
return datasets; return datasets;
} }
public void setDatasets(List<DatasetListingModel> datasets) { public void setDatasets(List<DatasetListingModel> datasets) {
this.datasets = datasets; this.datasets = datasets;
} }
public List<UserInfoListingModel> getUsers() {
return users;
}
public void setUsers(List<UserInfoListingModel> users) {
this.users = users;
}
@Override @Override
public DataManagementPlan fromDataModel(DMP entity) { public DataManagementPlan fromDataModel(DMP entity) {
this.id = entity.getId(); this.id = entity.getId();
@ -231,12 +217,14 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.profiles.add(new AssociatedProfile().fromXml((Element) associatedProfileElement)); this.profiles.add(new AssociatedProfile().fromXml((Element) associatedProfileElement));
} }
} }
}*/
} }
} this.datasets = entity.getDataset().stream().map(item -> new DatasetListingModel().fromDataModel(item)).collect(Collectors.toList());
this.created = entity.getCreated(); this.created = entity.getCreated();
this.description = entity.getDescription(); this.description = entity.getDescription();
this.status = entity.getStatus(); this.status = entity.getStatus();
this.associatedUsers = entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList()); this.associatedUsers = entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList());
return this; return this;
} }