#247 Remove primefaces dependency #248

Merged
romanov73 merged 9 commits from 247-restore-mvc into dev 2024-05-02 13:10:01 +04:00
8 changed files with 57 additions and 72 deletions
Showing only changes of commit 6e40343d6c - Show all commits

View File

@ -108,9 +108,7 @@ public class Deadline extends BaseEntity {
} }
return getId().equals(deadline.getId()) && return getId().equals(deadline.getId()) &&
description.equals(deadline.description) && description.equals(deadline.description) &&
date.equals(deadline.date) && date.equals(deadline.date);
executors.equals(deadline.executors) &&
done.equals(deadline.done);
} }
@Override @Override

View File

@ -100,7 +100,7 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date updateDate = new Date(); private Date updateDate = new Date();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "paper_id", unique = true) @JoinColumn(name = "paper_id", unique = true)
@Fetch(FetchMode.SUBSELECT) @Fetch(FetchMode.SUBSELECT)
@OrderBy("date") @OrderBy("date")
@ -123,10 +123,6 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
@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;
@ManyToOne() @ManyToOne()
@JoinColumn(name = "conference_id") @JoinColumn(name = "conference_id")
private Conference conference; private Conference conference;
@ -245,14 +241,6 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
this.url = url; this.url = url;
} }
public String getLatexText() {
return latexText;
}
public void setLatexText(String latexText) {
this.latexText = latexText;
}
public Conference getConference() { public Conference getConference() {
return conference; return conference;
} }
@ -322,13 +310,12 @@ public class Paper extends BaseEntity implements UserActivity, EventSource {
Objects.equals(events, paper.events) && Objects.equals(events, paper.events) &&
Objects.equals(files, paper.files) && Objects.equals(files, paper.files) &&
Objects.equals(authors, paper.authors) && Objects.equals(authors, paper.authors) &&
Objects.equals(latexText, paper.latexText) &&
Objects.equals(conference, paper.conference) && Objects.equals(conference, paper.conference) &&
Objects.equals(grants, paper.grants); Objects.equals(grants, paper.grants);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(super.hashCode(), title, status, type, createDate, updateDate, deadlines, comment, url, locked, events, files, authors, latexText, conference, grants); return Objects.hash(super.hashCode(), title, status, type, createDate, updateDate, deadlines, comment, url, locked, events, files, authors, conference, grants);
} }
} }

View File

@ -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 ru.ulstu.core.model.BaseEntity;
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;
@ -89,10 +90,9 @@ public class PaperDto {
this.deadlines = paper.getDeadlines(); this.deadlines = paper.getDeadlines();
this.comment = paper.getComment(); this.comment = paper.getComment();
this.url = paper.getUrl(); this.url = paper.getUrl();
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(), BaseEntity::getId);
this.authors = convert(paper.getAuthors(), UserDto::new); this.authors = convert(paper.getAuthors(), UserDto::new);
this.references = convert(paper.getReferences(), ReferenceDto::new); this.references = convert(paper.getReferences(), ReferenceDto::new);
} }
@ -212,7 +212,7 @@ public class PaperDto {
public String getAuthorsString() { public String getAuthorsString() {
return StringUtils.abbreviate(authors return StringUtils.abbreviate(authors
.stream() .stream()
.map(author -> author.getLastName()) .map(UserDto::getLastName)
.collect(Collectors.joining(", ")), MAX_AUTHORS_LENGTH); .collect(Collectors.joining(", ")), MAX_AUTHORS_LENGTH);
} }

View File

@ -81,9 +81,7 @@ public class PaperService {
} }
public List<PaperDto> findAllDto() { public List<PaperDto> findAllDto() {
List<PaperDto> papers = convert(findAll(), PaperDto::new); return convert(findAll(), PaperDto::new);
papers.forEach(paperDto -> paperDto.setTitle(StringUtils.abbreviate(paperDto.getTitle(), MAX_DISPLAY_SIZE)));
return papers;
} }
public List<Paper> findAllActive() { public List<Paper> findAllActive() {
@ -125,7 +123,6 @@ 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.setUrl(paperDto.getUrl()); paper.setUrl(paperDto.getUrl());
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());

View File

@ -36,7 +36,7 @@ spring.liquibase.enabled=true
# Application Settings # Application Settings
ng-tracker.base-url=http://127.0.0.1:8080 ng-tracker.base-url=http://127.0.0.1:8080
ng-tracker.undead-user-login=admin ng-tracker.undead-user-login=admin
ng-tracker.dev-mode=false ng-tracker.dev-mode=true
ng-tracker.debug_email= ng-tracker.debug_email=
ng-tracker.use-https=false ng-tracker.use-https=false
ng-tracker.check-run=false ng-tracker.check-run=false

View File

@ -4,23 +4,33 @@
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
</head> </head>
<body> <body>
<div th:fragment="paperLine (paper)" class="row text-left paper-row" style="background-color: white;"> <div th:fragment="paperLine (paper)" class="text-left paper-row" style="background-color: white;">
<div class="col"> <div class="row">
<div class="col-1 d-flex justify-content-center">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status}, title=${paper.title}, small=false)"/> <span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=${paper.status}, title=${paper.title}, small=false)"/>
</div>
<div class="col-10">
<a th:href="@{'../papers/paper?id='+${paper.id}}"> <a th:href="@{'../papers/paper?id='+${paper.id}}">
<span class="h6" th:if="${#strings.length(paper.title)} > 50" <span class="h6" th:if="${#strings.length(paper.title)} > 100"
th:text="${#strings.substring(paper.title, 0, 50) + '...'}" th:title="${paper.title}"/> th:text="${#strings.substring(paper.title, 0, 100) + ' ...'}" th:title="${paper.title}"/>
<span class="h6" th:if="${#strings.length(paper.title) le 50}" th:text="${paper.title}" <span class="h6" th:if="${#strings.length(paper.title) le 100}" th:text="${paper.title}"
th:title="${paper.title}"/> th:title="${paper.title}"/>
<span class="text-muted" th:text="${paper.authorsString}"/>
</a> </a>
</div>
<div class="col-1 d-flex justify-content-center">
<input class="id-class" type="hidden" th:value="${paper.id}"/> <input class="id-class" type="hidden" th:value="${paper.id}"/>
<a class="remove-paper pull-right d-none" href="#" data-confirm="Удалить статью?"> <a class="remove-paper pull-right d-none" href="#" data-confirm="Удалить статью?">
<i class="fa fa-trash" aria-hidden="true"></i> <i class="fa fa-trash fa-2x" aria-hidden="true"></i>
</a> </a>
</div> </div>
</div> </div>
<div class="row">
<div class="col-1">
</div>
<div class="col-10">
<span class="text-muted" th:text="${paper.authorsString}"/>
</div>
</div>
</div>
</body> </body>
</html> </html>

