diff --git a/src/main/java/ru/ulstu/paper/model/Paper.java b/src/main/java/ru/ulstu/paper/model/Paper.java index b2f8327..11aa4d9 100644 --- a/src/main/java/ru/ulstu/paper/model/Paper.java +++ b/src/main/java/ru/ulstu/paper/model/Paper.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; - @Entity public class Paper extends BaseEntity implements UserContainer { public enum PaperStatus { @@ -75,6 +74,8 @@ public class Paper extends BaseEntity implements UserContainer { private String comment; + private String url; + private Boolean locked = false; @@ -158,6 +159,14 @@ public class Paper extends BaseEntity implements UserContainer { this.authors = authors; } + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + @Override public Set getUsers() { return getAuthors(); diff --git a/src/main/java/ru/ulstu/paper/model/PaperDto.java b/src/main/java/ru/ulstu/paper/model/PaperDto.java index 18284f4..182b12c 100644 --- a/src/main/java/ru/ulstu/paper/model/PaperDto.java +++ b/src/main/java/ru/ulstu/paper/model/PaperDto.java @@ -30,6 +30,7 @@ public class PaperDto { @NotEmpty private List deadlines = new ArrayList<>(); private String comment; + private String url; private Boolean locked; private List files = new ArrayList<>(); private Set authorIds; @@ -48,6 +49,7 @@ public class PaperDto { @JsonProperty("updateDate") Date updateDate, @JsonProperty("deadlines") List deadlines, @JsonProperty("comment") String comment, + @JsonProperty("url") String url, @JsonProperty("locked") Boolean locked, @JsonProperty("files") List files, @JsonProperty("authorIds") Set authorIds, @@ -59,6 +61,7 @@ public class PaperDto { this.updateDate = updateDate; this.deadlines = deadlines; this.comment = comment; + this.url = url; this.locked = locked; this.files = files; this.authors = authors; @@ -72,6 +75,7 @@ public class PaperDto { this.updateDate = paper.getUpdateDate(); this.deadlines = paper.getDeadlines(); this.comment = paper.getComment(); + this.url = paper.getUrl(); this.locked = paper.getLocked(); this.files = convert(paper.getFiles(), FileDataDto::new); this.authorIds = convert(paper.getAuthors(), user -> user.getId()); @@ -166,6 +170,14 @@ public class PaperDto { this.authorIds = authorIds; } + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + public String getAuthorsString() { return StringUtils.abbreviate(authors .stream() diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index a664d00..df6f158 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -83,6 +83,7 @@ public class PaperService { private Paper copyFromDto(Paper paper, PaperDto paperDto) throws IOException { paper.setComment(paperDto.getComment()); + paper.setUrl(paperDto.getUrl()); paper.setCreateDate(paper.getCreateDate() == null ? new Date() : paper.getCreateDate()); paper.setLocked(paperDto.getLocked()); paper.setStatus(paperDto.getStatus() == null ? DRAFT : paperDto.getStatus()); @@ -110,7 +111,6 @@ public class PaperService { .collect(toList())) { fileService.delete(file.getId()); } - paperRepository.save(copyFromDto(paper, paperDto)); paper.getAuthors().forEach(author -> { diff --git a/src/main/resources/db/changelog-20190318_000001-schema.xml b/src/main/resources/db/changelog-20190318_000001-schema.xml new file mode 100644 index 0000000..98ec657 --- /dev/null +++ b/src/main/resources/db/changelog-20190318_000001-schema.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index dcba122..ba15a4b 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/src/main/resources/templates/papers/fragments/paperDashboardFragment.html b/src/main/resources/templates/papers/fragments/paperDashboardFragment.html index 122696e..1b27595 100644 --- a/src/main/resources/templates/papers/fragments/paperDashboardFragment.html +++ b/src/main/resources/templates/papers/fragments/paperDashboardFragment.html @@ -10,7 +10,13 @@
- title +

+

+ + title +

authors

diff --git a/src/main/resources/templates/papers/paper.html b/src/main/resources/templates/papers/paper.html index a0b11f1..ab1cd67 100644 --- a/src/main/resources/templates/papers/paper.html +++ b/src/main/resources/templates/papers/paper.html @@ -50,6 +50,13 @@ th:field="*{comment}"> +
+ + +
+