141 lines
3.1 KiB
Java
141 lines
3.1 KiB
Java
package ru.ulstu.timeline.model;
|
||
|
||
import org.hibernate.validator.constraints.NotBlank;
|
||
import ru.ulstu.core.model.BaseEntity;
|
||
import ru.ulstu.user.model.User;
|
||
|
||
import javax.persistence.Column;
|
||
import javax.persistence.Entity;
|
||
import javax.persistence.EnumType;
|
||
import javax.persistence.Enumerated;
|
||
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.validation.constraints.NotNull;
|
||
import java.util.Date;
|
||
import java.util.List;
|
||
|
||
@Entity
|
||
public class Event extends BaseEntity {
|
||
public enum EventStatus {
|
||
POSSIBLE("Возможное"), NEW("Новое"), IN_PROGRESS("В процессе"), COMPLETED("Завершено");
|
||
|
||
private String name;
|
||
|
||
EventStatus(String name) {
|
||
this.name = name;
|
||
}
|
||
|
||
public String getName() {
|
||
return name;
|
||
}
|
||
}
|
||
|
||
@NotBlank
|
||
private String title;
|
||
|
||
@Enumerated(value = EnumType.STRING)
|
||
private PeriodEvent period;
|
||
|
||
@Enumerated(value = EnumType.STRING)
|
||
private EventStatus status;
|
||
|
||
@Column(name = "execute_date")
|
||
@Temporal(TemporalType.TIMESTAMP)
|
||
@NotNull
|
||
private Date executeDate;
|
||
|
||
@Column(name = "create_date")
|
||
@Temporal(TemporalType.TIMESTAMP)
|
||
private Date createDate;
|
||
|
||
@Column(name = "update_date")
|
||
@Temporal(TemporalType.TIMESTAMP)
|
||
private Date updateDate;
|
||
|
||
private String description;
|
||
|
||
@ManyToMany(fetch = FetchType.EAGER)
|
||
private List<User> recipients;
|
||
|
||
@ManyToOne
|
||
@JoinColumn(name = "child_id")
|
||
private Event child;
|
||
|
||
public String getTitle() {
|
||
return title;
|
||
}
|
||
|
||
public void setTitle(String title) {
|
||
this.title = title;
|
||
}
|
||
|
||
public Event.EventStatus getStatus() {
|
||
return status;
|
||
}
|
||
|
||
public void setStatus(EventStatus status) {
|
||
this.status = status;
|
||
}
|
||
|
||
public PeriodEvent getPeriod() {
|
||
return period;
|
||
}
|
||
|
||
public void setPeriod(PeriodEvent period) {
|
||
this.period = period;
|
||
}
|
||
|
||
public Date getCreateDate() {
|
||
return createDate;
|
||
}
|
||
|
||
public void setCreateDate(Date createDate) {
|
||
this.createDate = createDate;
|
||
}
|
||
|
||
public Date getUpdateDate() {
|
||
return updateDate;
|
||
}
|
||
|
||
public void setUpdateDate(Date updateDate) {
|
||
this.updateDate = updateDate;
|
||
}
|
||
|
||
public String getDescription() {
|
||
return description;
|
||
}
|
||
|
||
public void setDescription(String description) {
|
||
this.description = description;
|
||
}
|
||
|
||
public List<User> getRecipients() {
|
||
return recipients;
|
||
}
|
||
|
||
public void setRecipients(List<User> recipients) {
|
||
this.recipients = recipients;
|
||
}
|
||
|
||
public Date getExecuteDate() {
|
||
return executeDate;
|
||
}
|
||
|
||
public void setExecuteDate(Date executeDate) {
|
||
this.executeDate = executeDate;
|
||
}
|
||
|
||
public Event getChild() {
|
||
return child;
|
||
}
|
||
|
||
public void setChild(Event child) {
|
||
this.child = child;
|
||
}
|
||
}
|