Refactor the DMP listing model and adding to it more information about Project.

This commit is contained in:
gkolokythas 2019-05-20 13:13:48 +03:00
parent 2775841d84
commit b67614afd0
2 changed files with 91 additions and 28 deletions

View File

@ -6,6 +6,7 @@ import eu.eudat.models.DataModel;
import eu.eudat.models.data.dmp.AssociatedProfile; import eu.eudat.models.data.dmp.AssociatedProfile;
import eu.eudat.models.data.dmp.Organisation; import eu.eudat.models.data.dmp.Organisation;
import eu.eudat.models.data.dmp.Researcher; import eu.eudat.models.data.dmp.Researcher;
import eu.eudat.models.data.project.ProjectOverviewModel;
import eu.eudat.models.data.urls.DatasetUrlListing; import eu.eudat.models.data.urls.DatasetUrlListing;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -21,8 +22,8 @@ import java.util.stream.Collectors;
public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManagementPlanOverviewModel> { public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManagementPlanOverviewModel> {
private String id; private String id;
private String label; private String label;
private String project;
private String profile; private String profile;
private ProjectOverviewModel project;
private Date creationTime; private Date creationTime;
private Date modifiedTime; private Date modifiedTime;
private List<Organisation> organisations; private List<Organisation> organisations;
@ -31,11 +32,10 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
private UUID groupId; private UUID groupId;
private List<DatasetUrlListing> datasets; private List<DatasetUrlListing> datasets;
private List<AssociatedProfile> associatedProfiles; private List<AssociatedProfile> associatedProfiles;
private List<Researcher> researchers;
private List<UserInfoListingModel> users; private List<UserInfoListingModel> users;
private String description; private String description;
private String projectAbbreviation;
private String projectId;
private List<Researcher> researchers;
public String getId() { public String getId() {
@ -52,13 +52,6 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.label = label; this.label = label;
} }
public String getProject() {
return project;
}
public void setProject(String project) {
this.project = project;
}
public String getProfile() { public String getProfile() {
return profile; return profile;
} }
@ -66,6 +59,13 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.profile = profile; this.profile = profile;
} }
public ProjectOverviewModel getProject() {
return project;
}
public void setProject(ProjectOverviewModel project) {
this.project = project;
}
public Date getCreationTime() { public Date getCreationTime() {
return creationTime; return creationTime;
} }
@ -136,20 +136,6 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.description = description; this.description = description;
} }
public String getProjectAbbreviation() {
return projectAbbreviation;
}
public void setProjectAbbreviation(String projectAbbreviation) {
this.projectAbbreviation = projectAbbreviation;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public List<Researcher> getResearchers() { public List<Researcher> getResearchers() {
return researchers; return researchers;
} }
@ -169,7 +155,7 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.fromDataModel(entity); this.fromDataModel(entity);
this.status = entity.getStatus(); this.status = entity.getStatus();
this.version = entity.getVersion(); this.version = entity.getVersion();
this.project = entity.getProject().getLabel(); this.project = new ProjectOverviewModel().fromDataModel(entity.getProject());
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel(); if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
this.creationTime = entity.getCreated(); this.creationTime = entity.getCreated();
this.modifiedTime = entity.getModified(); this.modifiedTime = entity.getModified();
@ -177,8 +163,6 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList()); this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()); this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
this.description = entity.getDescription(); this.description = entity.getDescription();
this.projectAbbreviation = entity.getProject().getAbbreviation();
this.projectId = entity.getProject().getId().toString();
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList()); this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) { if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {

View File

@ -0,0 +1,79 @@
package eu.eudat.models.data.project;
import eu.eudat.data.entities.Project;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
public class ProjectOverviewModel implements DataModel<Project, ProjectOverviewModel> {
private UUID id;
private String label;
private String abbreviation;
private String definition;
private Date startDate;
private Date endDate;
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 String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
@Override
public ProjectOverviewModel fromDataModel(Project entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.definition = entity.getDefinition();
this.startDate = entity.getStartdate();
this.endDate = entity.getEnddate();
return this;
}
@Override
public Project toDataModel() throws Exception {
return null;
}
@Override
public String getHint() {
return null;
}
}