|
|
@ -3,6 +3,7 @@ package ru.ulstu.paper.model;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.springframework.hateoas.ResourceSupport;
|
|
|
|
import ru.ulstu.deadline.model.Deadline;
|
|
|
|
import ru.ulstu.deadline.model.Deadline;
|
|
|
|
import ru.ulstu.file.model.FileDataDto;
|
|
|
|
import ru.ulstu.file.model.FileDataDto;
|
|
|
|
import ru.ulstu.user.model.UserDto;
|
|
|
|
import ru.ulstu.user.model.UserDto;
|
|
|
@ -17,10 +18,10 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|
|
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
|
|
|
|
|
|
|
|
|
|
|
public class PaperDto {
|
|
|
|
public class PaperDto extends ResourceSupport {
|
|
|
|
private final static int MAX_AUTHORS_LENGTH = 60;
|
|
|
|
private final static int MAX_AUTHORS_LENGTH = 60;
|
|
|
|
|
|
|
|
|
|
|
|
private Integer id;
|
|
|
|
private Integer entityId;
|
|
|
|
@NotEmpty
|
|
|
|
@NotEmpty
|
|
|
|
@Size(min = 3, max = 254)
|
|
|
|
@Size(min = 3, max = 254)
|
|
|
|
private String title;
|
|
|
|
private String title;
|
|
|
@ -46,7 +47,7 @@ public class PaperDto {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@JsonCreator
|
|
|
|
@JsonCreator
|
|
|
|
public PaperDto(@JsonProperty("id") Integer id,
|
|
|
|
public PaperDto(@JsonProperty("entityId") Integer entityId,
|
|
|
|
@JsonProperty("title") String title,
|
|
|
|
@JsonProperty("title") String title,
|
|
|
|
@JsonProperty("status") Paper.PaperStatus status,
|
|
|
|
@JsonProperty("status") Paper.PaperStatus status,
|
|
|
|
@JsonProperty("type") Paper.PaperType type,
|
|
|
|
@JsonProperty("type") Paper.PaperType type,
|
|
|
@ -62,7 +63,7 @@ public class PaperDto {
|
|
|
|
@JsonProperty("authors") Set<UserDto> authors,
|
|
|
|
@JsonProperty("authors") Set<UserDto> authors,
|
|
|
|
@JsonProperty("references") List<ReferenceDto> references,
|
|
|
|
@JsonProperty("references") List<ReferenceDto> references,
|
|
|
|
@JsonProperty("formatStandard") ReferenceDto.FormatStandard formatStandard) {
|
|
|
|
@JsonProperty("formatStandard") ReferenceDto.FormatStandard formatStandard) {
|
|
|
|
this.id = id;
|
|
|
|
this.entityId = entityId;
|
|
|
|
this.title = title;
|
|
|
|
this.title = title;
|
|
|
|
this.status = status;
|
|
|
|
this.status = status;
|
|
|
|
this.type = type;
|
|
|
|
this.type = type;
|
|
|
@ -80,7 +81,7 @@ public class PaperDto {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public PaperDto(Paper paper) {
|
|
|
|
public PaperDto(Paper paper) {
|
|
|
|
this.id = paper.getId();
|
|
|
|
this.entityId = paper.getId();
|
|
|
|
this.title = paper.getTitle();
|
|
|
|
this.title = paper.getTitle();
|
|
|
|
this.status = paper.getStatus();
|
|
|
|
this.status = paper.getStatus();
|
|
|
|
this.type = paper.getType();
|
|
|
|
this.type = paper.getType();
|
|
|
@ -97,12 +98,12 @@ public class PaperDto {
|
|
|
|
this.references = convert(paper.getReferences(), ReferenceDto::new);
|
|
|
|
this.references = convert(paper.getReferences(), ReferenceDto::new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getId() {
|
|
|
|
public Integer getEntityId() {
|
|
|
|
return id;
|
|
|
|
return entityId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setId(Integer id) {
|
|
|
|
public void setId(Integer id) {
|
|
|
|
this.id = id;
|
|
|
|
this.entityId = id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getTitle() {
|
|
|
|
public String getTitle() {
|
|
|
|