114 lines
2.9 KiB
Java
114 lines
2.9 KiB
Java
package ru.ulstu.project.model;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import org.hibernate.validator.constraints.NotEmpty;
|
|
import ru.ulstu.deadline.model.Deadline;
|
|
import ru.ulstu.grant.model.GrantDto;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class ProjectDto {
|
|
private Integer id;
|
|
|
|
@NotEmpty
|
|
private String title;
|
|
private Project.ProjectStatus status;
|
|
private String description;
|
|
private List<Deadline> deadlines = new ArrayList<>();
|
|
private GrantDto grant;
|
|
private String repository;
|
|
|
|
public ProjectDto() {
|
|
}
|
|
|
|
public ProjectDto(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
@JsonCreator
|
|
public ProjectDto(@JsonProperty("id") Integer id,
|
|
@JsonProperty("title") String title,
|
|
@JsonProperty("status") Project.ProjectStatus status,
|
|
@JsonProperty("description") String description,
|
|
@JsonProperty("grant") GrantDto grant,
|
|
@JsonProperty("repository") String repository,
|
|
@JsonProperty("deadlines") List<Deadline> deadlines) {
|
|
this.id = id;
|
|
this.title = title;
|
|
this.status = status;
|
|
this.description = description;
|
|
this.grant = grant;
|
|
this.repository = repository;
|
|
this.deadlines = deadlines;
|
|
}
|
|
|
|
|
|
public ProjectDto(Project project) {
|
|
this.id = project.getId();
|
|
this.title = project.getTitle();
|
|
this.status = project.getStatus();
|
|
this.description = project.getDescription();
|
|
this.grant = project.getGrant() == null ? null : new GrantDto(project.getGrant());
|
|
this.repository = project.getRepository();
|
|
this.deadlines = project.getDeadlines();
|
|
}
|
|
|
|
public Integer getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Integer id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
public void setTitle(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
public Project.ProjectStatus getStatus() {
|
|
return status;
|
|
}
|
|
|
|
public void setStatus(Project.ProjectStatus status) {
|
|
this.status = status;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public GrantDto getGrant() {
|
|
return grant;
|
|
}
|
|
|
|
public void setGrant(GrantDto grant) {
|
|
this.grant = grant;
|
|
}
|
|
|
|
public String getRepository() {
|
|
return repository;
|
|
}
|
|
|
|
public void setRepository(String repository) {
|
|
this.repository = repository;
|
|
}
|
|
|
|
public List<Deadline> getDeadlines() {
|
|
return deadlines;
|
|
}
|
|
|
|
public void setDeadlines(List<Deadline> deadlines) {
|
|
this.deadlines = deadlines;
|
|
}
|
|
}
|