Generate question bank domain model from JDL

This commit is contained in:
jieun committed 2026-10-20 18:46:29 +09:00
1 parent 1d97cc4e31
commit 1d74d8f04b
160 files changed
+26900 -2

No files matched your search

@@ -0,0 +1,212 @@
package com.example.questionbank.domain;
import com.example.questionbank.domain.enumeration.OptionKey;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import java.io.Serial;
import java.io.Serializable;
/**
* A ExamAnswer.
*/
@Entity
@Table(name = "exam_answer")
@SuppressWarnings("common-java:DuplicatedBlocks")
public class ExamAnswer implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
@Column(name = "id")
private Long id;
@NotNull
@Size(max = 2000)
@Column(name = "question_text_snapshot", length = 2000, nullable = false)
private String questionTextSnapshot;
@Size(max = 2000)
@Column(name = "explanation_snapshot", length = 2000)
private String explanationSnapshot;
@Enumerated(EnumType.STRING)
@Column(name = "selected_option")
private OptionKey selectedOption;
@Size(max = 500)
@Column(name = "selected_content_snapshot", length = 500)
private String selectedContentSnapshot;
@Column(name = "correct")
private Boolean correct;
@Min(value = 0)
@Column(name = "awarded_points")
private Integer awardedPoints;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties(value = { "choices", "subject" }, allowSetters = true)
private Question question;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties(value = { "answers", "subject", "user" }, allowSetters = true)
private ExamAttempt attempt;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return this.id;
}
public ExamAnswer id(Long id) {
this.setId(id);
return this;
}
public void setId(Long id) {
this.id = id;
}
public String getQuestionTextSnapshot() {
return this.questionTextSnapshot;
}
public ExamAnswer questionTextSnapshot(String questionTextSnapshot) {
this.setQuestionTextSnapshot(questionTextSnapshot);
return this;
}
public void setQuestionTextSnapshot(String questionTextSnapshot) {
this.questionTextSnapshot = questionTextSnapshot;
}
public String getExplanationSnapshot() {
return this.explanationSnapshot;
}
public ExamAnswer explanationSnapshot(String explanationSnapshot) {
this.setExplanationSnapshot(explanationSnapshot);
return this;
}
public void setExplanationSnapshot(String explanationSnapshot) {
this.explanationSnapshot = explanationSnapshot;
}
public OptionKey getSelectedOption() {
return this.selectedOption;
}
public ExamAnswer selectedOption(OptionKey selectedOption) {
this.setSelectedOption(selectedOption);
return this;
}
public void setSelectedOption(OptionKey selectedOption) {
this.selectedOption = selectedOption;
}
public String getSelectedContentSnapshot() {
return this.selectedContentSnapshot;
}
public ExamAnswer selectedContentSnapshot(String selectedContentSnapshot) {
this.setSelectedContentSnapshot(selectedContentSnapshot);
return this;
}
public void setSelectedContentSnapshot(String selectedContentSnapshot) {
this.selectedContentSnapshot = selectedContentSnapshot;
}
public Boolean getCorrect() {
return this.correct;
}
public ExamAnswer correct(Boolean correct) {
this.setCorrect(correct);
return this;
}
public void setCorrect(Boolean correct) {
this.correct = correct;
}
public Integer getAwardedPoints() {
return this.awardedPoints;
}
public ExamAnswer awardedPoints(Integer awardedPoints) {
this.setAwardedPoints(awardedPoints);
return this;
}
public void setAwardedPoints(Integer awardedPoints) {
this.awardedPoints = awardedPoints;
}
public Question getQuestion() {
return this.question;
}
public void setQuestion(Question question) {
this.question = question;
}
public ExamAnswer question(Question question) {
this.setQuestion(question);
return this;
}
public ExamAttempt getAttempt() {
return this.attempt;
}
public void setAttempt(ExamAttempt examAttempt) {
this.attempt = examAttempt;
}
public ExamAnswer attempt(ExamAttempt examAttempt) {
this.setAttempt(examAttempt);
return this;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ExamAnswer)) {
return false;
}
return getId() != null && getId().equals(((ExamAnswer) o).getId());
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "ExamAnswer{" +
"id=" + getId() +
", questionTextSnapshot='" + getQuestionTextSnapshot() + "'" +
", explanationSnapshot='" + getExplanationSnapshot() + "'" +
", selectedOption='" + getSelectedOption() + "'" +
", selectedContentSnapshot='" + getSelectedContentSnapshot() + "'" +
", correct='" + getCorrect() + "'" +
", awardedPoints=" + getAwardedPoints() +
"}";
}
}