From 5eae7305c4523f2c656b5b660352540cee4a7143 Mon Sep 17 00:00:00 2001 From: ASH Date: Thu, 11 Apr 2019 00:14:03 +0400 Subject: [PATCH] #74 codestyle --- .../students/controller/TaskController.java | 5 +++-- .../java/ru/ulstu/students/model/TaskDto.java | 18 +++++++++--------- .../ru/ulstu/students/service/TaskService.java | 2 +- .../ulstu/tags/repository/TagRepository.java | 2 +- .../java/ru/ulstu/tags/service/TagService.java | 1 + .../students/fragments/taskLineFragment.html | 8 ++++---- .../fragments/taskNavigationFragment.html | 2 +- .../students/fragments/taskStatusFragment.html | 2 +- .../resources/templates/students/task.html | 5 +++-- 9 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main/java/ru/ulstu/students/controller/TaskController.java b/src/main/java/ru/ulstu/students/controller/TaskController.java index 52c9fc7..4b4d12d 100644 --- a/src/main/java/ru/ulstu/students/controller/TaskController.java +++ b/src/main/java/ru/ulstu/students/controller/TaskController.java @@ -11,6 +11,7 @@ import ru.ulstu.tags.model.Tag; import ru.ulstu.tags.model.TagDto; import springfox.documentation.annotations.ApiIgnore; import ru.ulstu.students.service.TaskService; + import javax.validation.Valid; import java.io.IOException; import java.util.List; @@ -55,7 +56,7 @@ public class TaskController { if (taskDto.getDeadlines().isEmpty()) { errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); } - if(errors.hasErrors()) + if (errors.hasErrors()) return TASK_PAGE; taskService.save(taskDto); return String.format(REDIRECT_TO, TASKS_PAGE); @@ -64,7 +65,7 @@ public class TaskController { @PostMapping(value = "/task", params = "addDeadline") public String addDeadline(@Valid TaskDto taskDto, Errors errors) { filterEmptyDeadlines(taskDto); - if(errors.hasErrors()) + if (errors.hasErrors()) return TASK_PAGE; taskDto.getDeadlines().add(new Deadline()); return TASK_PAGE; diff --git a/src/main/java/ru/ulstu/students/model/TaskDto.java b/src/main/java/ru/ulstu/students/model/TaskDto.java index 896d9ea..dc41be8 100644 --- a/src/main/java/ru/ulstu/students/model/TaskDto.java +++ b/src/main/java/ru/ulstu/students/model/TaskDto.java @@ -36,14 +36,14 @@ public class TaskDto { @JsonCreator public TaskDto(@JsonProperty("id") Integer id, - @JsonProperty("title") String title, - @JsonProperty("description") String description, - @JsonProperty("createDate") Date createDate, - @JsonProperty("updateDate") Date updateDate, - @JsonProperty("status") Task.TaskStatus status, - @JsonProperty("deadlines") List deadlines, - @JsonProperty("tagIds") Set tagIds, - @JsonProperty("tags") Set tags){ + @JsonProperty("title") String title, + @JsonProperty("description") String description, + @JsonProperty("createDate") Date createDate, + @JsonProperty("updateDate") Date updateDate, + @JsonProperty("status") Task.TaskStatus status, + @JsonProperty("deadlines") List deadlines, + @JsonProperty("tagIds") Set tagIds, + @JsonProperty("tags") Set tags) { this.id = id; this.title = title; this.status = status; @@ -142,6 +142,6 @@ public class TaskDto { return StringUtils.abbreviate(tags .stream() .map(tag -> tag.getTagName()) - .collect(Collectors.joining(", ")), MAX_TAGS_LENGTH ); + .collect(Collectors.joining(", ")), MAX_TAGS_LENGTH); } } diff --git a/src/main/java/ru/ulstu/students/service/TaskService.java b/src/main/java/ru/ulstu/students/service/TaskService.java index 22190ee..5e969ac 100644 --- a/src/main/java/ru/ulstu/students/service/TaskService.java +++ b/src/main/java/ru/ulstu/students/service/TaskService.java @@ -28,7 +28,7 @@ public class TaskService { private final TagService tagService; public TaskService(TaskRepository grantRepository, - DeadlineService deadlineService, TagService tagService){ + DeadlineService deadlineService, TagService tagService) { this.taskRepository = grantRepository; this.deadlineService = deadlineService; this.tagService = tagService; diff --git a/src/main/java/ru/ulstu/tags/repository/TagRepository.java b/src/main/java/ru/ulstu/tags/repository/TagRepository.java index 038a740..d4a9c76 100644 --- a/src/main/java/ru/ulstu/tags/repository/TagRepository.java +++ b/src/main/java/ru/ulstu/tags/repository/TagRepository.java @@ -3,6 +3,6 @@ package ru.ulstu.tags.repository; import org.springframework.data.jpa.repository.JpaRepository; import ru.ulstu.tags.model.TagDto; -public interface TagRepository extends JpaRepository{ +public interface TagRepository extends JpaRepository { } diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java index 4d8232f..adf2a82 100644 --- a/src/main/java/ru/ulstu/tags/service/TagService.java +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -5,6 +5,7 @@ import org.springframework.stereotype.Service; import ru.ulstu.tags.model.TagDto; import ru.ulstu.tags.repository.TagRepository; + import javax.transaction.Transactional; import java.util.Set; import java.util.stream.Collectors; diff --git a/src/main/resources/templates/students/fragments/taskLineFragment.html b/src/main/resources/templates/students/fragments/taskLineFragment.html index 122de6d..baad17e 100644 --- a/src/main/resources/templates/students/fragments/taskLineFragment.html +++ b/src/main/resources/templates/students/fragments/taskLineFragment.html @@ -6,12 +6,12 @@
- - + + - + - + diff --git a/src/main/resources/templates/students/fragments/taskNavigationFragment.html b/src/main/resources/templates/students/fragments/taskNavigationFragment.html index 33f5cdb..cf32140 100644 --- a/src/main/resources/templates/students/fragments/taskNavigationFragment.html +++ b/src/main/resources/templates/students/fragments/taskNavigationFragment.html @@ -16,7 +16,7 @@ diff --git a/src/main/resources/templates/students/fragments/taskStatusFragment.html b/src/main/resources/templates/students/fragments/taskStatusFragment.html index ea9a3e9..77fd529 100644 --- a/src/main/resources/templates/students/fragments/taskStatusFragment.html +++ b/src/main/resources/templates/students/fragments/taskStatusFragment.html @@ -7,7 +7,7 @@ - +
diff --git a/src/main/resources/templates/students/task.html b/src/main/resources/templates/students/task.html index ceda3bc..74ec8f6 100644 --- a/src/main/resources/templates/students/task.html +++ b/src/main/resources/templates/students/task.html @@ -1,9 +1,10 @@ + layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html"> - +