You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
2.7 KiB
Java
125 lines
2.7 KiB
Java
package eu.eudat.data.entities;
|
|
|
|
|
|
import eu.eudat.data.converters.DateToUTCConverter;
|
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
|
import org.hibernate.annotations.GenericGenerator;
|
|
import org.hibernate.annotations.Type;
|
|
|
|
import javax.persistence.*;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
|
|
|
|
@Entity
|
|
@Table(name = "\"DMPProfile\"")
|
|
public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
|
|
|
@Id
|
|
@GeneratedValue
|
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
|
private UUID id;
|
|
|
|
|
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
|
|
private Set<DMP> dmps;
|
|
|
|
|
|
@Column(name = "\"Label\"")
|
|
private String label;
|
|
|
|
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
|
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
private String definition;
|
|
|
|
|
|
@Column(name = "\"Status\"", nullable = false)
|
|
private int status;
|
|
|
|
|
|
@Column(name = "\"Created\"")
|
|
@Convert(converter = DateToUTCConverter.class)
|
|
private Date created = null;
|
|
|
|
@Column(name = "\"Modified\"")
|
|
@Convert(converter = DateToUTCConverter.class)
|
|
private Date modified = new Date();
|
|
|
|
public int getStatus() {
|
|
return status;
|
|
}
|
|
|
|
public void setStatus(int status) {
|
|
this.status = status;
|
|
}
|
|
|
|
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 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 getDefinition() {
|
|
return definition;
|
|
}
|
|
|
|
public void setDefinition(String definition) {
|
|
this.definition = definition;
|
|
}
|
|
|
|
public Set<DMP> getDmps() {
|
|
return dmps;
|
|
}
|
|
|
|
public void setDmps(Set<DMP> dmps) {
|
|
this.dmps = dmps;
|
|
}
|
|
|
|
@Override
|
|
public void update(DMPProfile entity) {
|
|
this.modified = new Date();
|
|
this.definition = entity.getDefinition();
|
|
this.label = entity.getLabel();
|
|
}
|
|
|
|
@Override
|
|
public UUID getKeys() {
|
|
return this.id;
|
|
}
|
|
|
|
@Override
|
|
public DMPProfile buildFromTuple(List<Tuple> tuple, String base) {
|
|
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
|
|
return this;
|
|
}
|
|
}
|