2018-03-21 11:57:56 +01:00
|
|
|
package eu.eudat.data.entities;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
import eu.eudat.data.entities.helpers.EntityBinder;
|
2018-03-21 11:16:32 +01:00
|
|
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
2018-02-16 11:34:02 +01:00
|
|
|
import org.hibernate.annotations.Type;
|
|
|
|
|
|
|
|
import javax.persistence.*;
|
2017-09-14 12:37:36 +02:00
|
|
|
import java.io.Serializable;
|
2017-11-02 17:17:56 +01:00
|
|
|
import java.util.Date;
|
2018-10-02 16:33:58 +02:00
|
|
|
import java.util.List;
|
2017-09-14 12:37:36 +02:00
|
|
|
import java.util.Set;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
2017-10-17 13:45:11 +02:00
|
|
|
@Entity
|
2018-02-16 11:34:02 +01:00
|
|
|
@Table(name = "\"DataRepository\"")
|
2019-05-21 17:17:41 +02:00
|
|
|
public class DataRepository implements Serializable, DataEntity<DataRepository, UUID> {
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Id
|
|
|
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
|
|
|
private UUID id;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Label\"")
|
|
|
|
private String label;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Abbreviation\"")
|
|
|
|
private String abbreviation;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Reference\"", nullable = false)
|
|
|
|
private String reference;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Uri\"")
|
|
|
|
private String uri;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
|
|
|
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
|
|
private String definition;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@OneToMany(mappedBy = "dataRepository", cascade = CascadeType.ALL, orphanRemoval = true)
|
|
|
|
private Set<DatasetDataRepository> datasetDataRepositories;
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Status\"", nullable = false)
|
|
|
|
private Short status;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Created\"")
|
|
|
|
private Date created = null;
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Column(name = "\"Modified\"")
|
|
|
|
private Date modified = new Date();
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-09-25 12:43:17 +02:00
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
|
|
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
|
|
|
private UserInfo creationUser;
|
|
|
|
|
2018-02-16 11:34:02 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public Short getStatus() {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
public void setStatus(Short status) {
|
|
|
|
this.status = status;
|
|
|
|
}
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public Date getCreated() {
|
|
|
|
return created;
|
|
|
|
}
|
|
|
|
public void setCreated(Date created) {
|
|
|
|
this.created = created;
|
|
|
|
}
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public Date getModified() {
|
|
|
|
return modified;
|
|
|
|
}
|
|
|
|
public void setModified(Date modified) {
|
|
|
|
this.modified = modified;
|
|
|
|
}
|
2017-11-02 17:17:56 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public UUID getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
public void setId(UUID id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public String getAbbreviation() {
|
|
|
|
return abbreviation;
|
|
|
|
}
|
|
|
|
public void setAbbreviation(String abbreviation) {
|
|
|
|
this.abbreviation = abbreviation;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public String getReference() {
|
|
|
|
return reference;
|
|
|
|
}
|
|
|
|
public void setReference(String reference) {
|
|
|
|
this.reference = reference;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public String getUri() {
|
|
|
|
return uri;
|
|
|
|
}
|
|
|
|
public void setUri(String uri) {
|
|
|
|
this.uri = uri;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public String getDefinition() {
|
|
|
|
return definition;
|
|
|
|
}
|
|
|
|
public void setDefinition(String definition) {
|
|
|
|
this.definition = definition;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
public Set<DatasetDataRepository> getDatasetDataRepositories() {
|
|
|
|
return datasetDataRepositories;
|
|
|
|
}
|
|
|
|
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
|
|
|
|
this.datasetDataRepositories = datasetDataRepositories;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2019-09-25 12:43:17 +02:00
|
|
|
public UserInfo getCreationUser() {
|
|
|
|
return creationUser;
|
|
|
|
}
|
|
|
|
public void setCreationUser(UserInfo creationUser) {
|
|
|
|
this.creationUser = creationUser;
|
|
|
|
}
|
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Override
|
|
|
|
public void update(DataRepository entity) {
|
2017-12-17 22:34:24 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
}
|
2017-12-17 22:34:24 +01:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Override
|
|
|
|
public UUID getKeys() {
|
|
|
|
return this.id;
|
|
|
|
}
|
2018-10-02 16:33:58 +02:00
|
|
|
|
2019-05-21 17:17:41 +02:00
|
|
|
@Override
|
|
|
|
public DataRepository buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
|
|
|
String currentBase = base.isEmpty() ? "" : base + ".";
|
|
|
|
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
|
|
|
return this;
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|