2018-06-27 12:29:21 +02:00
|
|
|
package eu.eudat.models.data.listingmodels;
|
2017-12-19 15:09:49 +01:00
|
|
|
|
2018-03-21 11:57:56 +01:00
|
|
|
import eu.eudat.data.entities.DMP;
|
2019-04-26 16:08:41 +02:00
|
|
|
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
2017-12-19 15:09:49 +01:00
|
|
|
import eu.eudat.models.DataModel;
|
2019-04-26 16:08:41 +02:00
|
|
|
import eu.eudat.models.data.dmp.AssociatedProfile;
|
2018-06-27 12:29:21 +02:00
|
|
|
import eu.eudat.models.data.dmp.Organisation;
|
|
|
|
import eu.eudat.logic.utilities.helpers.LabelBuilder;
|
2018-07-23 15:09:19 +02:00
|
|
|
import eu.eudat.models.data.urls.DatasetUrlListing;
|
2019-04-26 16:08:41 +02:00
|
|
|
import org.w3c.dom.Document;
|
|
|
|
import org.w3c.dom.Element;
|
|
|
|
import org.w3c.dom.Node;
|
|
|
|
import org.w3c.dom.NodeList;
|
2017-12-19 15:09:49 +01:00
|
|
|
|
2018-10-02 16:33:58 +02:00
|
|
|
import java.util.Date;
|
2019-04-26 16:08:41 +02:00
|
|
|
import java.util.LinkedList;
|
2018-07-23 15:09:19 +02:00
|
|
|
import java.util.List;
|
2018-02-08 09:42:02 +01:00
|
|
|
import java.util.UUID;
|
2017-12-19 15:09:49 +01:00
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
2018-02-01 10:08:06 +01:00
|
|
|
|
2018-02-16 11:34:02 +01:00
|
|
|
public class DataManagementPlanListingModel implements DataModel<DMP, DataManagementPlanListingModel> {
|
2017-12-19 15:09:49 +01:00
|
|
|
private String id;
|
|
|
|
private String label;
|
|
|
|
private String project;
|
|
|
|
private String profile;
|
2018-10-02 16:33:58 +02:00
|
|
|
private Date creationTime;
|
2019-04-25 17:12:08 +02:00
|
|
|
private Date modifiedTime;
|
2017-12-19 15:09:49 +01:00
|
|
|
private String organisations;
|
2018-10-02 16:33:58 +02:00
|
|
|
private int version;
|
2018-10-12 10:22:23 +02:00
|
|
|
private int status;
|
2018-02-08 09:42:02 +01:00
|
|
|
private UUID groupId;
|
2018-07-23 15:09:19 +02:00
|
|
|
private List<DatasetUrlListing> datasets;
|
2019-04-26 16:08:41 +02:00
|
|
|
private List<AssociatedProfile> associatedProfiles;
|
2019-05-06 11:41:13 +02:00
|
|
|
private List<UserInfoListingModel> users;
|
2019-05-09 11:42:51 +02:00
|
|
|
private String description;
|
2019-05-10 10:33:48 +02:00
|
|
|
private String projectAbbreviation;
|
2019-05-14 13:04:43 +02:00
|
|
|
private String projectId;
|
2019-05-09 11:42:51 +02:00
|
|
|
|
2017-12-19 15:09:49 +01: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 getProject() {
|
|
|
|
return project;
|
|
|
|
}
|
|
|
|
public void setProject(String project) {
|
|
|
|
this.project = project;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getProfile() {
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
public void setProfile(String profile) {
|
|
|
|
this.profile = profile;
|
|
|
|
}
|
|
|
|
|
2018-10-02 16:33:58 +02:00
|
|
|
public Date getCreationTime() {
|
2018-02-02 12:09:38 +01:00
|
|
|
return creationTime;
|
2017-12-19 15:09:49 +01:00
|
|
|
}
|
2018-10-02 16:33:58 +02:00
|
|
|
public void setCreationTime(Date creationTime) {
|
2018-02-02 12:09:38 +01:00
|
|
|
this.creationTime = creationTime;
|
2017-12-19 15:09:49 +01:00
|
|
|
}
|
|
|
|
|
2019-04-25 17:12:08 +02:00
|
|
|
public Date getModifiedTime() {
|
|
|
|
return modifiedTime;
|
|
|
|
}
|
|
|
|
public void setModifiedTime(Date modifiedTime) {
|
|
|
|
this.modifiedTime = modifiedTime;
|
|
|
|
}
|
|
|
|
|
2017-12-19 15:09:49 +01:00
|
|
|
public String getOrganisations() {
|
|
|
|
return organisations;
|
|
|
|
}
|
|
|
|
public void setOrganisations(String organisations) {
|
|
|
|
this.organisations = organisations;
|
|
|
|
}
|
|
|
|
|
2018-10-02 16:33:58 +02:00
|
|
|
public int getVersion() {
|
2017-12-19 15:09:49 +01:00
|
|
|
return version;
|
|
|
|
}
|
2018-10-02 16:33:58 +02:00
|
|
|
public void setVersion(int version) {
|
2017-12-19 15:09:49 +01:00
|
|
|
this.version = version;
|
|
|
|
}
|
|
|
|
|
2018-02-08 09:42:02 +01:00
|
|
|
public UUID getGroupId() {
|
|
|
|
return groupId;
|
|
|
|
}
|
|
|
|
public void setGroupId(UUID groupId) {
|
|
|
|
this.groupId = groupId;
|
|
|
|
}
|
|
|
|
|
2018-07-23 15:09:19 +02:00
|
|
|
public List<DatasetUrlListing> getDatasets() {
|
|
|
|
return datasets;
|
2018-01-23 16:21:38 +01:00
|
|
|
}
|
2018-07-23 15:09:19 +02:00
|
|
|
public void setDatasets(List<DatasetUrlListing> datasets) {
|
|
|
|
this.datasets = datasets;
|
2018-01-23 16:21:38 +01:00
|
|
|
}
|
|
|
|
|
2018-10-12 10:22:23 +02:00
|
|
|
public int getStatus() {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
public void setStatus(int status) {
|
|
|
|
this.status = status;
|
|
|
|
}
|
|
|
|
|
2019-04-26 16:08:41 +02:00
|
|
|
public List<AssociatedProfile> getAssociatedProfiles() {
|
|
|
|
return associatedProfiles;
|
|
|
|
}
|
|
|
|
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
|
|
|
this.associatedProfiles = associatedProfiles;
|
|
|
|
}
|
|
|
|
|
2019-05-06 11:41:13 +02:00
|
|
|
public List<UserInfoListingModel> getUsers() {
|
|
|
|
return users;
|
|
|
|
}
|
|
|
|
public void setUsers(List<UserInfoListingModel> users) {
|
|
|
|
this.users = users;
|
|
|
|
}
|
|
|
|
|
2019-05-09 11:42:51 +02:00
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2019-05-10 10:33:48 +02:00
|
|
|
public String getProjectAbbreviation() {
|
|
|
|
return projectAbbreviation;
|
2019-05-09 11:42:51 +02:00
|
|
|
}
|
2019-05-10 10:33:48 +02:00
|
|
|
public void setProjectAbbreviation(String projectAbbreviation) {
|
|
|
|
this.projectAbbreviation = projectAbbreviation;
|
2019-05-09 11:42:51 +02:00
|
|
|
}
|
|
|
|
|
2019-05-14 13:04:43 +02:00
|
|
|
public String getProjectId() {
|
|
|
|
return projectId;
|
|
|
|
}
|
|
|
|
public void setProjectId(String projectId) {
|
|
|
|
this.projectId = projectId;
|
|
|
|
}
|
|
|
|
|
2017-12-19 15:09:49 +01:00
|
|
|
@Override
|
2018-02-16 08:45:18 +01:00
|
|
|
public DataManagementPlanListingModel fromDataModel(DMP entity) {
|
2017-12-19 15:09:49 +01:00
|
|
|
this.id = entity.getId().toString();
|
|
|
|
this.label = entity.getLabel();
|
2019-01-31 14:56:53 +01:00
|
|
|
this.groupId = entity.getGroupId();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public DataManagementPlanListingModel fromDataModelDatasets(DMP entity) {
|
|
|
|
this.fromDataModel(entity);
|
2018-10-12 10:22:23 +02:00
|
|
|
this.status = entity.getStatus();
|
2019-01-31 14:56:53 +01:00
|
|
|
this.version = entity.getVersion();
|
|
|
|
this.project = entity.getProject().getLabel();
|
2018-02-16 11:34:02 +01:00
|
|
|
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
|
2018-10-02 16:33:58 +02:00
|
|
|
this.creationTime = entity.getCreated();
|
2019-04-25 17:12:08 +02:00
|
|
|
this.modifiedTime = entity.getModified();
|
2019-01-31 14:56:53 +01:00
|
|
|
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
|
2018-07-23 15:09:19 +02:00
|
|
|
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
|
2019-05-06 11:41:13 +02:00
|
|
|
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
2019-05-09 11:42:51 +02:00
|
|
|
this.description = entity.getDescription();
|
2019-05-10 10:33:48 +02:00
|
|
|
this.projectAbbreviation = entity.getProject().getAbbreviation();
|
2019-05-14 13:04:43 +02:00
|
|
|
this.projectId = entity.getProject().getId().toString();
|
2019-04-26 16:08:41 +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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-16 08:45:18 +01:00
|
|
|
return this;
|
2017-12-19 15:09:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public DMP toDataModel() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-01-19 10:31:05 +01:00
|
|
|
@Override
|
|
|
|
public String getHint() {
|
|
|
|
return "dataManagementPlanListingModel";
|
|
|
|
}
|
2017-12-19 15:09:49 +01:00
|
|
|
}
|