2018-03-21 11:57:56 +01:00
|
|
|
package eu.eudat.data.entities;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
|
2018-10-02 16:33:58 +02:00
|
|
|
import eu.eudat.data.converters.DateToUTCConverter;
|
2018-03-21 11:16:32 +01:00
|
|
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
2017-09-14 12:37:36 +02:00
|
|
|
import org.hibernate.annotations.GenericGenerator;
|
|
|
|
|
2018-02-16 11:34:02 +01:00
|
|
|
import javax.persistence.*;
|
|
|
|
import java.util.*;
|
2018-10-02 16:33:58 +02:00
|
|
|
import java.util.stream.Collectors;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
@Entity
|
2018-01-11 17:19:15 +01:00
|
|
|
@Table(name = "\"DMP\"")
|
2018-01-02 09:36:40 +01:00
|
|
|
@NamedEntityGraphs({
|
2018-01-11 17:19:15 +01:00
|
|
|
@NamedEntityGraph(
|
2018-01-19 10:31:05 +01:00
|
|
|
name = "dataManagementPlanListingModel",
|
2019-05-28 10:10:42 +02:00
|
|
|
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
|
2019-07-31 16:57:34 +02:00
|
|
|
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")},
|
2019-05-10 10:33:48 +02:00
|
|
|
subgraphs = {
|
|
|
|
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
|
|
|
}
|
2018-01-19 10:31:05 +01:00
|
|
|
),
|
2018-01-11 17:19:15 +01:00
|
|
|
@NamedEntityGraph(
|
|
|
|
name = "fullyDetailed",
|
|
|
|
attributeNodes = {
|
2019-07-31 16:57:34 +02:00
|
|
|
@NamedAttributeNode("grant"), @NamedAttributeNode("profile"),
|
2018-03-19 13:40:04 +01:00
|
|
|
@NamedAttributeNode("users"), @NamedAttributeNode("organisations"), @NamedAttributeNode("researchers")}),
|
|
|
|
@NamedEntityGraph(
|
|
|
|
name = "dmpRecentActivity",
|
|
|
|
attributeNodes = {
|
2020-07-03 12:55:25 +02:00
|
|
|
@NamedAttributeNode("users"), @NamedAttributeNode("creator")}),
|
|
|
|
@NamedEntityGraph(
|
|
|
|
name = "recentDmpModel",
|
|
|
|
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
|
|
|
|
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode(value = "dataset", subgraph = "dataset")},
|
|
|
|
subgraphs = {
|
|
|
|
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
|
|
|
@NamedSubgraph(name = "dataset", attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("label")})
|
|
|
|
}
|
2020-07-09 12:11:43 +02:00
|
|
|
),
|
|
|
|
@NamedEntityGraph(
|
|
|
|
name = "versionListingModel",
|
|
|
|
attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("groupId"), @NamedAttributeNode("version")}
|
2020-07-03 12:55:25 +02:00
|
|
|
)
|
2020-07-09 12:11:43 +02:00
|
|
|
|
2018-01-02 09:36:40 +01:00
|
|
|
})
|
2018-03-19 13:40:04 +01:00
|
|
|
public class DMP implements DataEntity<DMP, UUID> {
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-02-07 10:56:30 +01:00
|
|
|
public enum DMPStatus {
|
2018-10-11 13:22:03 +02:00
|
|
|
ACTIVE((short) 0), FINALISED((short) 1),DELETED((short) 99);
|
2018-02-07 10:56:30 +01:00
|
|
|
|
|
|
|
private short value;
|
|
|
|
|
|
|
|
private DMPStatus(short value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public short getValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static DMPStatus fromInteger(short value) {
|
|
|
|
switch (value) {
|
|
|
|
case 0:
|
|
|
|
return ACTIVE;
|
|
|
|
case 1:
|
2018-10-11 13:22:03 +02:00
|
|
|
return FINALISED;
|
|
|
|
case 99:
|
2018-02-07 10:56:30 +01:00
|
|
|
return DELETED;
|
|
|
|
default:
|
|
|
|
throw new RuntimeException("Unsupported DMP Status");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public static Set<String> getHints() {
|
|
|
|
return hints;
|
|
|
|
}
|
2018-01-02 09:36:40 +01:00
|
|
|
|
2018-01-19 10:31:05 +01:00
|
|
|
private static final Set<String> hints = new HashSet<>(Arrays.asList("dataManagementPlanListingModel", "fullyDetailed"));
|
2018-01-11 17:19:15 +01:00
|
|
|
|
|
|
|
@Id
|
|
|
|
@GeneratedValue
|
2017-09-14 12:37:36 +02:00
|
|
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
|
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
2018-01-11 17:19:15 +01:00
|
|
|
private UUID id;
|
|
|
|
|
2018-02-08 09:42:02 +01:00
|
|
|
@Column(name = "\"GroupId\"", columnDefinition = "BINARY(16)")
|
|
|
|
private UUID groupId;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
@Column(name = "\"Label\"")
|
|
|
|
private String label;
|
|
|
|
|
|
|
|
@Column(name = "\"Version\"")
|
|
|
|
private Integer version;
|
|
|
|
|
|
|
|
@OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
|
|
|
|
private Set<Dataset> dataset;
|
|
|
|
|
|
|
|
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
2019-07-31 16:57:34 +02:00
|
|
|
@JoinColumn(name = "\"Grant\"")
|
|
|
|
private Grant grant;
|
2018-01-11 17:19:15 +01:00
|
|
|
|
|
|
|
|
2019-05-28 09:22:58 +02:00
|
|
|
/*@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
2018-01-11 17:19:15 +01:00
|
|
|
@Column(name = "\"AssociatedDmps\"", columnDefinition = "xml", nullable = true)
|
2019-05-28 09:22:58 +02:00
|
|
|
private String associatedDmps;*/
|
2019-05-28 10:10:42 +02:00
|
|
|
@OneToMany(fetch = FetchType.LAZY)
|
2019-05-28 09:22:58 +02:00
|
|
|
@JoinTable(name = "\"DMPDatasetProfile\"",
|
|
|
|
joinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")},
|
|
|
|
inverseJoinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")}
|
|
|
|
)
|
2019-05-29 11:02:47 +02:00
|
|
|
private Set<DatasetProfile> associatedDmps;
|
2019-05-28 09:22:58 +02:00
|
|
|
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
2017-09-14 12:37:36 +02:00
|
|
|
@JoinColumn(name = "\"Profile\"")
|
2018-01-11 17:19:15 +01:00
|
|
|
private DMPProfile profile;
|
|
|
|
|
|
|
|
|
2018-03-19 13:40:04 +01:00
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
2017-11-17 20:03:17 +01:00
|
|
|
@JoinColumn(name = "\"Creator\"")
|
2018-01-11 17:19:15 +01:00
|
|
|
private UserInfo creator;
|
|
|
|
|
|
|
|
|
|
|
|
@OneToMany(fetch = FetchType.LAZY)
|
|
|
|
@JoinTable(name = "\"DMPOrganisation\"",
|
|
|
|
joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
|
|
|
|
inverseJoinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")}
|
|
|
|
)
|
2017-09-14 12:37:36 +02:00
|
|
|
private Set<Organisation> organisations;
|
2018-01-11 17:19:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
@OneToMany(fetch = FetchType.LAZY)
|
|
|
|
@JoinTable(name = "\"DMPResearcher\"",
|
|
|
|
joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
|
|
|
|
inverseJoinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")}
|
|
|
|
)
|
2017-09-14 12:37:36 +02:00
|
|
|
private Set<Researcher> researchers;
|
2018-01-11 17:19:15 +01:00
|
|
|
|
|
|
|
|
2019-05-10 10:33:48 +02:00
|
|
|
@OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
|
|
|
|
/*@OneToMany(fetch = FetchType.LAZY)
|
2018-01-11 17:19:15 +01:00
|
|
|
@JoinTable(name = "\"UserDMP\"",
|
|
|
|
joinColumns = {@JoinColumn(name = "dmp", referencedColumnName = "\"ID\"")},
|
|
|
|
inverseJoinColumns = {@JoinColumn(name = "usr", referencedColumnName = "id")}
|
2019-05-10 10:33:48 +02:00
|
|
|
)*/
|
|
|
|
private Set<UserDMP> users;
|
2017-11-07 13:20:13 +01:00
|
|
|
|
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
@Column(name = "\"Status\"", nullable = false)
|
|
|
|
private Short status;
|
2017-11-17 01:43:16 +01:00
|
|
|
|
2018-03-28 15:24:47 +02:00
|
|
|
@Column(name = "\"Properties\"")
|
|
|
|
private String properties;
|
|
|
|
|
|
|
|
@Column(name = "\"DmpProperties\"")
|
|
|
|
private String dmpProperties;
|
2017-11-17 01:43:16 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
@Column(name = "\"Created\"")
|
2018-10-02 16:33:58 +02:00
|
|
|
@Convert(converter = DateToUTCConverter.class)
|
2018-01-11 17:19:15 +01:00
|
|
|
private Date created = null;
|
2017-11-17 01:43:16 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
@Column(name = "\"Modified\"")
|
2018-10-02 16:33:58 +02:00
|
|
|
@Convert(converter = DateToUTCConverter.class)
|
2018-01-11 17:19:15 +01:00
|
|
|
private Date modified = new Date();
|
2017-11-17 01:43:16 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
@Column(name = "\"Description\"")
|
|
|
|
private String description;
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2019-06-24 16:01:24 +02:00
|
|
|
@Column(name= "\"FinalizedAt\"")
|
2019-06-04 11:00:50 +02:00
|
|
|
@Convert(converter = DateToUTCConverter.class)
|
2019-06-24 16:01:24 +02:00
|
|
|
private Date finalizedAt;
|
2019-06-04 11:00:50 +02:00
|
|
|
|
2019-06-19 16:32:54 +02:00
|
|
|
@Column(name = "\"isPublic\"", nullable = false)
|
|
|
|
private boolean isPublic;
|
|
|
|
|
2019-06-24 16:01:24 +02:00
|
|
|
@Column(name= "\"PublishedAt\"")
|
2019-06-19 16:32:54 +02:00
|
|
|
@Convert(converter = DateToUTCConverter.class)
|
2019-06-24 16:01:24 +02:00
|
|
|
private Date publishedAt;
|
2019-06-19 16:32:54 +02:00
|
|
|
|
2019-07-05 13:08:24 +02:00
|
|
|
@Column(name = "\"DOI\"")
|
|
|
|
private String doi;
|
|
|
|
|
2019-08-02 10:27:12 +02:00
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
|
|
@JoinColumn(name = "\"Project\"")
|
|
|
|
private Project project;
|
|
|
|
|
2020-06-03 11:13:31 +02:00
|
|
|
@Column(name = "\"extraProperties\"")
|
|
|
|
private String extraProperties;
|
|
|
|
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public UserInfo getCreator() {
|
|
|
|
return creator;
|
|
|
|
}
|
|
|
|
public void setCreator(UserInfo creator) {
|
|
|
|
this.creator = creator;
|
|
|
|
}
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public Short getStatus() {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
public void setStatus(Short status) {
|
|
|
|
this.status = status;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public Date getCreated() {
|
|
|
|
return created;
|
|
|
|
}
|
|
|
|
public void setCreated(Date created) {
|
|
|
|
this.created = created;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public Date getModified() {
|
|
|
|
return modified;
|
|
|
|
}
|
|
|
|
public void setModified(Date modified) {
|
|
|
|
this.modified = modified;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-10 10:33:48 +02:00
|
|
|
public Set<UserDMP> getUsers() {
|
2018-01-11 17:19:15 +01:00
|
|
|
return users;
|
|
|
|
}
|
2019-05-10 10:33:48 +02:00
|
|
|
public void setUsers(Set<UserDMP> users) {
|
2018-01-11 17:19:15 +01:00
|
|
|
this.users = users;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public UUID getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
public void setId(UUID id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2018-02-08 09:42:02 +01:00
|
|
|
public UUID getGroupId() {
|
|
|
|
return groupId;
|
2018-01-11 17:19:15 +01:00
|
|
|
}
|
2018-02-08 09:42:02 +01:00
|
|
|
public void setGroupId(UUID groupId) {
|
|
|
|
this.groupId = groupId;
|
2018-01-11 17:19:15 +01:00
|
|
|
}
|
2017-12-17 22:34:24 +01:00
|
|
|
|
2018-01-11 17:19:15 +01:00
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Integer getVersion() {
|
|
|
|
return version;
|
|
|
|
}
|
|
|
|
public void setVersion(Integer version) {
|
|
|
|
this.version = version;
|
|
|
|
}
|
|
|
|
|
2019-07-31 16:57:34 +02:00
|
|
|
public Grant getGrant() {
|
|
|
|
return grant;
|
2018-01-11 17:19:15 +01:00
|
|
|
}
|
2019-07-31 16:57:34 +02:00
|
|
|
public void setGrant(Grant grant) {
|
|
|
|
this.grant = grant;
|
2018-01-11 17:19:15 +01:00
|
|
|
}
|
|
|
|
|
2019-05-29 11:02:47 +02:00
|
|
|
public Set<DatasetProfile> getAssociatedDmps() {
|
2018-01-11 17:19:15 +01:00
|
|
|
return associatedDmps;
|
|
|
|
}
|
2019-05-29 11:02:47 +02:00
|
|
|
public void setAssociatedDmps(Set<DatasetProfile> associatedDmps) {
|
2018-01-11 17:19:15 +01:00
|
|
|
this.associatedDmps = associatedDmps;
|
|
|
|
}
|
|
|
|
|
|
|
|
public DMPProfile getProfile() {
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
public void setProfile(DMPProfile profile) {
|
|
|
|
this.profile = profile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Set<Dataset> getDataset() {
|
|
|
|
return dataset;
|
|
|
|
}
|
|
|
|
public void setDataset(Set<Dataset> dataset) {
|
|
|
|
this.dataset = dataset;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Set<Organisation> getOrganisations() {
|
|
|
|
return organisations;
|
|
|
|
}
|
|
|
|
public void setOrganisations(Set<Organisation> organisations) {
|
|
|
|
this.organisations = organisations;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Set<Researcher> getResearchers() {
|
|
|
|
return researchers;
|
|
|
|
}
|
|
|
|
public void setResearchers(Set<Researcher> researchers) {
|
|
|
|
this.researchers = researchers;
|
|
|
|
}
|
|
|
|
|
2018-03-28 15:24:47 +02:00
|
|
|
public String getProperties() {
|
|
|
|
return properties;
|
|
|
|
}
|
|
|
|
public void setProperties(String properties) {
|
|
|
|
this.properties = properties;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDmpProperties() {
|
|
|
|
return dmpProperties;
|
|
|
|
}
|
|
|
|
public void setDmpProperties(String dmpProperties) {
|
|
|
|
this.dmpProperties = dmpProperties;
|
|
|
|
}
|
|
|
|
|
2019-06-24 16:01:24 +02:00
|
|
|
public Date getFinalizedAt() {
|
|
|
|
return finalizedAt;
|
2019-06-04 11:00:50 +02:00
|
|
|
}
|
2019-06-24 16:01:24 +02:00
|
|
|
public void setFinalizedAt(Date finalizedAt) {
|
|
|
|
this.finalizedAt = finalizedAt;
|
2019-06-04 11:00:50 +02:00
|
|
|
}
|
|
|
|
|
2019-06-19 16:32:54 +02:00
|
|
|
public boolean isPublic() {
|
|
|
|
return isPublic;
|
|
|
|
}
|
|
|
|
public void setPublic(boolean aPublic) {
|
|
|
|
isPublic = aPublic;
|
|
|
|
}
|
|
|
|
|
2019-06-24 16:01:24 +02:00
|
|
|
public Date getPublishedAt() {
|
|
|
|
return publishedAt;
|
2019-06-19 16:32:54 +02:00
|
|
|
}
|
2019-06-24 16:01:24 +02:00
|
|
|
public void setPublishedAt(Date publishedAt) {
|
|
|
|
this.publishedAt = publishedAt;
|
2019-06-19 16:32:54 +02:00
|
|
|
}
|
|
|
|
|
2019-07-05 13:08:24 +02:00
|
|
|
public String getDoi() {
|
|
|
|
return doi;
|
|
|
|
}
|
|
|
|
public void setDoi(String doi) {
|
|
|
|
this.doi = doi;
|
|
|
|
}
|
|
|
|
|
2019-08-02 10:27:12 +02:00
|
|
|
public Project getProject() {
|
|
|
|
return project;
|
|
|
|
}
|
|
|
|
public void setProject(Project project) {
|
|
|
|
this.project = project;
|
|
|
|
}
|
|
|
|
|
2020-06-03 11:13:31 +02:00
|
|
|
public String getExtraProperties() {
|
|
|
|
return extraProperties;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setExtraProperties(String extraProperties) {
|
|
|
|
this.extraProperties = extraProperties;
|
|
|
|
}
|
|
|
|
|
2019-08-02 10:27:12 +02:00
|
|
|
@Override
|
2018-01-11 17:19:15 +01:00
|
|
|
public void update(DMP entity) {
|
2018-02-16 11:34:02 +01:00
|
|
|
this.associatedDmps = entity.associatedDmps;
|
2018-01-11 17:19:15 +01:00
|
|
|
this.label = entity.getLabel();
|
2018-03-28 15:24:47 +02:00
|
|
|
this.profile = entity.getProfile();
|
2018-01-11 17:19:15 +01:00
|
|
|
this.status = entity.getStatus();
|
|
|
|
this.created = entity.created;
|
2018-03-28 15:24:47 +02:00
|
|
|
this.properties = entity.getProperties();
|
2019-07-31 16:57:34 +02:00
|
|
|
this.grant = entity.getGrant();
|
2018-01-11 17:19:15 +01:00
|
|
|
this.description = entity.getDescription();
|
|
|
|
this.researchers = entity.getResearchers();
|
|
|
|
this.organisations = entity.getOrganisations();
|
2018-03-28 15:24:47 +02:00
|
|
|
this.dmpProperties = entity.getDmpProperties();
|
2019-06-19 16:32:54 +02:00
|
|
|
this.isPublic = entity.isPublic;
|
2019-08-02 10:27:12 +02:00
|
|
|
this.project = entity.getProject();
|
2018-03-19 13:40:04 +01:00
|
|
|
this.setModified(new Date());
|
2019-06-24 16:01:24 +02:00
|
|
|
if (entity.getStatus().equals(DMPStatus.FINALISED.getValue())) this.setFinalizedAt(new Date());
|
|
|
|
if (entity.isPublic) this.setPublishedAt(new Date());
|
2018-01-11 17:19:15 +01:00
|
|
|
if (entity.getUsers() != null) this.users = entity.getUsers();
|
2019-07-05 13:08:24 +02:00
|
|
|
if (entity.getDoi() != null && entity.getDoi().trim().isEmpty()) this.doi = entity.doi;
|
2020-06-03 11:13:31 +02:00
|
|
|
this.extraProperties = entity.getExtraProperties();
|
2018-01-11 17:19:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-02-20 08:50:17 +01:00
|
|
|
public UUID getKeys() {
|
|
|
|
return this.id;
|
2018-01-11 17:19:15 +01:00
|
|
|
}
|
2017-12-17 22:34:24 +01:00
|
|
|
|
2018-10-02 16:33:58 +02:00
|
|
|
@Override
|
2019-05-29 10:54:07 +02:00
|
|
|
public DMP buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
2018-10-02 16:33:58 +02:00
|
|
|
this.id = tuple.get(0).get(base.isEmpty() ? "id" : base + "." + "id", UUID.class);
|
2019-05-29 10:54:07 +02:00
|
|
|
this.dataset = tuple.stream().map(x -> new Dataset().buildFromTuple(tuple, fields ,base.isEmpty() ? "dataset" : base + "." + "dataset")).collect(Collectors.toSet());
|
|
|
|
this.creator = tuple.stream().map(x -> new UserInfo().buildFromTuple(tuple, fields , base.isEmpty() ? "creator" : base + "." + "creator")).collect(Collectors.toList()).get(0);
|
2018-10-02 16:33:58 +02:00
|
|
|
return this;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|