|
|
|
@ -2,8 +2,12 @@ package ru.ulstu.paper.model;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
import ru.ulstu.user.model.UserDto;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|
|
|
|
|
|
|
|
|
public class PaperDto {
|
|
|
|
|
private final Integer id;
|
|
|
|
@ -17,6 +21,7 @@ public class PaperDto {
|
|
|
|
|
private final Integer fileId;
|
|
|
|
|
private final String fileName;
|
|
|
|
|
private final Date fileCreateDate;
|
|
|
|
|
private final List<UserDto> authors;
|
|
|
|
|
|
|
|
|
|
@JsonCreator
|
|
|
|
|
public PaperDto(@JsonProperty("id") Integer id,
|
|
|
|
@ -26,7 +31,8 @@ public class PaperDto {
|
|
|
|
|
@JsonProperty("updateDate") Date updateDate,
|
|
|
|
|
@JsonProperty("comment") String comment,
|
|
|
|
|
@JsonProperty("locked") Boolean locked,
|
|
|
|
|
@JsonProperty("tmpFileName") String tmpFileName) {
|
|
|
|
|
@JsonProperty("tmpFileName") String tmpFileName,
|
|
|
|
|
@JsonProperty("authors") List<UserDto> authors) {
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.title = title;
|
|
|
|
|
this.status = status;
|
|
|
|
@ -38,6 +44,7 @@ public class PaperDto {
|
|
|
|
|
this.fileId = null;
|
|
|
|
|
this.fileName = null;
|
|
|
|
|
this.fileCreateDate = null;
|
|
|
|
|
this.authors = authors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PaperDto(Paper paper) {
|
|
|
|
@ -52,6 +59,7 @@ public class PaperDto {
|
|
|
|
|
this.fileId = paper.getFileData() == null ? null : paper.getFileData().getId();
|
|
|
|
|
this.fileName = paper.getFileData() == null ? null : paper.getFileData().getName();
|
|
|
|
|
this.fileCreateDate = paper.getFileData() == null ? null : paper.getFileData().getCreateDate();
|
|
|
|
|
this.authors = convert(paper.getAuthors(), UserDto::new);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getId() {
|
|
|
|
@ -97,4 +105,8 @@ public class PaperDto {
|
|
|
|
|
public Date getFileCreateDate() {
|
|
|
|
|
return fileCreateDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<UserDto> getAuthors() {
|
|
|
|
|
return authors;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|