From 291f4e1e33fcf45ab45390dc3be87c7cd219fe44 Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 09:44:25 +0400 Subject: [PATCH 1/9] #101 db edited --- ...0000-schema.xml => changelog-20190601_000001-schema.xml} | 6 +++--- src/main/resources/db/changelog-master.xml | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) rename src/main/resources/db/{changelog-20190428_000000-schema.xml => changelog-20190601_000001-schema.xml} (75%) diff --git a/src/main/resources/db/changelog-20190428_000000-schema.xml b/src/main/resources/db/changelog-20190601_000001-schema.xml similarity index 75% rename from src/main/resources/db/changelog-20190428_000000-schema.xml rename to src/main/resources/db/changelog-20190601_000001-schema.xml index b44691d..409bde4 100644 --- a/src/main/resources/db/changelog-20190428_000000-schema.xml +++ b/src/main/resources/db/changelog-20190601_000001-schema.xml @@ -2,9 +2,9 @@ - + - + - \ No newline at end of file + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index 529b597..aed9997 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -35,7 +35,6 @@ - @@ -51,5 +50,5 @@ - + \ No newline at end of file From 267bd5b0f37f0f257d08c6e4cc7766ced1264d8e Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 11:44:41 +0400 Subject: [PATCH 2/9] #101 event service edited --- .../conference/service/ConferenceService.java | 3 +- .../ru/ulstu/grant/service/GrantService.java | 4 +- .../ulstu/project/service/ProjectService.java | 4 +- .../ulstu/students/service/TaskService.java | 9 +- .../ulstu/timeline/service/EventService.java | 257 +++++++++--------- src/main/resources/db/changelog-master.xml | 2 +- 6 files changed, 144 insertions(+), 135 deletions(-) diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index 1b8e67b..3b3bace 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.Collections; import java.util.stream.Collectors; import static org.springframework.util.ObjectUtils.isEmpty; @@ -116,7 +117,7 @@ public class ConferenceService extends BaseService { Conference newConference = copyFromDto(new Conference(), conferenceDto); newConference = conferenceRepository.save(newConference); conferenceNotificationService.sendCreateNotification(newConference); - eventService.createFromConference(newConference); + eventService.createFromObject(newConference, Collections.emptyList()); return newConference; } diff --git a/src/main/java/ru/ulstu/grant/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java index e5754eb..d8e4aad 100644 --- a/src/main/java/ru/ulstu/grant/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -90,7 +90,7 @@ public class GrantService extends BaseService { public Integer create(GrantDto grantDto) throws IOException { Grant newGrant = copyFromDto(new Grant(), grantDto); newGrant = grantRepository.save(newGrant); - eventService.createFromGrant(newGrant); + eventService.createFromObject(newGrant, Collections.emptyList()); grantNotificationService.sendCreateNotification(newGrant); return newGrant.getId(); } @@ -178,7 +178,7 @@ public class GrantService extends BaseService { grant.getPapers().add(paper); grant = grantRepository.save(grant); - eventService.createFromGrant(grant); + eventService.createFromObject(grant, Collections.emptyList()); grantNotificationService.sendCreateNotification(grant); return grant; diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 80bd52f..de64c4c 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -17,8 +17,8 @@ import ru.ulstu.user.service.UserService; import java.io.IOException; import java.util.Arrays; +import java.util.Collections; import java.util.List; -import java.util.Set; import static java.util.stream.Collectors.toList; import static org.springframework.util.ObjectUtils.isEmpty; @@ -72,7 +72,7 @@ public class ProjectService { public Project create(ProjectDto projectDto) throws IOException { Project newProject = copyFromDto(new Project(), projectDto); newProject = projectRepository.save(newProject); - eventService.createFromProject(newProject); + eventService.createFromObject(newProject, Collections.emptyList()); return newProject; } diff --git a/src/main/java/ru/ulstu/students/service/TaskService.java b/src/main/java/ru/ulstu/students/service/TaskService.java index e89aedf..0a4590a 100644 --- a/src/main/java/ru/ulstu/students/service/TaskService.java +++ b/src/main/java/ru/ulstu/students/service/TaskService.java @@ -18,14 +18,15 @@ import ru.ulstu.tags.service.TagService; import ru.ulstu.timeline.service.EventService; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; +import java.util.Collections; import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Set; +import java.util.Map; import java.util.TreeMap; +import java.util.ArrayList; +import java.util.Arrays; import java.util.stream.Collectors; import static org.springframework.util.ObjectUtils.isEmpty; @@ -83,7 +84,7 @@ public class TaskService { public Integer create(TaskDto taskDto) throws IOException { Task newTask = copyFromDto(new Task(), taskDto); newTask = taskRepository.save(newTask); - eventService.createFromTask(newTask); + eventService.createFromObject(newTask, Collections.emptyList()); return newTask.getId(); } diff --git a/src/main/java/ru/ulstu/timeline/service/EventService.java b/src/main/java/ru/ulstu/timeline/service/EventService.java index 906a5e6..01113c7 100644 --- a/src/main/java/ru/ulstu/timeline/service/EventService.java +++ b/src/main/java/ru/ulstu/timeline/service/EventService.java @@ -1,10 +1,12 @@ package ru.ulstu.timeline.service; +import com.sun.jna.platform.win32.COM.util.Convert; import org.apache.commons.lang3.time.DateUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import ru.ulstu.conference.model.Conference; +import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.grant.model.Grant; import ru.ulstu.paper.model.Paper; @@ -34,6 +36,13 @@ public class EventService { private final TimelineService timelineService; private final UserService userService; + private String objectClassName = ""; + private Paper newPaper = new Paper(); + private Conference newConference = new Conference(); + private Grant newGrant = new Grant(); + private Project newProject = new Project(); + private Task newTask = new Task(); + public EventService(EventRepository eventRepository, @Lazy TimelineService timelineService, UserService userService) { @@ -107,35 +116,135 @@ public class EventService { } public void createFromPaper(Paper newPaper) { - createFromPaper(newPaper, Collections.emptyList()); + createFromObject(newPaper, Collections.emptyList()); } - public void createFromPaper(Paper newPaper, List events) { + public void createFromObject(Object newObject, List events) { List timelines = timelineService.findAll(); Timeline timeline = timelines.isEmpty() ? new Timeline() : timelines.get(0); - timeline.getEvents().removeAll(events); - for (Deadline deadline : newPaper.getDeadlines() - .stream() - .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) - .collect(Collectors.toList())) { - Event newEvent = new Event(); - newEvent.setTitle("Дедлайн статьи"); - newEvent.setStatus(Event.EventStatus.NEW); - newEvent.setExecuteDate(deadline.getDate()); - newEvent.setCreateDate(new Date()); - newEvent.setUpdateDate(new Date()); - newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' cтатьи '" + newPaper.getTitle() + "'"); - newEvent.setRecipients(new ArrayList(newPaper.getAuthors())); - newEvent.setPaper(newPaper); - timeline.getEvents().add(eventRepository.save(newEvent)); + objectClassName = newObject.getClass().getName(); + + switch(objectClassName) { + case "ru.ulstu.paper.model.Paper": + newPaper = (Paper)newObject; + timeline.getEvents().removeAll(events); + for (Deadline deadline : newPaper.getDeadlines() + .stream() + .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) + .collect(Collectors.toList())) { + Event newEvent = new Event(); + newEvent.setTitle("Дедлайн статьи"); + newEvent.setStatus(Event.EventStatus.NEW); + newEvent.setExecuteDate(deadline.getDate()); + newEvent.setCreateDate(new Date()); + newEvent.setUpdateDate(new Date()); + newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' cтатьи '" + newPaper.getTitle() + "'"); + newEvent.setRecipients(new ArrayList(newPaper.getAuthors())); + newEvent.setPaper(newPaper); + timeline.getEvents().add(eventRepository.save(newEvent)); + } + timelineService.save(timeline); + break; + case "ru.ulstu.conference.model.Conference": + newConference = (Conference)newObject; + for (Deadline deadline : newConference.getDeadlines() + .stream() + .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) + .collect(Collectors.toList())) { + Event newEvent = new Event(); + newEvent.setTitle("Дедлайн конференции"); + newEvent.setStatus(Event.EventStatus.NEW); + newEvent.setExecuteDate(deadline.getDate()); + newEvent.setCreateDate(new Date()); + newEvent.setUpdateDate(new Date()); + newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' конференции '" + newConference.getTitle() + "'"); + newConference.getUsers().forEach(conferenceUser -> newEvent.getRecipients().add(conferenceUser.getUser())); + newEvent.setConference(newConference); + save(newEvent); + + timeline.getEvents().add(newEvent); + timelineService.save(timeline); + } + break; + case "ru.ulstu.grant.model.Grant": + newGrant = (Grant)newObject; + for (Deadline deadline : newGrant.getDeadlines() + .stream() + .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) + .collect(Collectors.toList())) { + Event newEvent = new Event(); + newEvent.setTitle("Дедлайн гранта"); + newEvent.setStatus(Event.EventStatus.NEW); + newEvent.setExecuteDate(deadline.getDate()); + newEvent.setCreateDate(new Date()); + newEvent.setUpdateDate(new Date()); + newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' гранта '" + newGrant.getTitle() + "'"); + if (newGrant.getAuthors() != null) { + newEvent.setRecipients(new ArrayList(newGrant.getAuthors())); + } + newEvent.getRecipients().add(newGrant.getLeader()); + newEvent.setGrant(newGrant); + eventRepository.save(newEvent); + + timeline.getEvents().add(newEvent); + timelineService.save(timeline); + } + break; + case "ru.ulstu.project.model.Project": + newProject = (Project)newObject; + for (Deadline deadline : newProject.getDeadlines() + .stream() + .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) + .collect(Collectors.toList())) { + Event newEvent = new Event(); + newEvent.setTitle("Дедлайн проекта"); + newEvent.setStatus(Event.EventStatus.NEW); + newEvent.setExecuteDate(deadline.getDate()); + newEvent.setCreateDate(new Date()); + newEvent.setUpdateDate(new Date()); + newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' проекта '" + newProject.getTitle() + "'"); + if (newProject.getExecutors() != null) { + newEvent.setRecipients(new ArrayList(newProject.getExecutors())); + } + newEvent.setProject(newProject); + eventRepository.save(newEvent); + + timeline.getEvents().add(newEvent); + timelineService.save(timeline); + } + break; + case "ru.ulstu.students.model.Task": + newTask = (Task)newObject; + for (Deadline deadline : newTask.getDeadlines() + .stream() + .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) + .collect(Collectors.toList())) { + Event newEvent = new Event(); + newEvent.setTitle("Дедлайн задачи"); + newEvent.setStatus(Event.EventStatus.NEW); + newEvent.setExecuteDate(deadline.getDate()); + newEvent.setCreateDate(new Date()); + newEvent.setUpdateDate(new Date()); + newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' задачи '" + newTask.getTitle() + "'"); + newEvent.getRecipients().add(userService.getCurrentUser()); + newEvent.setTask(newTask); + eventRepository.save(newEvent); + + timeline.getEvents().add(newEvent); + timelineService.save(timeline); + } + System.out.println("5"); + break; + default: + System.out.println("No such object"); + break; } - timelineService.save(timeline); } public void updatePaperDeadlines(Paper paper) { List foundEvents = eventRepository.findAllByPaper(paper); eventRepository.delete(foundEvents); - createFromPaper(paper, foundEvents); + createFromObject(paper, foundEvents); } public List findByCurrentDate() { @@ -150,97 +259,19 @@ public class EventService { return convert(findAllFuture(), EventDto::new); } - public void createFromConference(Conference newConference) { - List timelines = timelineService.findAll(); - Timeline timeline = timelines.isEmpty() ? new Timeline() : timelines.get(0); - - for (Deadline deadline : newConference.getDeadlines() - .stream() - .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) - .collect(Collectors.toList())) { - Event newEvent = new Event(); - newEvent.setTitle("Дедлайн конференции"); - newEvent.setStatus(Event.EventStatus.NEW); - newEvent.setExecuteDate(deadline.getDate()); - newEvent.setCreateDate(new Date()); - newEvent.setUpdateDate(new Date()); - newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' конференции '" + newConference.getTitle() + "'"); - newConference.getUsers().forEach(conferenceUser -> newEvent.getRecipients().add(conferenceUser.getUser())); - newEvent.setConference(newConference); - save(newEvent); - - timeline.getEvents().add(newEvent); - timelineService.save(timeline); - } - } - public void updateConferenceDeadlines(Conference conference) { eventRepository.delete(eventRepository.findAllByConference(conference)); - createFromConference(conference); - } - - public void createFromGrant(Grant newGrant) { - List timelines = timelineService.findAll(); - Timeline timeline = timelines.isEmpty() ? new Timeline() : timelines.get(0); - - for (Deadline deadline : newGrant.getDeadlines() - .stream() - .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) - .collect(Collectors.toList())) { - Event newEvent = new Event(); - newEvent.setTitle("Дедлайн гранта"); - newEvent.setStatus(Event.EventStatus.NEW); - newEvent.setExecuteDate(deadline.getDate()); - newEvent.setCreateDate(new Date()); - newEvent.setUpdateDate(new Date()); - newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' гранта '" + newGrant.getTitle() + "'"); - if (newGrant.getAuthors() != null) { - newEvent.setRecipients(new ArrayList(newGrant.getAuthors())); - } - newEvent.getRecipients().add(newGrant.getLeader()); - newEvent.setGrant(newGrant); - eventRepository.save(newEvent); - - timeline.getEvents().add(newEvent); - timelineService.save(timeline); - } + createFromObject(conference, Collections.emptyList()); } public void updateGrantDeadlines(Grant grant) { eventRepository.delete(eventRepository.findAllByGrant(grant)); - createFromGrant(grant); - } - - public void createFromProject(Project newProject) { - List timelines = timelineService.findAll(); - Timeline timeline = timelines.isEmpty() ? new Timeline() : timelines.get(0); - - for (Deadline deadline : newProject.getDeadlines() - .stream() - .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) - .collect(Collectors.toList())) { - Event newEvent = new Event(); - newEvent.setTitle("Дедлайн проекта"); - newEvent.setStatus(Event.EventStatus.NEW); - newEvent.setExecuteDate(deadline.getDate()); - newEvent.setCreateDate(new Date()); - newEvent.setUpdateDate(new Date()); - newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' проекта '" + newProject.getTitle() + "'"); - if (newProject.getExecutors() != null) { - newEvent.setRecipients(new ArrayList(newProject.getExecutors())); - } -// newEvent.getRecipients().add((User) newProject.getExecutors()); - newEvent.setProject(newProject); - eventRepository.save(newEvent); - - timeline.getEvents().add(newEvent); - timelineService.save(timeline); - } + createFromObject(grant, Collections.emptyList()); } public void updateProjectDeadlines(Project project) { eventRepository.delete(eventRepository.findAllByProject(project)); - createFromProject(project); + createFromObject(project, Collections.emptyList()); } public void removeConferencesEvent(Conference conference) { @@ -248,32 +279,8 @@ public class EventService { eventList.forEach(event -> eventRepository.delete(event.getId())); } - public void createFromTask(Task newTask) { - List timelines = timelineService.findAll(); - Timeline timeline = timelines.isEmpty() ? new Timeline() : timelines.get(0); - - for (Deadline deadline : newTask.getDeadlines() - .stream() - .filter(d -> d.getDate().after(new Date()) || DateUtils.isSameDay(d.getDate(), new Date())) - .collect(Collectors.toList())) { - Event newEvent = new Event(); - newEvent.setTitle("Дедлайн задачи"); - newEvent.setStatus(Event.EventStatus.NEW); - newEvent.setExecuteDate(deadline.getDate()); - newEvent.setCreateDate(new Date()); - newEvent.setUpdateDate(new Date()); - newEvent.setDescription("Дедлайн '" + deadline.getDescription() + "' задачи '" + newTask.getTitle() + "'"); - newEvent.getRecipients().add(userService.getCurrentUser()); - newEvent.setTask(newTask); - eventRepository.save(newEvent); - - timeline.getEvents().add(newEvent); - timelineService.save(timeline); - } - } - public void updateTaskDeadlines(Task task) { eventRepository.delete(eventRepository.findAllByTask(task)); - createFromTask(task); + createFromObject(task, Collections.emptyList()); } } diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index aed9997..4504857 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -49,6 +49,6 @@ - + \ No newline at end of file From 961a6a318e29917922bfa539d792ecdda3e9cc9b Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 11:51:01 +0400 Subject: [PATCH 3/9] #101 event service edited --- src/main/java/ru/ulstu/timeline/service/EventService.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/ru/ulstu/timeline/service/EventService.java b/src/main/java/ru/ulstu/timeline/service/EventService.java index 01113c7..d307a8d 100644 --- a/src/main/java/ru/ulstu/timeline/service/EventService.java +++ b/src/main/java/ru/ulstu/timeline/service/EventService.java @@ -123,7 +123,6 @@ public class EventService { List timelines = timelineService.findAll(); Timeline timeline = timelines.isEmpty() ? new Timeline() : timelines.get(0); objectClassName = newObject.getClass().getName(); - switch(objectClassName) { case "ru.ulstu.paper.model.Paper": newPaper = (Paper)newObject; @@ -240,7 +239,6 @@ public class EventService { break; } } - public void updatePaperDeadlines(Paper paper) { List foundEvents = eventRepository.findAllByPaper(paper); eventRepository.delete(foundEvents); From 7edb9d2aa38d27778a16d6c3c2389333de3a3e09 Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 11:56:38 +0400 Subject: [PATCH 4/9] #101 event service edited --- src/main/java/ru/ulstu/paper/service/LatexService.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/ru/ulstu/paper/service/LatexService.java b/src/main/java/ru/ulstu/paper/service/LatexService.java index 82dd1ba..27dfa1e 100644 --- a/src/main/java/ru/ulstu/paper/service/LatexService.java +++ b/src/main/java/ru/ulstu/paper/service/LatexService.java @@ -41,12 +41,6 @@ public class LatexService { Process process = processBuilder.start(); InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream()); - try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { - while ((bufferedReader.readLine()) != null) { - // - } - } - int exitCode = process.waitFor(); if (exitCode != 0) { errorMessage = message + " Exit value of the process: " + exitCode; From 38478835fbca880a8dabf764d6a9d28c0435fc78 Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 12:03:42 +0400 Subject: [PATCH 5/9] #101 event service edited --- src/test/java/ru/ulstu/project/service/ProjectServiceTest.java | 2 +- src/test/java/ru/ulstu/students/service/TaskServiceTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/ru/ulstu/project/service/ProjectServiceTest.java b/src/test/java/ru/ulstu/project/service/ProjectServiceTest.java index 7c4f5fa..d06ad0e 100644 --- a/src/test/java/ru/ulstu/project/service/ProjectServiceTest.java +++ b/src/test/java/ru/ulstu/project/service/ProjectServiceTest.java @@ -99,7 +99,7 @@ public class ProjectServiceTest { public void create() throws IOException { when(deadlineService.saveOrCreate(new ArrayList<>())).thenReturn(deadlines); when(projectRepository.save(new Project())).thenReturn(project); - eventService.createFromProject(new Project()); + eventService.createFromObject(new Project(), Collections.emptyList()); projectDto.setTitle(TITLE); projectDto.setDeadlines(deadlines); diff --git a/src/test/java/ru/ulstu/students/service/TaskServiceTest.java b/src/test/java/ru/ulstu/students/service/TaskServiceTest.java index 8edfc77..0d33630 100644 --- a/src/test/java/ru/ulstu/students/service/TaskServiceTest.java +++ b/src/test/java/ru/ulstu/students/service/TaskServiceTest.java @@ -136,7 +136,7 @@ public class TaskServiceTest { when(tagService.saveOrCreate(new ArrayList<>())).thenReturn(tags); when(deadlineService.saveOrCreate(new ArrayList<>())).thenReturn(deadlines); when(taskRepository.save(new Task())).thenReturn(task); - eventService.createFromTask(new Task()); + eventService.createFromObject(new Task(), Collections.emptyList()); taskDto.setTags(tags); taskDto.setDeadlines(deadlines); From ae8dc58a9dab04bafa5a2722d383cda2d428bbe9 Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 12:16:59 +0400 Subject: [PATCH 6/9] #101 event service edited --- src/main/resources/application.properties | 4 ++-- src/main/resources/db/changelog-20190528_000002-schema.xml | 2 +- src/main/resources/db/changelog-master.xml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f4be778..276e6c4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -22,9 +22,9 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.ssl.enable=true spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory # JPA Settings -spring.datasource.url=jdbc:postgresql://localhost:5432/ng-tracker +spring.datasource.url=jdbc:postgresql://localhost:5433/ng-tracker spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=1234 spring.datasource.driverclassName=org.postgresql.Driver spring.jpa.hibernate.ddl-auto=validate # Liquibase Settings diff --git a/src/main/resources/db/changelog-20190528_000002-schema.xml b/src/main/resources/db/changelog-20190528_000002-schema.xml index 7df707c..a4e2032 100644 --- a/src/main/resources/db/changelog-20190528_000002-schema.xml +++ b/src/main/resources/db/changelog-20190528_000002-schema.xml @@ -2,7 +2,7 @@ - + diff --git a/src/main/resources/db/changelog-master.xml b/src/main/resources/db/changelog-master.xml index 4504857..26ad8b9 100644 --- a/src/main/resources/db/changelog-master.xml +++ b/src/main/resources/db/changelog-master.xml @@ -49,6 +49,7 @@ + \ No newline at end of file From e6dc2abdd9ca7292a3bf4115a6c20eb27fbdbe68 Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 12:23:52 +0400 Subject: [PATCH 7/9] #101 event service edited --- src/main/resources/application.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 276e6c4..f4be778 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -22,9 +22,9 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.ssl.enable=true spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory # JPA Settings -spring.datasource.url=jdbc:postgresql://localhost:5433/ng-tracker +spring.datasource.url=jdbc:postgresql://localhost:5432/ng-tracker spring.datasource.username=postgres -spring.datasource.password=1234 +spring.datasource.password=postgres spring.datasource.driverclassName=org.postgresql.Driver spring.jpa.hibernate.ddl-auto=validate # Liquibase Settings From db3252d8228da4662275e92fe262c1da9703039f Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 12:55:13 +0400 Subject: [PATCH 8/9] #101 event service edited --- src/main/java/ru/ulstu/paper/service/LatexService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/ru/ulstu/paper/service/LatexService.java b/src/main/java/ru/ulstu/paper/service/LatexService.java index 27dfa1e..82dd1ba 100644 --- a/src/main/java/ru/ulstu/paper/service/LatexService.java +++ b/src/main/java/ru/ulstu/paper/service/LatexService.java @@ -41,6 +41,12 @@ public class LatexService { Process process = processBuilder.start(); InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream()); + try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { + while ((bufferedReader.readLine()) != null) { + // + } + } + int exitCode = process.waitFor(); if (exitCode != 0) { errorMessage = message + " Exit value of the process: " + exitCode; From bde4ac5f1c3a98235f2062e713e78fa21b91eacd Mon Sep 17 00:00:00 2001 From: "a.vasin" Date: Sat, 1 Jun 2019 13:25:12 +0400 Subject: [PATCH 9/9] #101 event service edited --- src/main/java/ru/ulstu/paper/service/LatexService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/paper/service/LatexService.java b/src/main/java/ru/ulstu/paper/service/LatexService.java index 82dd1ba..9892e35 100644 --- a/src/main/java/ru/ulstu/paper/service/LatexService.java +++ b/src/main/java/ru/ulstu/paper/service/LatexService.java @@ -42,8 +42,9 @@ public class LatexService { InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream()); try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { - while ((bufferedReader.readLine()) != null) { - // + String line = bufferedReader.readLine(); + while (line != null) { + line = bufferedReader.readLine(); } }