From bcc64cda96abc23dfc45dd067895b02a5b2918d0 Mon Sep 17 00:00:00 2001 From: T-Midnight Date: Tue, 25 Dec 2018 12:50:14 +0400 Subject: [PATCH] Create model folder for grant --- .../{model => }/controller/GrantController.java | 4 ++-- src/main/java/ru/ulstu/grant/model/GrantDto.java | 1 + .../java/ru/ulstu/grant/model/GrantStatusDto.java | 2 ++ .../{model => }/repository/GrantRepository.java | 2 +- .../grant/{model => }/service/GrantService.java | 7 +++---- .../ulstu/project/repository/ProjectRepository.java | 1 - .../ru/ulstu/project/service/ProjectService.java | 12 ------------ 7 files changed, 9 insertions(+), 20 deletions(-) rename src/main/java/ru/ulstu/grant/{model => }/controller/GrantController.java (97%) rename src/main/java/ru/ulstu/grant/{model => }/repository/GrantRepository.java (90%) rename src/main/java/ru/ulstu/grant/{model => }/service/GrantService.java (96%) diff --git a/src/main/java/ru/ulstu/grant/model/controller/GrantController.java b/src/main/java/ru/ulstu/grant/controller/GrantController.java similarity index 97% rename from src/main/java/ru/ulstu/grant/model/controller/GrantController.java rename to src/main/java/ru/ulstu/grant/controller/GrantController.java index 350611d..636c6e5 100644 --- a/src/main/java/ru/ulstu/grant/model/controller/GrantController.java +++ b/src/main/java/ru/ulstu/grant/controller/GrantController.java @@ -1,4 +1,4 @@ -package ru.ulstu.grant.model.controller; +package ru.ulstu.grant.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.*; import ru.ulstu.deadline.model.DeadlineDto; import ru.ulstu.grant.model.Grant; import ru.ulstu.grant.model.GrantDto; -import ru.ulstu.grant.model.service.GrantService; +import ru.ulstu.grant.service.GrantService; import javax.validation.Valid; import java.io.IOException; diff --git a/src/main/java/ru/ulstu/grant/model/GrantDto.java b/src/main/java/ru/ulstu/grant/model/GrantDto.java index 9070337..0f1850a 100644 --- a/src/main/java/ru/ulstu/grant/model/GrantDto.java +++ b/src/main/java/ru/ulstu/grant/model/GrantDto.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.DeadlineDto; +import ru.ulstu.grant.model.Grant; import ru.ulstu.project.model.ProjectDto; import java.util.ArrayList; diff --git a/src/main/java/ru/ulstu/grant/model/GrantStatusDto.java b/src/main/java/ru/ulstu/grant/model/GrantStatusDto.java index dae40e2..bcd5563 100644 --- a/src/main/java/ru/ulstu/grant/model/GrantStatusDto.java +++ b/src/main/java/ru/ulstu/grant/model/GrantStatusDto.java @@ -1,5 +1,7 @@ package ru.ulstu.grant.model; +import ru.ulstu.grant.model.Grant; + public class GrantStatusDto { private final String id; private final String name; diff --git a/src/main/java/ru/ulstu/grant/model/repository/GrantRepository.java b/src/main/java/ru/ulstu/grant/repository/GrantRepository.java similarity index 90% rename from src/main/java/ru/ulstu/grant/model/repository/GrantRepository.java rename to src/main/java/ru/ulstu/grant/repository/GrantRepository.java index bd1067d..65f2eb1 100644 --- a/src/main/java/ru/ulstu/grant/model/repository/GrantRepository.java +++ b/src/main/java/ru/ulstu/grant/repository/GrantRepository.java @@ -1,4 +1,4 @@ -package ru.ulstu.grant.model.repository; +package ru.ulstu.grant.repository; import org.springframework.data.jpa.repository.JpaRepository; import ru.ulstu.grant.model.Grant; diff --git a/src/main/java/ru/ulstu/grant/model/service/GrantService.java b/src/main/java/ru/ulstu/grant/service/GrantService.java similarity index 96% rename from src/main/java/ru/ulstu/grant/model/service/GrantService.java rename to src/main/java/ru/ulstu/grant/service/GrantService.java index b753009..1c061d2 100644 --- a/src/main/java/ru/ulstu/grant/model/service/GrantService.java +++ b/src/main/java/ru/ulstu/grant/service/GrantService.java @@ -1,4 +1,4 @@ -package ru.ulstu.grant.model.service; +package ru.ulstu.grant.service; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -8,10 +8,9 @@ import ru.ulstu.deadline.service.DeadlineService; import ru.ulstu.file.service.FileService; import ru.ulstu.grant.model.Grant; import ru.ulstu.grant.model.GrantDto; -import ru.ulstu.grant.model.repository.GrantRepository; +import ru.ulstu.grant.repository.GrantRepository; import ru.ulstu.project.model.Project; import ru.ulstu.project.model.ProjectDto; -import ru.ulstu.project.repository.ProjectRepository; import ru.ulstu.project.service.ProjectService; import java.io.IOException; @@ -144,7 +143,7 @@ public class GrantService { } public GrantDto findGrant(int id) { - return new ru.ulstu.grant.model.GrantDto(grantRepository.getOne(id)); + return new GrantDto(grantRepository.getOne(id)); } public void closeFailedGrants() { diff --git a/src/main/java/ru/ulstu/project/repository/ProjectRepository.java b/src/main/java/ru/ulstu/project/repository/ProjectRepository.java index 5a41fb1..ac41af2 100644 --- a/src/main/java/ru/ulstu/project/repository/ProjectRepository.java +++ b/src/main/java/ru/ulstu/project/repository/ProjectRepository.java @@ -1,7 +1,6 @@ package ru.ulstu.project.repository; import org.springframework.data.jpa.repository.JpaRepository; -import ru.ulstu.grant.model.Grant; import ru.ulstu.project.model.Project; public interface ProjectRepository extends JpaRepository { diff --git a/src/main/java/ru/ulstu/project/service/ProjectService.java b/src/main/java/ru/ulstu/project/service/ProjectService.java index 43802df..1a4d1c7 100644 --- a/src/main/java/ru/ulstu/project/service/ProjectService.java +++ b/src/main/java/ru/ulstu/project/service/ProjectService.java @@ -1,28 +1,16 @@ package ru.ulstu.project.service; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import ru.ulstu.deadline.model.Deadline; import ru.ulstu.deadline.service.DeadlineService; -import ru.ulstu.file.service.FileService; -import ru.ulstu.grant.model.Grant; -import ru.ulstu.grant.model.GrantDto; -import ru.ulstu.grant.model.repository.GrantRepository; import ru.ulstu.project.model.Project; import ru.ulstu.project.model.ProjectDto; import ru.ulstu.project.repository.ProjectRepository; -import java.io.IOException; -import java.util.Arrays; -import java.util.Date; import java.util.List; -import java.util.stream.Collectors; import static org.springframework.util.ObjectUtils.isEmpty; import static ru.ulstu.core.util.StreamApiUtils.convert; -import static ru.ulstu.grant.model.Grant.GrantStatus.APPLICATION; -import static ru.ulstu.grant.model.Grant.GrantStatus.IN_WORK; @Service public class ProjectService {