From 6ad4ea0083541f57693233e82b2146d117b63fb8 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 29 Jan 2025 14:13:34 +0400 Subject: [PATCH] Add aspirant model --- .../ru/ulstu/admin/model/AspirantForm.java | 110 ++++++++++++++++ .../ru/ulstu/aspirant/model/Aspirant.java | 121 ++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100644 src/main/java/ru/ulstu/admin/model/AspirantForm.java create mode 100644 src/main/java/ru/ulstu/aspirant/model/Aspirant.java diff --git a/src/main/java/ru/ulstu/admin/model/AspirantForm.java b/src/main/java/ru/ulstu/admin/model/AspirantForm.java new file mode 100644 index 0000000..6ac6e3c --- /dev/null +++ b/src/main/java/ru/ulstu/admin/model/AspirantForm.java @@ -0,0 +1,110 @@ +package ru.ulstu.admin.model; + +import ru.ulstu.aspirant.model.Base; +import ru.ulstu.aspirant.model.Speciality; +import ru.ulstu.indicator.model.Course; +import ru.ulstu.manager.model.Manager; + +import java.util.Date; + +public class AspirantForm { + private Integer id; + + private String surname; + + private String name; + + private String patronymic; + + private Course course; + + private Manager manager; + + private Date birthDate; + + private Speciality speciality; + + private String theme; + + private Base base; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPatronymic() { + return patronymic; + } + + public void setPatronymic(String patronymic) { + this.patronymic = patronymic; + } + + public Course getCourse() { + return course; + } + + public void setCourse(Course course) { + this.course = course; + } + + public Manager getManager() { + return manager; + } + + public void setManager(Manager manager) { + this.manager = manager; + } + + public Date getBirthDate() { + return birthDate; + } + + public void setBirthDate(Date birthDate) { + this.birthDate = birthDate; + } + + public Speciality getSpeciality() { + return speciality; + } + + public void setSpeciality(Speciality speciality) { + this.speciality = speciality; + } + + public String getTheme() { + return theme; + } + + public void setTheme(String theme) { + this.theme = theme; + } + + public Base getBase() { + return base; + } + + public void setBase(Base base) { + this.base = base; + } +} diff --git a/src/main/java/ru/ulstu/aspirant/model/Aspirant.java b/src/main/java/ru/ulstu/aspirant/model/Aspirant.java new file mode 100644 index 0000000..7a43c0a --- /dev/null +++ b/src/main/java/ru/ulstu/aspirant/model/Aspirant.java @@ -0,0 +1,121 @@ +package ru.ulstu.aspirant.model; + +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import ru.ulstu.admin.model.AspirantForm; +import ru.ulstu.indicator.model.Course; +import ru.ulstu.manager.model.Manager; +import ru.ulstu.model.BaseEntity; + +import java.util.Date; + +@Entity +public class Aspirant extends BaseEntity { + @NotEmpty + private String surname; + + @NotEmpty + private String name; + + private String patronymic; + + @NotNull + private Course course; + + @ManyToOne + private Manager manager; + + @Temporal(TemporalType.DATE) + private Date birthDate; + + @Enumerated(EnumType.STRING) + private Speciality speciality; + + private String theme; + + @Enumerated(EnumType.STRING) + private Base base; + + public Aspirant(AspirantForm aspirantForm) { + this.name = aspirantForm.getName(); + + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPatronymic() { + return patronymic; + } + + public void setPatronymic(String patronymic) { + this.patronymic = patronymic; + } + + public Course getCourse() { + return course; + } + + public void setCourse(Course course) { + this.course = course; + } + + public Manager getManager() { + return manager; + } + + public void setManager(Manager manager) { + this.manager = manager; + } + + public Date getBirthDate() { + return birthDate; + } + + public void setBirthDate(Date birthDate) { + this.birthDate = birthDate; + } + + public Speciality getSpeciality() { + return speciality; + } + + public void setSpeciality(Speciality speciality) { + this.speciality = speciality; + } + + public String getTheme() { + return theme; + } + + public void setTheme(String theme) { + this.theme = theme; + } + + public Base getBase() { + return base; + } + + public void setBase(Base base) { + this.base = base; + } +}