111 lines
2.5 KiB
Java
111 lines
2.5 KiB
Java
package eu.eudat.entities;
|
|
|
|
import org.hibernate.annotations.GenericGenerator;
|
|
|
|
import javax.persistence.*;
|
|
import java.util.Date;
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
|
|
|
|
@Entity
|
|
@Table(name = "\"ExternalDataset\"")
|
|
public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|
|
|
@Id
|
|
@GeneratedValue
|
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
|
private UUID id;
|
|
|
|
@Column(name = "\"Label\"", nullable = false)
|
|
private String label;
|
|
|
|
@Column(name = "\"Abbreviation\"", nullable = false)
|
|
private String abbreviation;
|
|
|
|
@Column(name = "\"Reference\"", nullable = false)
|
|
private String reference;
|
|
|
|
@Column(name = "\"Created\"", nullable = false)
|
|
private Date created;
|
|
|
|
@Column(name = "\"Modified\"", nullable = false)
|
|
private Date modified;
|
|
|
|
@OneToMany(fetch = FetchType.LAZY)
|
|
@JoinTable(name = "\"DatasetExternalDataset\"",
|
|
joinColumns = {@JoinColumn(name = "\"ExternalDataset\"", referencedColumnName = "\"Id\"")},
|
|
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
|
|
)
|
|
private Set<Dataset> datasets;
|
|
|
|
public UUID getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(UUID id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getLabel() {
|
|
return label;
|
|
}
|
|
|
|
public void setLabel(String label) {
|
|
this.label = label;
|
|
}
|
|
|
|
public String getAbbreviation() {
|
|
return abbreviation;
|
|
}
|
|
|
|
public void setAbbreviation(String abbreviation) {
|
|
this.abbreviation = abbreviation;
|
|
}
|
|
|
|
public String getReference() {
|
|
return reference;
|
|
}
|
|
|
|
public void setReference(String reference) {
|
|
this.reference = reference;
|
|
}
|
|
|
|
public Date getCreated() {
|
|
return created;
|
|
}
|
|
|
|
public void setCreated(Date created) {
|
|
this.created = created;
|
|
}
|
|
|
|
public Date getModified() {
|
|
return modified;
|
|
}
|
|
|
|
public void setModified(Date modified) {
|
|
this.modified = modified;
|
|
}
|
|
|
|
public Set<Dataset> getDatasets() {
|
|
return datasets;
|
|
}
|
|
|
|
public void setDatasets(Set<Dataset> datasets) {
|
|
this.datasets = datasets;
|
|
}
|
|
|
|
@Override
|
|
public void update(ExternalDataset entity) {
|
|
this.label = entity.getLabel();
|
|
this.abbreviation = entity.getAbbreviation();
|
|
this.modified = new Date();
|
|
}
|
|
|
|
@Override
|
|
public UUID getKeys() {
|
|
return this.id;
|
|
}
|
|
}
|