2019-05-17 17:21:56 +02:00
|
|
|
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.dmp.AssociatedProfile;
|
|
|
|
import eu.eudat.models.data.dmp.Organisation;
|
2019-05-20 09:27:32 +02:00
|
|
|
import eu.eudat.models.data.dmp.Researcher;
|
2019-05-20 12:13:48 +02:00
|
|
|
import eu.eudat.models.data.project.ProjectOverviewModel;
|
2019-05-17 17:21:56 +02:00
|
|
|
import eu.eudat.models.data.urls.DatasetUrlListing;
|
|
|
|
import org.w3c.dom.Document;
|
|
|
|
import org.w3c.dom.Element;
|
|
|
|
import org.w3c.dom.Node;
|
|
|
|
import org.w3c.dom.NodeList;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManagementPlanOverviewModel> {
|
|
|
|
private String id;
|
|
|
|
private String label;
|
|
|
|
private String profile;
|
2019-05-20 12:13:48 +02:00
|
|
|
private ProjectOverviewModel project;
|
2019-05-17 17:21:56 +02:00
|
|
|
private Date creationTime;
|
|
|
|
private Date modifiedTime;
|
|
|
|
private List<Organisation> organisations;
|
|
|
|
private int version;
|
|
|
|
private int status;
|
|
|
|
private UUID groupId;
|
|
|
|
private List<DatasetUrlListing> datasets;
|
|
|
|
private List<AssociatedProfile> associatedProfiles;
|
2019-05-20 12:13:48 +02:00
|
|
|
private List<Researcher> researchers;
|
2019-05-17 17:21:56 +02:00
|
|
|
private List<UserInfoListingModel> users;
|
|
|
|
private String description;
|
2019-05-20 12:13:48 +02:00
|
|
|
|
2019-05-17 17:21:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
public String getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
public void setId(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getProfile() {
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
public void setProfile(String profile) {
|
|
|
|
this.profile = profile;
|
|
|
|
}
|
|
|
|
|
2019-05-20 12:13:48 +02:00
|
|
|
public ProjectOverviewModel getProject() {
|
|
|
|
return project;
|
|
|
|
}
|
|
|
|
public void setProject(ProjectOverviewModel project) {
|
|
|
|
this.project = project;
|
|
|
|
}
|
|
|
|
|
2019-05-17 17:21:56 +02:00
|
|
|
public Date getCreationTime() {
|
|
|
|
return creationTime;
|
|
|
|
}
|
|
|
|
public void setCreationTime(Date creationTime) {
|
|
|
|
this.creationTime = creationTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getModifiedTime() {
|
|
|
|
return modifiedTime;
|
|
|
|
}
|
|
|
|
public void setModifiedTime(Date modifiedTime) {
|
|
|
|
this.modifiedTime = modifiedTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Organisation> getOrganisations() {
|
|
|
|
return organisations;
|
|
|
|
}
|
|
|
|
public void setOrganisations(List<Organisation> organizations) {
|
|
|
|
this.organisations = organizations;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getVersion() {
|
|
|
|
return version;
|
|
|
|
}
|
|
|
|
public void setVersion(int version) {
|
|
|
|
this.version = version;
|
|
|
|
}
|
|
|
|
|
|
|
|
public UUID getGroupId() {
|
|
|
|
return groupId;
|
|
|
|
}
|
|
|
|
public void setGroupId(UUID groupId) {
|
|
|
|
this.groupId = groupId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<DatasetUrlListing> getDatasets() {
|
|
|
|
return datasets;
|
|
|
|
}
|
|
|
|
public void setDatasets(List<DatasetUrlListing> datasets) {
|
|
|
|
this.datasets = datasets;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getStatus() {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
public void setStatus(int status) {
|
|
|
|
this.status = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<AssociatedProfile> getAssociatedProfiles() {
|
|
|
|
return associatedProfiles;
|
|
|
|
}
|
|
|
|
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
|
|
|
this.associatedProfiles = associatedProfiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<UserInfoListingModel> getUsers() {
|
|
|
|
return users;
|
|
|
|
}
|
|
|
|
public void setUsers(List<UserInfoListingModel> users) {
|
|
|
|
this.users = users;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2019-05-20 09:27:32 +02:00
|
|
|
public List<Researcher> getResearchers() {
|
|
|
|
return researchers;
|
|
|
|
}
|
|
|
|
public void setResearchers(List<Researcher> researchers) {
|
|
|
|
this.researchers = researchers;
|
|
|
|
}
|
|
|
|
|
2019-05-17 17:21:56 +02:00
|
|
|
@Override
|
|
|
|
public DataManagementPlanOverviewModel fromDataModel(DMP entity) {
|
|
|
|
this.id = entity.getId().toString();
|
|
|
|
this.label = entity.getLabel();
|
|
|
|
this.groupId = entity.getGroupId();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public DataManagementPlanOverviewModel fromDataModelDatasets(DMP entity) {
|
|
|
|
this.fromDataModel(entity);
|
|
|
|
this.status = entity.getStatus();
|
|
|
|
this.version = entity.getVersion();
|
2019-05-20 12:13:48 +02:00
|
|
|
this.project = new ProjectOverviewModel().fromDataModel(entity.getProject());
|
2019-05-17 17:21:56 +02:00
|
|
|
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
|
|
|
|
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.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
|
|
|
this.description = entity.getDescription();
|
2019-05-20 09:27:32 +02:00
|
|
|
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
|
2019-05-17 17:21:56 +02:00
|
|
|
|
|
|
|
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
|
|
|
Document viewStyleDoc = XmlBuilder.fromXml(entity.getAssociatedDmps());
|
|
|
|
Element item = (Element) viewStyleDoc.getElementsByTagName("profiles").item(0);
|
|
|
|
this.associatedProfiles = new LinkedList<>();
|
|
|
|
if (item != null) {
|
|
|
|
NodeList associatedProfilesElement = item.getChildNodes();
|
|
|
|
for (int temp = 0; temp < associatedProfilesElement.getLength(); temp++) {
|
|
|
|
Node associatedProfileElement = associatedProfilesElement.item(temp);
|
|
|
|
if (associatedProfileElement.getNodeType() == Node.ELEMENT_NODE) {
|
|
|
|
this.associatedProfiles.add(new AssociatedProfile().fromXml((Element) associatedProfileElement));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public DMP toDataModel() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getHint() {
|
|
|
|
return "dataManagementPlanOverviewModel";
|
|
|
|
}
|
|
|
|
}
|