diff --git a/src/main/java/ru/ulstu/file/model/FileData.java b/src/main/java/ru/ulstu/file/model/FileData.java index 08445a3..3f97130 100644 --- a/src/main/java/ru/ulstu/file/model/FileData.java +++ b/src/main/java/ru/ulstu/file/model/FileData.java @@ -20,7 +20,7 @@ public class FileData extends BaseEntity { private byte[] data; @Column(name = "is_latex_attach") - private boolean isLatexAttach; + private Boolean isLatexAttach; public String getName() { return name; @@ -54,11 +54,11 @@ public class FileData extends BaseEntity { this.data = data; } - public boolean isLatexAttach() { + public Boolean isLatexAttach() { return isLatexAttach; } - public void setLatexAttach(boolean latexAttach) { + public void setLatexAttach(Boolean latexAttach) { isLatexAttach = latexAttach; } } diff --git a/src/main/java/ru/ulstu/file/model/FileDataDto.java b/src/main/java/ru/ulstu/file/model/FileDataDto.java index 65ef275..e83bf12 100644 --- a/src/main/java/ru/ulstu/file/model/FileDataDto.java +++ b/src/main/java/ru/ulstu/file/model/FileDataDto.java @@ -9,7 +9,7 @@ public class FileDataDto { private String fileName; private String tmpFileName; private boolean deleted; - private boolean isLatexAttach; + private Boolean isLatexAttach; public FileDataDto() { } @@ -17,7 +17,7 @@ public class FileDataDto { @JsonCreator public FileDataDto(@JsonProperty("id") Integer id, @JsonProperty("name") String name, - @JsonProperty("isLatexAttach") boolean isLatexAttach, + @JsonProperty("isLatexAttach") Boolean isLatexAttach, @JsonProperty("fileName") String fileName, @JsonProperty("tmpFileName") String tmpFileName) { this.id = id; @@ -77,19 +77,19 @@ public class FileDataDto { this.deleted = deleted; } - public boolean isLatexAttach() { + public Boolean isLatexAttach() { return isLatexAttach; } - public boolean getIsLatexAttach() { + public Boolean getIsLatexAttach() { return isLatexAttach; } - public void setLatexAttach(boolean latexAttach) { + public void setLatexAttach(Boolean latexAttach) { isLatexAttach = latexAttach; } - public void setIsLatexAttach(boolean latexAttach) { + public void setIsLatexAttach(Boolean latexAttach) { isLatexAttach = latexAttach; } } diff --git a/src/main/java/ru/ulstu/file/service/FileService.java b/src/main/java/ru/ulstu/file/service/FileService.java index 3a0a87c..d3a7e8c 100644 --- a/src/main/java/ru/ulstu/file/service/FileService.java +++ b/src/main/java/ru/ulstu/file/service/FileService.java @@ -127,7 +127,7 @@ public class FileService { public void createLatexAttachs(PaperDto paper) throws IOException { for (FileDataDto fileDataDto : paper.getFiles() .stream() - .filter(f -> f.isLatexAttach() && !f.isDeleted()) + .filter(f -> (f.isLatexAttach()!=null && f.isLatexAttach()) && !f.isDeleted()) .collect(Collectors.toList())) { if (fileDataDto.getId() == null) { File oldFile = getTmpFilePath(fileDataDto.getTmpFileName()).toFile(); diff --git a/src/main/resources/templates/papers/fragments/paperFilesListFragment.html b/src/main/resources/templates/papers/fragments/paperFilesListFragment.html index fcc875c..5934c59 100644 --- a/src/main/resources/templates/papers/fragments/paperFilesListFragment.html +++ b/src/main/resources/templates/papers/fragments/paperFilesListFragment.html @@ -8,7 +8,7 @@