latex text in paper
This commit is contained in:
parent
f5ce1aa269
commit
c21e8afc1f
@ -19,6 +19,9 @@ public class FileData extends BaseEntity {
|
|||||||
|
|
||||||
private byte[] data;
|
private byte[] data;
|
||||||
|
|
||||||
|
@Column(name = "is_latex_attach")
|
||||||
|
private boolean isLatexAttach;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -50,4 +53,12 @@ public class FileData extends BaseEntity {
|
|||||||
public void setData(byte[] data) {
|
public void setData(byte[] data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLatexAttach() {
|
||||||
|
return isLatexAttach;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatexAttach(boolean latexAttach) {
|
||||||
|
isLatexAttach = latexAttach;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,6 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
|
|
||||||
private Boolean locked = false;
|
private Boolean locked = false;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "paper_id", unique = true)
|
@JoinColumn(name = "paper_id", unique = true)
|
||||||
@Fetch(FetchMode.SUBSELECT)
|
@Fetch(FetchMode.SUBSELECT)
|
||||||
@ -86,6 +85,9 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
@ManyToMany(fetch = FetchType.EAGER)
|
@ManyToMany(fetch = FetchType.EAGER)
|
||||||
private Set<User> authors = new HashSet<>();
|
private Set<User> authors = new HashSet<>();
|
||||||
|
|
||||||
|
@Column(name = "latex_text")
|
||||||
|
private String latexText;
|
||||||
|
|
||||||
public PaperStatus getStatus() {
|
public PaperStatus getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -158,6 +160,14 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
this.authors = authors;
|
this.authors = authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLatexText() {
|
||||||
|
return latexText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatexText(String latexText) {
|
||||||
|
this.latexText = latexText;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<User> getUsers() {
|
public Set<User> getUsers() {
|
||||||
return getAuthors();
|
return getAuthors();
|
||||||
|
@ -4,8 +4,8 @@ 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.hibernate.validator.constraints.NotEmpty;
|
import org.hibernate.validator.constraints.NotEmpty;
|
||||||
import ru.ulstu.file.model.FileDataDto;
|
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
|
import ru.ulstu.file.model.FileDataDto;
|
||||||
import ru.ulstu.user.model.UserDto;
|
import ru.ulstu.user.model.UserDto;
|
||||||
|
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
@ -35,6 +35,7 @@ public class PaperDto {
|
|||||||
private Set<Integer> authorIds;
|
private Set<Integer> authorIds;
|
||||||
private Set<UserDto> authors;
|
private Set<UserDto> authors;
|
||||||
private Integer filterAuthorId;
|
private Integer filterAuthorId;
|
||||||
|
private String latexText;
|
||||||
|
|
||||||
public PaperDto() {
|
public PaperDto() {
|
||||||
deadlines.add(new Deadline());
|
deadlines.add(new Deadline());
|
||||||
@ -48,6 +49,7 @@ public class PaperDto {
|
|||||||
@JsonProperty("updateDate") Date updateDate,
|
@JsonProperty("updateDate") Date updateDate,
|
||||||
@JsonProperty("deadlines") List<Deadline> deadlines,
|
@JsonProperty("deadlines") List<Deadline> deadlines,
|
||||||
@JsonProperty("comment") String comment,
|
@JsonProperty("comment") String comment,
|
||||||
|
@JsonProperty("latex_text") String latexText,
|
||||||
@JsonProperty("locked") Boolean locked,
|
@JsonProperty("locked") Boolean locked,
|
||||||
@JsonProperty("files") List<FileDataDto> files,
|
@JsonProperty("files") List<FileDataDto> files,
|
||||||
@JsonProperty("authorIds") Set<Integer> authorIds,
|
@JsonProperty("authorIds") Set<Integer> authorIds,
|
||||||
@ -59,6 +61,7 @@ public class PaperDto {
|
|||||||
this.updateDate = updateDate;
|
this.updateDate = updateDate;
|
||||||
this.deadlines = deadlines;
|
this.deadlines = deadlines;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
|
this.latexText = latexText;
|
||||||
this.locked = locked;
|
this.locked = locked;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
this.authors = authors;
|
this.authors = authors;
|
||||||
@ -72,6 +75,7 @@ public class PaperDto {
|
|||||||
this.updateDate = paper.getUpdateDate();
|
this.updateDate = paper.getUpdateDate();
|
||||||
this.deadlines = paper.getDeadlines();
|
this.deadlines = paper.getDeadlines();
|
||||||
this.comment = paper.getComment();
|
this.comment = paper.getComment();
|
||||||
|
this.latexText = paper.getLatexText();
|
||||||
this.locked = paper.getLocked();
|
this.locked = paper.getLocked();
|
||||||
this.files = convert(paper.getFiles(), FileDataDto::new);
|
this.files = convert(paper.getFiles(), FileDataDto::new);
|
||||||
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
|
this.authorIds = convert(paper.getAuthors(), user -> user.getId());
|
||||||
@ -166,6 +170,14 @@ public class PaperDto {
|
|||||||
this.authorIds = authorIds;
|
this.authorIds = authorIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLatexText() {
|
||||||
|
return latexText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatexText(String latexText) {
|
||||||
|
this.latexText = latexText;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAuthorsString() {
|
public String getAuthorsString() {
|
||||||
return StringUtils.abbreviate(authors
|
return StringUtils.abbreviate(authors
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -83,6 +83,7 @@ public class PaperService {
|
|||||||
|
|
||||||
private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException {
|
private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException {
|
||||||
paper.setComment(paperDto.getComment());
|
paper.setComment(paperDto.getComment());
|
||||||
|
paper.setLatexText(paperDto.getLatexText());
|
||||||
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
|
paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate());
|
||||||
paper.setLocked(paperDto.getLocked());
|
paper.setLocked(paperDto.getLocked());
|
||||||
paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus());
|
paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus());
|
||||||
|
14
src/main/resources/db/changelog-20190323_000001-schema.xml
Normal file
14
src/main/resources/db/changelog-20190323_000001-schema.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="masha" id="20190323_000000-1">
|
||||||
|
<addColumn tableName="paper">
|
||||||
|
<column name="latex_text" type="varchar"/>
|
||||||
|
</addColumn>
|
||||||
|
<addColumn tableName="file">
|
||||||
|
<column name="is_latex_attach" type="boolean"/>
|
||||||
|
</addColumn>
|
||||||
|
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -19,5 +19,6 @@
|
|||||||
<include file="db/changelog-20181208_000000-schema.xml"/>
|
<include file="db/changelog-20181208_000000-schema.xml"/>
|
||||||
<include file="db/changelog-20181224_000000-schema.xml"/>
|
<include file="db/changelog-20181224_000000-schema.xml"/>
|
||||||
<include file="db/changelog-20190318_000000-schema.xml"/>
|
<include file="db/changelog-20190318_000000-schema.xml"/>
|
||||||
|
<include file="db/changelog-20190323_000001-schema.xml"/>
|
||||||
<include file="db/common/changelog-20190312_130000-schema.xml"/>
|
<include file="db/common/changelog-20190312_130000-schema.xml"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
Loading…
x
Reference in New Issue
Block a user