From fa1c4a9c1c178ab8107ecad4caef1bdd139c523d Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 18 Dec 2018 22:42:34 +0400 Subject: [PATCH] add statuses --- src/main/java/ru/ulstu/paper/model/Paper.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index a1074c0..e44912f 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -1,5 +1,7 @@ package ru.ulstu.paper.model; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.core.model.UserContainer; @@ -16,10 +18,9 @@ import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.persistence.OneToMany; -import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; @@ -33,9 +34,11 @@ public class Paper extends BaseEntity implements UserContainer { public enum PaperStatus { ATTENTION("Обратить внимание"), ON_PREPARATION("На подготовке"), - ON_REVIEW("На проверке"), + ON_REVIEW("Отправлена на проверку"), + ACCEPTED("Принята"), + NOT_ACCEPTED("Не принята"), + COMPLETED("Завершена (опубликована)"), DRAFT("Черновик"), - COMPLETED("Завершена"), FAILED("Провалены сроки"); private String statusName; @@ -64,7 +67,8 @@ public class Paper extends BaseEntity implements UserContainer { private Date updateDate = new Date(); @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) - @JoinColumn(name = "paper_id") + @JoinColumn(name = "paper_id", unique = true) + @Fetch(FetchMode.SUBSELECT) private List deadlines = new ArrayList<>(); private String comment;