diff --git a/src/main/java/ru/ulstu/conference/controller/ConferenceConverter.java b/src/main/java/ru/ulstu/conference/controller/ConferenceConverter.java
new file mode 100644
index 0000000..b566624
--- /dev/null
+++ b/src/main/java/ru/ulstu/conference/controller/ConferenceConverter.java
@@ -0,0 +1,29 @@
+package ru.ulstu.conference.controller;
+
+import org.springframework.stereotype.Service;
+import ru.ulstu.conference.model.Conference;
+import ru.ulstu.conference.service.ConferenceService;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.inject.Inject;
+
+
+@Service
+public class ConferenceConverter implements Converter {
+ @Inject
+ private ConferenceService conferenceService;
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ return value == null || value.equals("") ? null : conferenceService.findOne(Integer.valueOf(value));
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ return value == null
+ ? ""
+ : (value.getClass().equals(Conference.class) ? ((Conference) value).getId().toString() : null);
+ }
+}
diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java
index 5d1ca47..830fea1 100644
--- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java
+++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java
@@ -11,6 +11,7 @@ import ru.ulstu.conference.model.ConferenceDto;
import ru.ulstu.conference.model.ConferenceFilterDto;
import ru.ulstu.conference.model.ConferenceUser;
import ru.ulstu.conference.repository.ConferenceRepository;
+import ru.ulstu.core.util.DateUtils;
import ru.ulstu.deadline.model.Deadline;
import ru.ulstu.deadline.service.DeadlineService;
import ru.ulstu.name.BaseService;
@@ -253,7 +254,7 @@ public class ConferenceService extends BaseService {
return convert(findAllActive(), ConferenceDto::new);
}
- private List findAllActive() {
+ public List findAllActive() {
return conferenceRepository.findAllActive(new Date());
}
@@ -339,6 +340,8 @@ public class ConferenceService extends BaseService {
public Conference createByTitle(String newConferenceTitle) {
Conference conference = new Conference(newConferenceTitle);
+ conference.setBeginDate(DateUtils.localDateToDate(DateUtils.convertToLocalDate(new Date()).plus(1, ChronoUnit.WEEKS)));
+ conference.setEndDate(DateUtils.localDateToDate(DateUtils.convertToLocalDate(new Date()).plus(2, ChronoUnit.WEEKS)));
conference.getUsers().add(new ConferenceUser(userService.getCurrentUser()));
conference.getDeadlines().add(deadlineService.createWithOffset(new Date(), 1, ChronoUnit.WEEKS));
return save(conference);
diff --git a/src/main/java/ru/ulstu/paper/controller/PaperView.java b/src/main/java/ru/ulstu/paper/controller/PaperView.java
index 0a3432a..f37ae79 100644
--- a/src/main/java/ru/ulstu/paper/controller/PaperView.java
+++ b/src/main/java/ru/ulstu/paper/controller/PaperView.java
@@ -1,5 +1,8 @@
package ru.ulstu.paper.controller;
+import org.apache.commons.lang3.StringUtils;
+import ru.ulstu.conference.model.Conference;
+import ru.ulstu.conference.service.ConferenceService;
import ru.ulstu.core.navigation.Page;
import ru.ulstu.core.util.FacesUtil;
import ru.ulstu.deadline.model.Deadline;
@@ -21,6 +24,8 @@ import java.util.List;
@Named
@ViewScoped
public class PaperView implements Serializable {
+ private static final int MAX_CONFERENCE_TITLE_LENGTH = 20;
+
@Inject
private PaperService paperService;
@@ -30,6 +35,9 @@ public class PaperView implements Serializable {
@Inject
private UserService userService;
+ @Inject
+ private ConferenceService conferenceService;
+
private Paper paper;
private Date newDeadlineDate;
@@ -95,4 +103,18 @@ public class PaperView implements Serializable {
newDeadlineDescription = "";
newDeadlineDate = new Date();
}
+
+ public List getConferences() {
+ return conferenceService.findAllActive();
+ }
+
+ public String getConferenceTitle(Conference conference) {
+ if (conference == null) {
+ return null;
+ }
+ if (conference.getTitle().length() > MAX_CONFERENCE_TITLE_LENGTH) {
+ return StringUtils.truncate(conference.getTitle(), MAX_CONFERENCE_TITLE_LENGTH) + "...";
+ }
+ return conference.getTitle();
+ }
}
diff --git a/src/main/resources/META-INF/resources/conference/conference.xhtml b/src/main/resources/META-INF/resources/conference/conference.xhtml
index deb39a6..8ac4630 100644
--- a/src/main/resources/META-INF/resources/conference/conference.xhtml
+++ b/src/main/resources/META-INF/resources/conference/conference.xhtml
@@ -42,9 +42,24 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/META-INF/resources/paper/paper.xhtml b/src/main/resources/META-INF/resources/paper/paper.xhtml
index 20f4978..82b0fdf 100644
--- a/src/main/resources/META-INF/resources/paper/paper.xhtml
+++ b/src/main/resources/META-INF/resources/paper/paper.xhtml
@@ -42,13 +42,16 @@
+
+
+ #{paperView.getConferenceTitle(paperView.paper.conference)}
+
+
+
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index f1697ba..60afbc3 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -42,7 +42,7 @@ spring.liquibase.enabled=true
ng-tracker.base-url=http://127.0.0.1:8080
ng-tracker.undead-user-login=admin
ng-tracker.dev-mode=false
-ng-tracker.debug_email=
+ng-tracker.debug_email=romanov73@gmail.com
ng-tracker.use-https=false
ng-tracker.check-run=false
ng-tracker.driver-path=
diff --git a/src/main/resources/mail_templates/conferenceUpdateDeadlinesNotification.html b/src/main/resources/mail_templates/conferenceUpdateDeadlinesNotification.html
index 8a9a4c6..80f562c 100644
--- a/src/main/resources/mail_templates/conferenceUpdateDeadlinesNotification.html
+++ b/src/main/resources/mail_templates/conferenceUpdateDeadlinesNotification.html
@@ -10,7 +10,7 @@
Уважаемый(ая) Ivan Ivanov
- Дедлайны конференции "
+ Дедлайны конференции "
Title" притерпели изменения.
Ознакомтесь с изменениями.