#106 change boolean to nullable

This commit is contained in:
Семенова Мария 2019-04-18 23:37:08 +04:00
parent 5a55e3cfc8
commit 6c8554a0b8
4 changed files with 11 additions and 11 deletions

View File

@ -20,7 +20,7 @@ public class FileData extends BaseEntity {
private byte[] data; private byte[] data;
@Column(name = "is_latex_attach") @Column(name = "is_latex_attach")
private boolean isLatexAttach; private Boolean isLatexAttach;
public String getName() { public String getName() {
return name; return name;
@ -54,11 +54,11 @@ public class FileData extends BaseEntity {
this.data = data; this.data = data;
} }
public boolean isLatexAttach() { public Boolean isLatexAttach() {
return isLatexAttach; return isLatexAttach;
} }
public void setLatexAttach(boolean latexAttach) { public void setLatexAttach(Boolean latexAttach) {
isLatexAttach = latexAttach; isLatexAttach = latexAttach;
} }
} }

View File

@ -9,7 +9,7 @@ public class FileDataDto {
private String fileName; private String fileName;
private String tmpFileName; private String tmpFileName;
private boolean deleted; private boolean deleted;
private boolean isLatexAttach; private Boolean isLatexAttach;
public FileDataDto() { public FileDataDto() {
} }
@ -17,7 +17,7 @@ public class FileDataDto {
@JsonCreator @JsonCreator
public FileDataDto(@JsonProperty("id") Integer id, public FileDataDto(@JsonProperty("id") Integer id,
@JsonProperty("name") String name, @JsonProperty("name") String name,
@JsonProperty("isLatexAttach") boolean isLatexAttach, @JsonProperty("isLatexAttach") Boolean isLatexAttach,
@JsonProperty("fileName") String fileName, @JsonProperty("fileName") String fileName,
@JsonProperty("tmpFileName") String tmpFileName) { @JsonProperty("tmpFileName") String tmpFileName) {
this.id = id; this.id = id;
@ -77,19 +77,19 @@ public class FileDataDto {
this.deleted = deleted; this.deleted = deleted;
} }
public boolean isLatexAttach() { public Boolean isLatexAttach() {
return isLatexAttach; return isLatexAttach;
} }
public boolean getIsLatexAttach() { public Boolean getIsLatexAttach() {
return isLatexAttach; return isLatexAttach;
} }
public void setLatexAttach(boolean latexAttach) { public void setLatexAttach(Boolean latexAttach) {
isLatexAttach = latexAttach; isLatexAttach = latexAttach;
} }
public void setIsLatexAttach(boolean latexAttach) { public void setIsLatexAttach(Boolean latexAttach) {
isLatexAttach = latexAttach; isLatexAttach = latexAttach;
} }
} }

View File

@ -127,7 +127,7 @@ public class FileService {
public void createLatexAttachs(PaperDto paper) throws IOException { public void createLatexAttachs(PaperDto paper) throws IOException {
for (FileDataDto fileDataDto : paper.getFiles() for (FileDataDto fileDataDto : paper.getFiles()
.stream() .stream()
.filter(f -> f.isLatexAttach() && !f.isDeleted()) .filter(f -> (f.isLatexAttach()!=null && f.isLatexAttach()) && !f.isDeleted())
.collect(Collectors.toList())) { .collect(Collectors.toList())) {
if (fileDataDto.getId() == null) { if (fileDataDto.getId() == null) {
File oldFile = getTmpFilePath(fileDataDto.getTmpFileName()).toFile(); File oldFile = getTmpFilePath(fileDataDto.getTmpFileName()).toFile();

View File

@ -8,7 +8,7 @@
<div th:fragment="filesList (isLatexAttach)" th:remove="tag"> <div th:fragment="filesList (isLatexAttach)" th:remove="tag">
<th:block th:each="file, rowStat : *{files}"> <th:block th:each="file, rowStat : *{files}">
<span th:if="${file.isLatexAttach == isLatexAttach}" th:remove="tag"> <span th:if="${(!isLatexAttach and file.isLatexAttach == null) or file.isLatexAttach == isLatexAttach}" th:remove="tag">
<div class="row" th:id="|files${rowStat.index}|" <div class="row" th:id="|files${rowStat.index}|"
th:style="${file.deleted} ? 'display: none;' :''"> th:style="${file.deleted} ? 'display: none;' :''">