105 lines
2.6 KiB
Java
105 lines
2.6 KiB
Java
package ru.ulstu.deadline.model;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import ru.ulstu.core.model.BaseEntity;
|
|
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
import java.util.Date;
|
|
import java.util.Objects;
|
|
|
|
@Entity
|
|
public class Deadline extends BaseEntity {
|
|
|
|
private String description;
|
|
|
|
@Temporal(value = TemporalType.TIMESTAMP)
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
private Date date;
|
|
|
|
private String executor;
|
|
private Boolean done;
|
|
|
|
public Deadline() {
|
|
}
|
|
|
|
public Deadline(Date deadlineDate, String description, String executor, Boolean done) {
|
|
this.date = deadlineDate;
|
|
this.description = description;
|
|
this.executor = executor;
|
|
this.done = done;
|
|
}
|
|
|
|
@JsonCreator
|
|
public Deadline(@JsonProperty("id") Integer id,
|
|
@JsonProperty("description") String description,
|
|
@JsonProperty("date") Date date,
|
|
@JsonProperty("executor") String executor,
|
|
@JsonProperty("done") Boolean done) {
|
|
this.setId(id);
|
|
this.description = description;
|
|
this.date = date;
|
|
this.executor = executor;
|
|
this.done = done;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public Date getDate() {
|
|
return date;
|
|
}
|
|
|
|
public void setDate(Date date) {
|
|
this.date = date;
|
|
}
|
|
|
|
public String getExecutor() {
|
|
return executor;
|
|
}
|
|
|
|
public void setExecutor(String executor) {
|
|
this.executor = executor;
|
|
}
|
|
|
|
public Boolean getDone() {
|
|
return done;
|
|
}
|
|
|
|
public void setDone(Boolean done) {
|
|
this.done = done;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
if (!super.equals(o)) {
|
|
return false;
|
|
}
|
|
Deadline deadline = (Deadline) o;
|
|
return getId().equals(deadline.getId()) &&
|
|
description.equals(deadline.description) &&
|
|
date.equals(deadline.date) &&
|
|
executor.equals(deadline.executor) &&
|
|
done.equals(deadline.done);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(super.hashCode(), description, date, executor, done);
|
|
}
|
|
}
|