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-05-28 09:22:58 +02:00
|
|
|
import eu.eudat.data.entities.DatasetProfile;
|
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;
|
2019-07-31 16:57:34 +02:00
|
|
|
private String grant;
|
2017-12-19 15:09:49 +01:00
|
|
|
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-07-31 16:57:34 +02:00
|
|
|
private String grantAbbreviation;
|
|
|
|
private String grantId;
|
2019-06-24 16:06:54 +02:00
|
|
|
private Date finalizedAt;
|
|
|
|
private Boolean isPublic;
|
|
|
|
private Date publishedAt;
|
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;
|
|
|
|
}
|
|
|
|
|
2019-07-31 16:57:34 +02:00
|
|
|
public String getGrant() {
|
|
|
|
return grant;
|
2017-12-19 15:09:49 +01:00
|
|
|
}
|
2019-07-31 16:57:34 +02:00
|
|
|
public void setGrant(String grant) {
|
|
|
|
this.grant = grant;
|
2017-12-19 15:09:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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-07-31 16:57:34 +02:00
|
|
|
public String getGrantAbbreviation() {
|
|
|
|
return grantAbbreviation;
|
2019-05-09 11:42:51 +02:00
|
|
|
}
|
2019-07-31 16:57:34 +02:00
|
|
|
public void setGrantAbbreviation(String grantAbbreviation) {
|
|
|
|
this.grantAbbreviation = grantAbbreviation;
|
2019-05-09 11:42:51 +02:00
|
|
|
}
|
|
|
|
|
2019-07-31 16:57:34 +02:00
|
|
|
public String getGrantId() {
|
|
|
|
return grantId;
|
2019-05-14 13:04:43 +02:00
|
|
|
}
|
2019-07-31 16:57:34 +02:00
|
|
|
public void setGrantId(String grantId) {
|
|
|
|
this.grantId = grantId;
|
2019-05-14 13:04:43 +02:00
|
|
|
}
|
|
|
|
|
2019-06-24 16:06:54 +02:00
|
|
|
public Date getFinalizedAt() {
|
|
|
|
return finalizedAt;
|
2019-06-04 11:00:50 +02:00
|
|
|
}
|
2019-06-24 16:06:54 +02:00
|
|
|
public void setFinalizedAt(Date finalizedAt) {
|
|
|
|
this.finalizedAt = finalizedAt;
|
2019-06-04 11:00:50 +02:00
|
|
|
}
|
|
|
|
|
2019-06-24 16:06:54 +02:00
|
|
|
public Boolean getPublic() {
|
|
|
|
return isPublic;
|
|
|
|
}
|
|
|
|
public void setPublic(Boolean aPublic) {
|
|
|
|
isPublic = aPublic;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getPublishedAt() {
|
|
|
|
return publishedAt;
|
|
|
|
}
|
|
|
|
public void setPublishedAt(Date publishedAt) {
|
|
|
|
this.publishedAt = publishedAt;
|
|
|
|
}
|
2019-06-04 11:00:50 +02:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-11-07 15:37:07 +01:00
|
|
|
public DataManagementPlanListingModel fromDataModelAssociatedProfiles(DMP entity) {
|
|
|
|
this.id = entity.getId().toString();
|
|
|
|
this.label = entity.getLabel();
|
|
|
|
this.groupId = entity.getGroupId();
|
2020-01-16 15:00:58 +01:00
|
|
|
this.creationTime = entity.getCreated();
|
2019-11-07 15:37:07 +01:00
|
|
|
this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2020-01-21 11:40:15 +01:00
|
|
|
public DataManagementPlanListingModel fromDataModelAutoComplete(DMP entity) {
|
|
|
|
this.id = entity.getId().toString();
|
|
|
|
this.label = entity.getLabel();
|
|
|
|
this.groupId = entity.getGroupId();
|
|
|
|
this.creationTime = entity.getCreated();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2019-01-31 14:56:53 +01:00
|
|
|
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();
|
2019-07-31 16:57:34 +02:00
|
|
|
this.grant = entity.getGrant().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-07-31 16:57:34 +02:00
|
|
|
this.grantAbbreviation = entity.getGrant().getAbbreviation();
|
|
|
|
this.grantId = entity.getGrant().getId().toString();
|
2019-06-24 16:06:54 +02:00
|
|
|
this.finalizedAt = entity.getFinalizedAt();
|
|
|
|
this.isPublic = entity.isPublic();
|
|
|
|
this.publishedAt = entity.getPublishedAt();
|
2019-04-26 16:08:41 +02:00
|
|
|
|
|
|
|
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
2019-05-28 09:22:58 +02:00
|
|
|
this.associatedProfiles = new LinkedList<>();
|
|
|
|
for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) {
|
|
|
|
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile);
|
|
|
|
this.associatedProfiles.add(associatedProfile);
|
|
|
|
}
|
2019-04-26 16:08:41 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|