ng-tracker/src/main/java/ru/ulstu/grant/model/GrantDto.java

108 lines
2.8 KiB
Java
Raw Normal View History

package ru.ulstu.grant.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.NotEmpty;
2019-03-18 14:27:54 +04:00
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.project.model.ProjectDto;
2018-12-24 15:20:57 +04:00
import java.util.ArrayList;
import java.util.List;
public class GrantDto {
2018-12-22 03:31:43 +04:00
private Integer id;
@NotEmpty
2018-12-22 03:31:43 +04:00
private String title;
private Grant.GrantStatus status;
2019-03-18 14:27:54 +04:00
private List<Deadline> deadlines = new ArrayList<>();
2018-12-22 03:31:43 +04:00
private String comment;
private String applicationFileName;
private ProjectDto project;
2018-12-23 02:22:24 +04:00
public GrantDto() {
2019-03-18 14:27:54 +04:00
deadlines.add(new Deadline());
2018-12-23 02:22:24 +04:00
}
@JsonCreator
public GrantDto(@JsonProperty("id") Integer id,
@JsonProperty("title") String title,
@JsonProperty("status") Grant.GrantStatus status,
2019-03-18 14:27:54 +04:00
@JsonProperty("deadlines") List<Deadline> deadlines,
@JsonProperty("comment") String comment,
@JsonProperty("project") ProjectDto project) {
this.id = id;
this.title = title;
this.status = status;
this.deadlines = deadlines;
this.comment = comment;
this.applicationFileName = null;
this.project = project;
}
public GrantDto(Grant grant) {
this.id = grant.getId();
this.title = grant.getTitle();
this.status = grant.getStatus();
2019-03-18 14:27:54 +04:00
this.deadlines = grant.getDeadlines();
this.comment = grant.getComment();
this.project = grant.getProject() == null ? null : new ProjectDto(grant.getProject());
this.applicationFileName = grant.getApplication() == null ? null : grant.getApplication().getName();
}
public Integer getId() {
return id;
}
2019-03-04 10:24:30 +04:00
public void setId(Integer id) {
this.id = id;
}
2018-12-22 03:31:43 +04:00
public String getTitle() {
return title;
}
2019-03-04 10:24:30 +04:00
public void setTitle(String title) {
this.title = title;
}
2018-12-22 03:31:43 +04:00
public Grant.GrantStatus getStatus() {
return status;
}
2018-12-22 03:31:43 +04:00
public void setStatus(Grant.GrantStatus status) {
this.status = status;
}
2019-03-18 14:27:54 +04:00
public List<Deadline> getDeadlines() {
return deadlines;
}
2019-03-18 14:27:54 +04:00
public void setDeadlines(List<Deadline> deadlines) {
2018-12-22 03:31:43 +04:00
this.deadlines = deadlines;
}
public String getComment() {
return comment;
}
2019-03-04 10:24:30 +04:00
public void setComment(String comment) {
this.comment = comment;
}
2018-12-22 03:31:43 +04:00
public ProjectDto getProject() {
return project;
}
2019-03-04 10:24:30 +04:00
public void setProject(ProjectDto project) {
this.project = project;
}
2018-12-22 03:31:43 +04:00
public String getApplicationFileName() {
return applicationFileName;
}
2018-12-22 03:31:43 +04:00
public void setApplicationFileName(String applicationFileName) {
2019-03-04 10:24:30 +04:00
this.applicationFileName = applicationFileName;
}
}