add statuses

This commit is contained in:
Anton Romanov 2018-12-18 22:42:34 +04:00
parent 503f7f68bc
commit fa1c4a9c1c

View File

@ -1,5 +1,7 @@
package ru.ulstu.paper.model; package ru.ulstu.paper.model;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotBlank;
import ru.ulstu.core.model.BaseEntity; import ru.ulstu.core.model.BaseEntity;
import ru.ulstu.core.model.UserContainer; import ru.ulstu.core.model.UserContainer;
@ -16,10 +18,9 @@ import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
@ -33,9 +34,11 @@ public class Paper extends BaseEntity implements UserContainer {
public enum PaperStatus { public enum PaperStatus {
ATTENTION("Обратить внимание"), ATTENTION("Обратить внимание"),
ON_PREPARATION("На подготовке"), ON_PREPARATION("На подготовке"),
ON_REVIEW("На проверке"), ON_REVIEW("Отправлена на проверку"),
ACCEPTED("Принята"),
NOT_ACCEPTED("Не принята"),
COMPLETED("Завершена (опубликована)"),
DRAFT("Черновик"), DRAFT("Черновик"),
COMPLETED("Завершена"),
FAILED("Провалены сроки"); FAILED("Провалены сроки");
private String statusName; private String statusName;
@ -64,7 +67,8 @@ public class Paper extends BaseEntity implements UserContainer {
private Date updateDate = new Date(); private Date updateDate = new Date();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "paper_id") @JoinColumn(name = "paper_id", unique = true)
@Fetch(FetchMode.SUBSELECT)
private List<Deadline> deadlines = new ArrayList<>(); private List<Deadline> deadlines = new ArrayList<>();
private String comment; private String comment;