174 lines
4.4 KiB
Java
174 lines
4.4 KiB
Java
package eu.eudat.migration.entities;
|
|
|
|
import org.hibernate.annotations.LazyCollection;
|
|
import org.hibernate.annotations.LazyCollectionOption;
|
|
|
|
import javax.persistence.*;
|
|
import java.util.*;
|
|
|
|
@Entity
|
|
@Table(name = "questions")
|
|
public class Question {
|
|
|
|
@Id
|
|
private Long id;
|
|
private String text;
|
|
@Column(name = "default_value")
|
|
private String defaultValue;
|
|
private Long number;
|
|
@Column(name = "created_at")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date createdAt;
|
|
@Column(name = "updated_at")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date updatedAt;
|
|
@ManyToOne(fetch = FetchType.EAGER)
|
|
@JoinColumn(name = "question_format_id")
|
|
private QuestionFormat questionFormat;
|
|
@Column(name = "option_comment_display")
|
|
private Boolean optionCommentDisplay;
|
|
private Boolean modifiable;
|
|
@Column(name = "versionable_id")
|
|
private String versionableId;
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
@JoinColumn(name = "question_id")
|
|
@OrderBy("number")
|
|
@LazyCollection(LazyCollectionOption.FALSE)
|
|
private List<QuestionOption> options = new ArrayList<>();
|
|
@OneToMany(cascade = CascadeType.ALL)
|
|
@JoinColumn(name = "question_id")
|
|
@OrderBy("number")
|
|
@LazyCollection(LazyCollectionOption.FALSE)
|
|
private List<Condition> conditions = new ArrayList<>();
|
|
@ManyToMany(cascade = CascadeType.ALL)
|
|
@JoinTable(name = "questions_themes",
|
|
joinColumns = {@JoinColumn(name = "question_id")},
|
|
inverseJoinColumns = {@JoinColumn(name = "theme_id")}
|
|
)
|
|
@LazyCollection(LazyCollectionOption.FALSE)
|
|
private Set<Theme> themes = new HashSet<>();
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Question{" +
|
|
"id=" + id +
|
|
", text='" + text + '\'' +
|
|
", defaultValue='" + defaultValue + '\'' +
|
|
", number=" + number +
|
|
", createdAt=" + createdAt +
|
|
", updatedAt=" + updatedAt +
|
|
", questionFormat=" + questionFormat +
|
|
", optionCommentDisplay=" + optionCommentDisplay +
|
|
", modifiable=" + modifiable +
|
|
", versionableId='" + versionableId + '\'' +
|
|
", options=" + options +
|
|
", conditions=" + conditions +
|
|
'}';
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getText() {
|
|
return text;
|
|
}
|
|
|
|
public void setText(String text) {
|
|
this.text = text;
|
|
}
|
|
|
|
public String getDefaultValue() {
|
|
return defaultValue;
|
|
}
|
|
|
|
public void setDefaultValue(String defaultValue) {
|
|
this.defaultValue = defaultValue;
|
|
}
|
|
|
|
public Long getNumber() {
|
|
return number;
|
|
}
|
|
|
|
public void setNumber(Long number) {
|
|
this.number = number;
|
|
}
|
|
|
|
public Date getCreatedAt() {
|
|
return createdAt;
|
|
}
|
|
|
|
public void setCreatedAt(Date createdAt) {
|
|
this.createdAt = createdAt;
|
|
}
|
|
|
|
public Date getUpdatedAt() {
|
|
return updatedAt;
|
|
}
|
|
|
|
public void setUpdatedAt(Date updatedAt) {
|
|
this.updatedAt = updatedAt;
|
|
}
|
|
|
|
public QuestionFormat getQuestionFormat() {
|
|
return questionFormat;
|
|
}
|
|
|
|
public void setQuestionFormat(QuestionFormat questionFormat) {
|
|
this.questionFormat = questionFormat;
|
|
}
|
|
|
|
public Boolean getOptionCommentDisplay() {
|
|
return optionCommentDisplay;
|
|
}
|
|
|
|
public void setOptionCommentDisplay(Boolean optionCommentDisplay) {
|
|
this.optionCommentDisplay = optionCommentDisplay;
|
|
}
|
|
|
|
public Boolean getModifiable() {
|
|
return modifiable;
|
|
}
|
|
|
|
public void setModifiable(Boolean modifiable) {
|
|
this.modifiable = modifiable;
|
|
}
|
|
|
|
public String getVersionableId() {
|
|
return versionableId;
|
|
}
|
|
|
|
public void setVersionableId(String versionableId) {
|
|
this.versionableId = versionableId;
|
|
}
|
|
|
|
public List<QuestionOption> getOptions() {
|
|
return options;
|
|
}
|
|
|
|
public void setOptions(List<QuestionOption> options) {
|
|
this.options = options;
|
|
}
|
|
|
|
|
|
public List<Condition> getConditions() {
|
|
return conditions;
|
|
}
|
|
|
|
public void setConditions(List<Condition> conditions) {
|
|
this.conditions = conditions;
|
|
}
|
|
|
|
public Set<Theme> getThemes() {
|
|
return themes;
|
|
}
|
|
|
|
public void setThemes(Set<Theme> themes) {
|
|
this.themes = themes;
|
|
}
|
|
}
|