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,162 @@
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 Choice.
*/
@Entity
@Table(name = "choice")
@SuppressWarnings("common-java:DuplicatedBlocks")
public class Choice 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
@Enumerated(EnumType.STRING)
@Column(name = "option_key", nullable = false)
private OptionKey optionKey;
@NotNull
@Size(max = 500)
@Column(name = "content", length = 500, nullable = false)
private String content;
@NotNull
@Min(value = 1)
@Max(value = 4)
@Column(name = "display_order", nullable = false)
private Integer displayOrder;
@NotNull
@Column(name = "correct", nullable = false)
private Boolean correct;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties(value = { "choices", "subject" }, allowSetters = true)
private Question question;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return this.id;
}
public Choice id(Long id) {
this.setId(id);
return this;
}
public void setId(Long id) {
this.id = id;
}
public OptionKey getOptionKey() {
return this.optionKey;
}
public Choice optionKey(OptionKey optionKey) {
this.setOptionKey(optionKey);
return this;
}
public void setOptionKey(OptionKey optionKey) {
this.optionKey = optionKey;
}
public String getContent() {
return this.content;
}
public Choice content(String content) {
this.setContent(content);
return this;
}
public void setContent(String content) {
this.content = content;
}
public Integer getDisplayOrder() {
return this.displayOrder;
}
public Choice displayOrder(Integer displayOrder) {
this.setDisplayOrder(displayOrder);
return this;
}
public void setDisplayOrder(Integer displayOrder) {
this.displayOrder = displayOrder;
}
public Boolean getCorrect() {
return this.correct;
}
public Choice correct(Boolean correct) {
this.setCorrect(correct);
return this;
}
public void setCorrect(Boolean correct) {
this.correct = correct;
}
public Question getQuestion() {
return this.question;
}
public void setQuestion(Question question) {
this.question = question;
}
public Choice question(Question question) {
this.setQuestion(question);
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 Choice)) {
return false;
}
return getId() != null && getId().equals(((Choice) 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 "Choice{" +
"id=" + getId() +
", optionKey='" + getOptionKey() + "'" +
", content='" + getContent() + "'" +
", displayOrder=" + getDisplayOrder() +
", correct='" + getCorrect() + "'" +
"}";
}
}