72 lines
1.8 KiB
Java
72 lines
1.8 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;
|
|
|
|
@Entity
|
|
public class Deadline extends BaseEntity {
|
|
|
|
private String description;
|
|
|
|
@Temporal(value = TemporalType.TIMESTAMP)
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
private Date date;
|
|
|
|
public Deadline() {
|
|
}
|
|
|
|
public Deadline(Date deadlineDate, String description) {
|
|
this.date = deadlineDate;
|
|
this.description = description;
|
|
}
|
|
|
|
@JsonCreator
|
|
public Deadline(@JsonProperty("id") Integer id,
|
|
@JsonProperty("description") String description,
|
|
@JsonProperty("date") Date date) {
|
|
this.setId(id);
|
|
this.description = description;
|
|
this.date = date;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
@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);
|
|
}
|
|
}
|