|
|
@ -4,12 +4,14 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import org.hibernate.validator.constraints.NotEmpty;
|
|
|
|
import org.hibernate.validator.constraints.NotEmpty;
|
|
|
|
import ru.ulstu.deadline.model.DeadlineDto;
|
|
|
|
import ru.ulstu.deadline.model.DeadlineDto;
|
|
|
|
|
|
|
|
import ru.ulstu.user.model.UserDto;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.Size;
|
|
|
|
import javax.validation.constraints.Size;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|
|
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|
|
|
|
|
|
|
|
|
|
@ -29,7 +31,8 @@ public class PaperDto {
|
|
|
|
private Integer fileId;
|
|
|
|
private Integer fileId;
|
|
|
|
private String fileName;
|
|
|
|
private String fileName;
|
|
|
|
private Date fileCreateDate;
|
|
|
|
private Date fileCreateDate;
|
|
|
|
private Set<Integer> authors;
|
|
|
|
private Set<Integer> authorIds;
|
|
|
|
|
|
|
|
private Set<UserDto> authors;
|
|
|
|
|
|
|
|
|
|
|
|
public PaperDto() {
|
|
|
|
public PaperDto() {
|
|
|
|
deadlines.add(new DeadlineDto());
|
|
|
|
deadlines.add(new DeadlineDto());
|
|
|
@ -45,7 +48,8 @@ public class PaperDto {
|
|
|
|
@JsonProperty("comment") String comment,
|
|
|
|
@JsonProperty("comment") String comment,
|
|
|
|
@JsonProperty("locked") Boolean locked,
|
|
|
|
@JsonProperty("locked") Boolean locked,
|
|
|
|
@JsonProperty("tmpFileName") String tmpFileName,
|
|
|
|
@JsonProperty("tmpFileName") String tmpFileName,
|
|
|
|
@JsonProperty("authors") Set<Integer> authors) {
|
|
|
|
@JsonProperty("authorIds") Set<Integer> authorIds,
|
|
|
|
|
|
|
|
@JsonProperty("authors") Set<UserDto> authors) {
|
|
|
|
this.id = id;
|
|
|
|
this.id = id;
|
|
|
|
this.title = title;
|
|
|
|
this.title = title;
|
|
|
|
this.status = status;
|
|
|
|
this.status = status;
|
|
|
@ -74,110 +78,126 @@ public class PaperDto {
|
|
|
|
this.fileId = paper.getFileData() == null ? null : paper.getFileData().getId();
|
|
|
|
this.fileId = paper.getFileData() == null ? null : paper.getFileData().getId();
|
|
|
|
this.fileName = paper.getFileData() == null ? null : paper.getFileData().getName();
|
|
|
|
this.fileName = paper.getFileData() == null ? null : paper.getFileData().getName();
|
|
|
|
this.fileCreateDate = paper.getFileData() == null ? null : paper.getFileData().getCreateDate();
|
|
|
|
this.fileCreateDate = paper.getFileData() == null ? null : paper.getFileData().getCreateDate();
|
|
|
|
this.authors = convert(paper.getAuthors(), user -> user.getId());
|
|
|
|
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
|
|
|
|
|
|
|
|
this.authors = convert(paper.getAuthors(), UserDto::new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getId() {
|
|
|
|
public Integer getId() {
|
|
|
|
return id;
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setId(Integer id) {
|
|
|
|
|
|
|
|
this.id = id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getTitle() {
|
|
|
|
public String getTitle() {
|
|
|
|
return title;
|
|
|
|
return title;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setTitle(String title) {
|
|
|
|
|
|
|
|
this.title = title;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Paper.PaperStatus getStatus() {
|
|
|
|
public Paper.PaperStatus getStatus() {
|
|
|
|
return status;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setStatus(Paper.PaperStatus status) {
|
|
|
|
|
|
|
|
this.status = status;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Date getCreateDate() {
|
|
|
|
public Date getCreateDate() {
|
|
|
|
return createDate;
|
|
|
|
return createDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Date getUpdateDate() {
|
|
|
|
public void setCreateDate(Date createDate) {
|
|
|
|
return updateDate;
|
|
|
|
this.createDate = createDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<DeadlineDto> getDeadlines() {
|
|
|
|
public Date getUpdateDate() {
|
|
|
|
return deadlines;
|
|
|
|
return updateDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getComment() {
|
|
|
|
public void setUpdateDate(Date updateDate) {
|
|
|
|
return comment;
|
|
|
|
this.updateDate = updateDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Boolean getLocked() {
|
|
|
|
public List<DeadlineDto> getDeadlines() {
|
|
|
|
return locked;
|
|
|
|
return deadlines;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getTmpFileName() {
|
|
|
|
public void setDeadlines(List<DeadlineDto> deadlines) {
|
|
|
|
return tmpFileName;
|
|
|
|
this.deadlines = deadlines;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getFileId() {
|
|
|
|
public String getComment() {
|
|
|
|
return fileId;
|
|
|
|
return comment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getFileName() {
|
|
|
|
public void setComment(String comment) {
|
|
|
|
return fileName;
|
|
|
|
this.comment = comment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Date getFileCreateDate() {
|
|
|
|
public Boolean getLocked() {
|
|
|
|
return fileCreateDate;
|
|
|
|
return locked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Set<Integer> getAuthors() {
|
|
|
|
public void setLocked(Boolean locked) {
|
|
|
|
return authors;
|
|
|
|
this.locked = locked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setId(Integer id) {
|
|
|
|
public String getTmpFileName() {
|
|
|
|
this.id = id;
|
|
|
|
return tmpFileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setTitle(String title) {
|
|
|
|
public void setTmpFileName(String tmpFileName) {
|
|
|
|
this.title = title;
|
|
|
|
this.tmpFileName = tmpFileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setStatus(Paper.PaperStatus status) {
|
|
|
|
public Integer getFileId() {
|
|
|
|
this.status = status;
|
|
|
|
return fileId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setCreateDate(Date createDate) {
|
|
|
|
public void setFileId(Integer fileId) {
|
|
|
|
this.createDate = createDate;
|
|
|
|
this.fileId = fileId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setUpdateDate(Date updateDate) {
|
|
|
|
public String getFileName() {
|
|
|
|
this.updateDate = updateDate;
|
|
|
|
return fileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setComment(String comment) {
|
|
|
|
public void setFileName(String fileName) {
|
|
|
|
this.comment = comment;
|
|
|
|
this.fileName = fileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setLocked(Boolean locked) {
|
|
|
|
public Date getFileCreateDate() {
|
|
|
|
this.locked = locked;
|
|
|
|
return fileCreateDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setTmpFileName(String tmpFileName) {
|
|
|
|
public void setFileCreateDate(Date fileCreateDate) {
|
|
|
|
this.tmpFileName = tmpFileName;
|
|
|
|
this.fileCreateDate = fileCreateDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setFileId(Integer fileId) {
|
|
|
|
public Set<UserDto> getAuthors() {
|
|
|
|
this.fileId = fileId;
|
|
|
|
return authors;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setFileName(String fileName) {
|
|
|
|
public void setAuthors(Set<UserDto> authors) {
|
|
|
|
this.fileName = fileName;
|
|
|
|
this.authors = authors;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setFileCreateDate(Date fileCreateDate) {
|
|
|
|
public Set<Integer> getAuthorIds() {
|
|
|
|
this.fileCreateDate = fileCreateDate;
|
|
|
|
return authorIds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setAuthors(Set<Integer> authors) {
|
|
|
|
public void setAuthorIds(Set<Integer> authorIds) {
|
|
|
|
this.authors = authors;
|
|
|
|
this.authorIds = authorIds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setDeadlines(List<DeadlineDto> deadlines) {
|
|
|
|
public String getAuthorsString() {
|
|
|
|
this.deadlines = deadlines;
|
|
|
|
return authors
|
|
|
|
|
|
|
|
.stream()
|
|
|
|
|
|
|
|
.map(author -> author.getLastName())
|
|
|
|
|
|
|
|
.collect(Collectors.joining(", "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|