View File

@ -33,8 +33,6 @@
<div class="nav nav-tabs" id="nav-tab" role="tablist"> <div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-main-tab" data-toggle="tab" <a class="nav-item nav-link active" id="nav-main-tab" data-toggle="tab"
href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a> href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a>
<a class="nav-item nav-link" id="nav-latex-tab" data-toggle="tab"
href="#nav-latex" role="tab" aria-controls="nav-latex" aria-selected="false">Latex</a>
<a class="nav-item nav-link" id="nav-references-tab" data-toggle="tab" <a class="nav-item nav-link" id="nav-references-tab" data-toggle="tab"
href="#nav-references" role="tab" aria-controls="nav-references" href="#nav-references" role="tab" aria-controls="nav-references"
aria-selected="false">References</a> aria-selected="false">References</a>

View File

@ -12,25 +12,15 @@
<input th:type="hidden" name="paperDeleteId" id="paperDeleteId"/> <input th:type="hidden" name="paperDeleteId" id="paperDeleteId"/>
<section id="papers"> <section id="papers">
<div class="container"> <div class="container">
<div class="row" id="paper-list"> <div class="row mb-3" id="paper-list">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Статьи</h2> <h3 class="section-heading text-uppercase">Статьи</h3>
<div th:replace="papers/fragments/paperNavigationFragment"/> <div th:replace="papers/fragments/paperNavigationFragment"/>
</div> </div>
</div> </div>
<div class="row"> <div class="row filter mb-3 justify-content-center">
<div class="alert alert-danger" th:if="${#fields.hasErrors('*')}"> <div class="col-4">
<p th:each="err : ${#fields.errors('*')}" th:text="${err}"></p>
</div>
<div class="col-md-9 col-sm-12">
<th:block th:each="paper : ${filteredPapers.papers}">
<div th:replace="papers/fragments/paperLineFragment :: paperLine(paper=${paper})"/>
</th:block>
</div>
<div class="col-md-3 col-sm-12">
<div class="filter">
<h5>Фильтр:</h5>
<select class="form-control" th:field="${filteredPapers.filterAuthorId}" id="author" <select class="form-control" th:field="${filteredPapers.filterAuthorId}" id="author"
onchange="this.form.submit();"> onchange="this.form.submit();">
<option value="">Все авторы</option> <option value="">Все авторы</option>
@ -38,6 +28,8 @@
th:text="${author.lastName}">lastName th:text="${author.lastName}">lastName
</option> </option>
</select> </select>
</div>
<div class="col-4">
<select class="form-control" id="year" th:field="${filteredPapers.year}" <select class="form-control" id="year" th:field="${filteredPapers.year}"
onchange="this.form.submit();"> onchange="this.form.submit();">
<option value="">Все годы</option> <option value="">Все годы</option>
@ -47,8 +39,11 @@
</select> </select>
</div> </div>
</div> </div>
</div>
<!--<div th:replace="fragments/noRecordsFragment :: noRecords(entities=${filteredPapers.papers}, noRecordsMessage=' одной статьи', url='paper')"/>--> <th:block th:each="paper : ${filteredPapers.papers}">
<div th:replace="papers/fragments/paperLineFragment :: paperLine(paper=${paper})"/>
</th:block>
<!--div th:replace="fragments/noRecordsFragment :: noRecords(entities=${filteredPapers.papers}, noRecordsMessage=' одной статьи', url='paper')"/>-->
</div> </div>
</section> </section>