From 957c1bbc8c257b7238ec67e059c8050ba9a77b73 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 15 Oct 2022 22:36:08 +0400 Subject: [PATCH 1/3] #72 -- classes refactor --- .../extractor/{ => author}/model/Author.java | 4 +++- .../repository/AuthorRepository.java | 4 ++-- .../{ => author}/service/AuthorService.java | 6 +++--- .../branch/controller/BranchController.java | 6 +++--- .../ulstu/extractor/branch/model/Branch.java | 2 +- .../branch/service/BranchService.java | 2 +- .../ulstu/extractor/commit/model/Commit.java | 3 +++ .../commit/service/CommitService.java | 2 +- .../extractor/config/MvcConfiguration.java | 2 +- .../extractor/{model => core}/BaseEntity.java | 2 +- .../{model => core}/OffsetablePageRequest.java | 2 +- .../extractor/{controller => core}/Route.java | 2 +- .../controler}/GitFilteringController.java | 10 +++++----- .../controler}/GitIndexingController.java | 14 +++++++------- .../controler}/RepoController.java | 8 ++++---- .../controler}/RepositoryController.java | 8 ++++---- .../controler}/StatisticController.java | 8 ++++---- .../{ => gitrepository}/model/FileChange.java | 3 ++- .../model}/FilterForm.java | 2 +- .../gitrepository/model/GitRepository.java | 2 +- .../{ => gitrepository}/model/LineChange.java | 4 +++- .../mvc => gitrepository/model}/RepoForm.java | 2 +- .../GitRepositoryRepository.java | 2 +- .../service/FilteringService.java | 6 +++--- .../{ => service}/GitRepositoryService.java | 9 +++++---- .../service/IndexService.java | 7 +++---- .../controller/StructuralUnitController.java | 2 +- .../ulstu/extractor/http/JsonTimeSeries.java | 2 +- .../extractor/http/JsonTimeSeriesValue.java | 2 +- .../{ => rule}/controller/RuleController.java | 14 +++++++------- .../{model/mvc => rule/model}/AddRuleForm.java | 2 +- .../{ => rule}/model/AntecedentValue.java | 4 +++- .../ulstu/extractor/{ => rule}/model/Rule.java | 5 ++++- .../repository/AntecedentValueRepository.java | 4 ++-- .../{ => rule}/repository/RuleRepository.java | 4 ++-- .../service/AntecedentValueService.java | 6 +++--- .../{ => rule}/service/RuleService.java | 9 +++++---- .../AbstractTimeSeriesCreator.java | 8 ++++---- .../extractor/ts/{ => creator}/AuthorTS.java | 6 +++--- .../ts/{ => creator}/AuthorsCommentTS.java | 6 +++--- .../{ => creator}/AuthorsCompletedIssueTS.java | 6 +++--- .../ts/{ => creator}/AuthorsIssueTS.java | 6 +++--- .../extractor/ts/{ => creator}/BranchTS.java | 6 +++--- .../extractor/ts/{ => creator}/ClassTS.java | 6 +++--- .../extractor/ts/{ => creator}/CommitsTS.java | 8 ++++---- .../ts/{ => creator}/DependenceTS.java | 6 +++--- .../extractor/ts/{ => creator}/EntityTS.java | 6 +++--- .../extractor/ts/{ => creator}/FileTS.java | 6 +++--- .../ts/{ => creator}/InterfaceTS.java | 6 +++--- .../extractor/ts/{ => creator}/IssuesTS.java | 6 +++--- .../extractor/ts/{ => creator}/ProcessTS.java | 6 +++--- .../extractor/ts/{ => creator}/StarTS.java | 6 +++--- .../extractor/{ => ts}/model/TimeSeries.java | 3 ++- .../{ => ts}/model/TimeSeriesValue.java | 4 +++- .../repository/TimeSeriesRepository.java | 4 ++-- .../repository/TimeSeriesValueRepository.java | 4 ++-- .../{ => ts}/service/TimeSeriesService.java | 18 +++++++++++------- .../ts/{ => util}/TimeSeriesDateMapper.java | 6 +++--- .../java/ru/ulstu/TimeSeriesMapperTest.java | 6 +++--- 59 files changed, 168 insertions(+), 147 deletions(-) rename src/main/java/ru/ulstu/extractor/{ => author}/model/Author.java (79%) rename src/main/java/ru/ulstu/extractor/{ => author}/repository/AuthorRepository.java (93%) rename src/main/java/ru/ulstu/extractor/{ => author}/service/AuthorService.java (85%) rename src/main/java/ru/ulstu/extractor/{model => core}/BaseEntity.java (98%) rename src/main/java/ru/ulstu/extractor/{model => core}/OffsetablePageRequest.java (98%) rename src/main/java/ru/ulstu/extractor/{controller => core}/Route.java (97%) rename src/main/java/ru/ulstu/extractor/{controller => gitrepository/controler}/GitFilteringController.java (91%) rename src/main/java/ru/ulstu/extractor/{controller => gitrepository/controler}/GitIndexingController.java (87%) rename src/main/java/ru/ulstu/extractor/{controller => gitrepository/controler}/RepoController.java (89%) rename src/main/java/ru/ulstu/extractor/{controller => gitrepository/controler}/RepositoryController.java (82%) rename src/main/java/ru/ulstu/extractor/{controller => gitrepository/controler}/StatisticController.java (96%) rename src/main/java/ru/ulstu/extractor/{ => gitrepository}/model/FileChange.java (96%) rename src/main/java/ru/ulstu/extractor/{model/mvc => gitrepository/model}/FilterForm.java (97%) rename src/main/java/ru/ulstu/extractor/{ => gitrepository}/model/LineChange.java (93%) rename src/main/java/ru/ulstu/extractor/{model/mvc => gitrepository/model}/RepoForm.java (91%) rename src/main/java/ru/ulstu/extractor/gitrepository/{ => repository}/GitRepositoryRepository.java (82%) rename src/main/java/ru/ulstu/extractor/{ => gitrepository}/service/FilteringService.java (92%) rename src/main/java/ru/ulstu/extractor/gitrepository/{ => service}/GitRepositoryService.java (98%) rename src/main/java/ru/ulstu/extractor/{ => gitrepository}/service/IndexService.java (93%) rename src/main/java/ru/ulstu/extractor/{ => rule}/controller/RuleController.java (82%) rename src/main/java/ru/ulstu/extractor/{model/mvc => rule/model}/AddRuleForm.java (97%) rename src/main/java/ru/ulstu/extractor/{ => rule}/model/AntecedentValue.java (85%) rename src/main/java/ru/ulstu/extractor/{ => rule}/model/Rule.java (95%) rename src/main/java/ru/ulstu/extractor/{ => rule}/repository/AntecedentValueRepository.java (62%) rename src/main/java/ru/ulstu/extractor/{ => rule}/repository/RuleRepository.java (61%) rename src/main/java/ru/ulstu/extractor/{ => rule}/service/AntecedentValueService.java (81%) rename src/main/java/ru/ulstu/extractor/{ => rule}/service/RuleService.java (82%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/AbstractTimeSeriesCreator.java (87%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/AuthorTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/AuthorsCommentTS.java (84%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/AuthorsCompletedIssueTS.java (84%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/AuthorsIssueTS.java (84%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/BranchTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/ClassTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/CommitsTS.java (88%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/DependenceTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/EntityTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/FileTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/InterfaceTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/IssuesTS.java (84%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/ProcessTS.java (83%) rename src/main/java/ru/ulstu/extractor/ts/{ => creator}/StarTS.java (83%) rename src/main/java/ru/ulstu/extractor/{ => ts}/model/TimeSeries.java (93%) rename src/main/java/ru/ulstu/extractor/{ => ts}/model/TimeSeriesValue.java (89%) rename src/main/java/ru/ulstu/extractor/{ => ts}/repository/TimeSeriesRepository.java (71%) rename src/main/java/ru/ulstu/extractor/{ => ts}/repository/TimeSeriesValueRepository.java (80%) rename src/main/java/ru/ulstu/extractor/{ => ts}/service/TimeSeriesService.java (91%) rename src/main/java/ru/ulstu/extractor/ts/{ => util}/TimeSeriesDateMapper.java (94%) diff --git a/src/main/java/ru/ulstu/extractor/model/Author.java b/src/main/java/ru/ulstu/extractor/author/model/Author.java similarity index 79% rename from src/main/java/ru/ulstu/extractor/model/Author.java rename to src/main/java/ru/ulstu/extractor/author/model/Author.java index 2462d5b..efd5ba1 100644 --- a/src/main/java/ru/ulstu/extractor/model/Author.java +++ b/src/main/java/ru/ulstu/extractor/author/model/Author.java @@ -1,4 +1,6 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.author.model; + +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/repository/AuthorRepository.java b/src/main/java/ru/ulstu/extractor/author/repository/AuthorRepository.java similarity index 93% rename from src/main/java/ru/ulstu/extractor/repository/AuthorRepository.java rename to src/main/java/ru/ulstu/extractor/author/repository/AuthorRepository.java index 0ae8a20..e20f19d 100644 --- a/src/main/java/ru/ulstu/extractor/repository/AuthorRepository.java +++ b/src/main/java/ru/ulstu/extractor/author/repository/AuthorRepository.java @@ -3,13 +3,13 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.repository; +package ru.ulstu.extractor.author.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import ru.ulstu.extractor.author.model.Author; import ru.ulstu.extractor.gitrepository.model.GitRepository; -import ru.ulstu.extractor.model.Author; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/service/AuthorService.java b/src/main/java/ru/ulstu/extractor/author/service/AuthorService.java similarity index 85% rename from src/main/java/ru/ulstu/extractor/service/AuthorService.java rename to src/main/java/ru/ulstu/extractor/author/service/AuthorService.java index c04cfd1..659e17c 100644 --- a/src/main/java/ru/ulstu/extractor/service/AuthorService.java +++ b/src/main/java/ru/ulstu/extractor/author/service/AuthorService.java @@ -3,13 +3,13 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.service; +package ru.ulstu.extractor.author.service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import ru.ulstu.extractor.model.Author; -import ru.ulstu.extractor.repository.AuthorRepository; +import ru.ulstu.extractor.author.model.Author; +import ru.ulstu.extractor.author.repository.AuthorRepository; import java.util.Optional; diff --git a/src/main/java/ru/ulstu/extractor/branch/controller/BranchController.java b/src/main/java/ru/ulstu/extractor/branch/controller/BranchController.java index 22432bd..8b79a93 100644 --- a/src/main/java/ru/ulstu/extractor/branch/controller/BranchController.java +++ b/src/main/java/ru/ulstu/extractor/branch/controller/BranchController.java @@ -10,11 +10,11 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import ru.ulstu.extractor.branch.repository.BranchRepository; -import ru.ulstu.extractor.gitrepository.GitRepositoryRepository; +import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository; import springfox.documentation.annotations.ApiIgnore; -import static ru.ulstu.extractor.controller.Route.DELETE_BRANCH; -import static ru.ulstu.extractor.controller.Route.LIST_REPOSITORY_BRANCHES; +import static ru.ulstu.extractor.core.Route.DELETE_BRANCH; +import static ru.ulstu.extractor.core.Route.LIST_REPOSITORY_BRANCHES; @Controller @ApiIgnore diff --git a/src/main/java/ru/ulstu/extractor/branch/model/Branch.java b/src/main/java/ru/ulstu/extractor/branch/model/Branch.java index 6837771..12a9f01 100644 --- a/src/main/java/ru/ulstu/extractor/branch/model/Branch.java +++ b/src/main/java/ru/ulstu/extractor/branch/model/Branch.java @@ -7,8 +7,8 @@ package ru.ulstu.extractor.branch.model; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; +import ru.ulstu.extractor.core.BaseEntity; import ru.ulstu.extractor.gitrepository.model.GitRepository; -import ru.ulstu.extractor.model.BaseEntity; import ru.ulstu.extractor.model.Commit; import javax.persistence.CascadeType; diff --git a/src/main/java/ru/ulstu/extractor/branch/service/BranchService.java b/src/main/java/ru/ulstu/extractor/branch/service/BranchService.java index 3d6fd28..ebb51aa 100644 --- a/src/main/java/ru/ulstu/extractor/branch/service/BranchService.java +++ b/src/main/java/ru/ulstu/extractor/branch/service/BranchService.java @@ -12,8 +12,8 @@ import org.springframework.transaction.annotation.Transactional; import ru.ulstu.extractor.branch.model.Branch; import ru.ulstu.extractor.branch.repository.BranchRepository; import ru.ulstu.extractor.commit.service.CommitService; +import ru.ulstu.extractor.core.BaseEntity; import ru.ulstu.extractor.gitrepository.model.GitRepository; -import ru.ulstu.extractor.model.BaseEntity; import ru.ulstu.extractor.model.Commit; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/commit/model/Commit.java b/src/main/java/ru/ulstu/extractor/commit/model/Commit.java index 699ff94..9f8f109 100644 --- a/src/main/java/ru/ulstu/extractor/commit/model/Commit.java +++ b/src/main/java/ru/ulstu/extractor/commit/model/Commit.java @@ -7,7 +7,10 @@ package ru.ulstu.extractor.model; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; +import ru.ulstu.extractor.author.model.Author; import ru.ulstu.extractor.branch.model.Branch; +import ru.ulstu.extractor.core.BaseEntity; +import ru.ulstu.extractor.gitrepository.model.FileChange; import javax.persistence.CascadeType; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/commit/service/CommitService.java b/src/main/java/ru/ulstu/extractor/commit/service/CommitService.java index fd1c449..050437a 100644 --- a/src/main/java/ru/ulstu/extractor/commit/service/CommitService.java +++ b/src/main/java/ru/ulstu/extractor/commit/service/CommitService.java @@ -7,9 +7,9 @@ package ru.ulstu.extractor.commit.service; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; +import ru.ulstu.extractor.author.service.AuthorService; import ru.ulstu.extractor.commit.repository.CommitRepository; import ru.ulstu.extractor.model.Commit; -import ru.ulstu.extractor.service.AuthorService; import java.util.List; import java.util.stream.Collectors; diff --git a/src/main/java/ru/ulstu/extractor/config/MvcConfiguration.java b/src/main/java/ru/ulstu/extractor/config/MvcConfiguration.java index 035f359..d4f9a9c 100644 --- a/src/main/java/ru/ulstu/extractor/config/MvcConfiguration.java +++ b/src/main/java/ru/ulstu/extractor/config/MvcConfiguration.java @@ -10,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import static ru.ulstu.extractor.controller.Route.LIST_INDEXED_REPOSITORIES; +import static ru.ulstu.extractor.core.Route.LIST_INDEXED_REPOSITORIES; @Configuration public class MvcConfiguration implements WebMvcConfigurer { diff --git a/src/main/java/ru/ulstu/extractor/model/BaseEntity.java b/src/main/java/ru/ulstu/extractor/core/BaseEntity.java similarity index 98% rename from src/main/java/ru/ulstu/extractor/model/BaseEntity.java rename to src/main/java/ru/ulstu/extractor/core/BaseEntity.java index 0859807..43690f1 100644 --- a/src/main/java/ru/ulstu/extractor/model/BaseEntity.java +++ b/src/main/java/ru/ulstu/extractor/core/BaseEntity.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.core; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; diff --git a/src/main/java/ru/ulstu/extractor/model/OffsetablePageRequest.java b/src/main/java/ru/ulstu/extractor/core/OffsetablePageRequest.java similarity index 98% rename from src/main/java/ru/ulstu/extractor/model/OffsetablePageRequest.java rename to src/main/java/ru/ulstu/extractor/core/OffsetablePageRequest.java index e96673b..f48e7cc 100644 --- a/src/main/java/ru/ulstu/extractor/model/OffsetablePageRequest.java +++ b/src/main/java/ru/ulstu/extractor/core/OffsetablePageRequest.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.core; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/src/main/java/ru/ulstu/extractor/controller/Route.java b/src/main/java/ru/ulstu/extractor/core/Route.java similarity index 97% rename from src/main/java/ru/ulstu/extractor/controller/Route.java rename to src/main/java/ru/ulstu/extractor/core/Route.java index 77e1efe..9627848 100644 --- a/src/main/java/ru/ulstu/extractor/controller/Route.java +++ b/src/main/java/ru/ulstu/extractor/core/Route.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.core; import org.springframework.stereotype.Component; diff --git a/src/main/java/ru/ulstu/extractor/controller/GitFilteringController.java b/src/main/java/ru/ulstu/extractor/gitrepository/controler/GitFilteringController.java similarity index 91% rename from src/main/java/ru/ulstu/extractor/controller/GitFilteringController.java rename to src/main/java/ru/ulstu/extractor/gitrepository/controler/GitFilteringController.java index 5c036a8..25f9ee7 100644 --- a/src/main/java/ru/ulstu/extractor/controller/GitFilteringController.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/controler/GitFilteringController.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.gitrepository.controler; import org.springframework.data.domain.Page; import org.springframework.stereotype.Controller; @@ -11,10 +11,10 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import ru.ulstu.extractor.core.OffsetablePageRequest; +import ru.ulstu.extractor.gitrepository.model.FilterForm; +import ru.ulstu.extractor.gitrepository.service.FilteringService; import ru.ulstu.extractor.model.Commit; -import ru.ulstu.extractor.model.OffsetablePageRequest; -import ru.ulstu.extractor.model.mvc.FilterForm; -import ru.ulstu.extractor.service.FilteringService; import springfox.documentation.annotations.ApiIgnore; import java.util.List; @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.IntStream; -import static ru.ulstu.extractor.controller.Route.FILTER_COMMITS; +import static ru.ulstu.extractor.core.Route.FILTER_COMMITS; @Controller @ApiIgnore diff --git a/src/main/java/ru/ulstu/extractor/controller/GitIndexingController.java b/src/main/java/ru/ulstu/extractor/gitrepository/controler/GitIndexingController.java similarity index 87% rename from src/main/java/ru/ulstu/extractor/controller/GitIndexingController.java rename to src/main/java/ru/ulstu/extractor/gitrepository/controler/GitIndexingController.java index 7708a1f..e610db7 100644 --- a/src/main/java/ru/ulstu/extractor/controller/GitIndexingController.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/controler/GitIndexingController.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.gitrepository.controler; import org.eclipse.jgit.api.errors.GitAPIException; import org.slf4j.Logger; @@ -16,17 +16,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import ru.ulstu.extractor.branch.model.Branch; -import ru.ulstu.extractor.gitrepository.GitRepositoryService; -import ru.ulstu.extractor.model.mvc.FilterForm; -import ru.ulstu.extractor.model.mvc.RepoForm; -import ru.ulstu.extractor.service.IndexService; +import ru.ulstu.extractor.gitrepository.model.FilterForm; +import ru.ulstu.extractor.gitrepository.model.RepoForm; +import ru.ulstu.extractor.gitrepository.service.GitRepositoryService; +import ru.ulstu.extractor.gitrepository.service.IndexService; import springfox.documentation.annotations.ApiIgnore; import java.io.IOException; import java.util.List; -import static ru.ulstu.extractor.controller.Route.FILTER_COMMITS; -import static ru.ulstu.extractor.controller.Route.INDEXING_NEW_REPOSITORY; +import static ru.ulstu.extractor.core.Route.FILTER_COMMITS; +import static ru.ulstu.extractor.core.Route.INDEXING_NEW_REPOSITORY; @Controller @ApiIgnore diff --git a/src/main/java/ru/ulstu/extractor/controller/RepoController.java b/src/main/java/ru/ulstu/extractor/gitrepository/controler/RepoController.java similarity index 89% rename from src/main/java/ru/ulstu/extractor/controller/RepoController.java rename to src/main/java/ru/ulstu/extractor/gitrepository/controler/RepoController.java index 847003d..bc14f79 100644 --- a/src/main/java/ru/ulstu/extractor/controller/RepoController.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/controler/RepoController.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.gitrepository.controler; import org.eclipse.jgit.api.errors.GitAPIException; import org.slf4j.Logger; @@ -12,16 +12,16 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import ru.ulstu.extractor.gitrepository.GitRepositoryService; +import ru.ulstu.extractor.gitrepository.service.GitRepositoryService; +import ru.ulstu.extractor.gitrepository.service.IndexService; import ru.ulstu.extractor.model.Commit; -import ru.ulstu.extractor.service.IndexService; import ru.ulstu.extractor.util.HttpUtils; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.List; -import static ru.ulstu.extractor.controller.RepoController.URL; +import static ru.ulstu.extractor.gitrepository.controler.RepoController.URL; @RestController @RequestMapping(URL) diff --git a/src/main/java/ru/ulstu/extractor/controller/RepositoryController.java b/src/main/java/ru/ulstu/extractor/gitrepository/controler/RepositoryController.java similarity index 82% rename from src/main/java/ru/ulstu/extractor/controller/RepositoryController.java rename to src/main/java/ru/ulstu/extractor/gitrepository/controler/RepositoryController.java index ee5de82..69b643b 100644 --- a/src/main/java/ru/ulstu/extractor/controller/RepositoryController.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/controler/RepositoryController.java @@ -3,17 +3,17 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.gitrepository.controler; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; -import ru.ulstu.extractor.gitrepository.GitRepositoryRepository; +import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository; import springfox.documentation.annotations.ApiIgnore; -import static ru.ulstu.extractor.controller.Route.DELETE_INDEXED_REPOSITORY; -import static ru.ulstu.extractor.controller.Route.LIST_INDEXED_REPOSITORIES; +import static ru.ulstu.extractor.core.Route.DELETE_INDEXED_REPOSITORY; +import static ru.ulstu.extractor.core.Route.LIST_INDEXED_REPOSITORIES; @Controller @ApiIgnore diff --git a/src/main/java/ru/ulstu/extractor/controller/StatisticController.java b/src/main/java/ru/ulstu/extractor/gitrepository/controler/StatisticController.java similarity index 96% rename from src/main/java/ru/ulstu/extractor/controller/StatisticController.java rename to src/main/java/ru/ulstu/extractor/gitrepository/controler/StatisticController.java index 771a5a0..eb2024e 100644 --- a/src/main/java/ru/ulstu/extractor/controller/StatisticController.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/controler/StatisticController.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.gitrepository.controler; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -11,15 +11,15 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import ru.ulstu.extractor.branch.service.BranchService; import ru.ulstu.extractor.commit.repository.CommitRepository; -import ru.ulstu.extractor.model.mvc.FilterForm; -import ru.ulstu.extractor.service.FilteringService; +import ru.ulstu.extractor.gitrepository.model.FilterForm; +import ru.ulstu.extractor.gitrepository.service.FilteringService; import springfox.documentation.annotations.ApiIgnore; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import static ru.ulstu.extractor.controller.Route.STATISTIC; +import static ru.ulstu.extractor.core.Route.STATISTIC; @Controller @ApiIgnore diff --git a/src/main/java/ru/ulstu/extractor/model/FileChange.java b/src/main/java/ru/ulstu/extractor/gitrepository/model/FileChange.java similarity index 96% rename from src/main/java/ru/ulstu/extractor/model/FileChange.java rename to src/main/java/ru/ulstu/extractor/gitrepository/model/FileChange.java index 5f33725..65d0815 100644 --- a/src/main/java/ru/ulstu/extractor/model/FileChange.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/model/FileChange.java @@ -3,10 +3,11 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.gitrepository.model; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.CascadeType; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/model/mvc/FilterForm.java b/src/main/java/ru/ulstu/extractor/gitrepository/model/FilterForm.java similarity index 97% rename from src/main/java/ru/ulstu/extractor/model/mvc/FilterForm.java rename to src/main/java/ru/ulstu/extractor/gitrepository/model/FilterForm.java index 1db7616..d25271f 100644 --- a/src/main/java/ru/ulstu/extractor/model/mvc/FilterForm.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/model/FilterForm.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.model.mvc; +package ru.ulstu.extractor.gitrepository.model; import org.springframework.data.domain.Page; import ru.ulstu.extractor.model.Commit; diff --git a/src/main/java/ru/ulstu/extractor/gitrepository/model/GitRepository.java b/src/main/java/ru/ulstu/extractor/gitrepository/model/GitRepository.java index 3d5c605..f2b8276 100644 --- a/src/main/java/ru/ulstu/extractor/gitrepository/model/GitRepository.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/model/GitRepository.java @@ -1,6 +1,6 @@ package ru.ulstu.extractor.gitrepository.model; -import ru.ulstu.extractor.model.BaseEntity; +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/model/LineChange.java b/src/main/java/ru/ulstu/extractor/gitrepository/model/LineChange.java similarity index 93% rename from src/main/java/ru/ulstu/extractor/model/LineChange.java rename to src/main/java/ru/ulstu/extractor/gitrepository/model/LineChange.java index 923909b..99d78b3 100644 --- a/src/main/java/ru/ulstu/extractor/model/LineChange.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/model/LineChange.java @@ -3,7 +3,9 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.gitrepository.model; + +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/model/mvc/RepoForm.java b/src/main/java/ru/ulstu/extractor/gitrepository/model/RepoForm.java similarity index 91% rename from src/main/java/ru/ulstu/extractor/model/mvc/RepoForm.java rename to src/main/java/ru/ulstu/extractor/gitrepository/model/RepoForm.java index e0ca0aa..0540820 100644 --- a/src/main/java/ru/ulstu/extractor/model/mvc/RepoForm.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/model/RepoForm.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.model.mvc; +package ru.ulstu.extractor.gitrepository.model; public class RepoForm { private String repo; diff --git a/src/main/java/ru/ulstu/extractor/gitrepository/GitRepositoryRepository.java b/src/main/java/ru/ulstu/extractor/gitrepository/repository/GitRepositoryRepository.java similarity index 82% rename from src/main/java/ru/ulstu/extractor/gitrepository/GitRepositoryRepository.java rename to src/main/java/ru/ulstu/extractor/gitrepository/repository/GitRepositoryRepository.java index ae9e821..40307d7 100644 --- a/src/main/java/ru/ulstu/extractor/gitrepository/GitRepositoryRepository.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/repository/GitRepositoryRepository.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.gitrepository; +package ru.ulstu.extractor.gitrepository.repository; import org.springframework.data.jpa.repository.JpaRepository; import ru.ulstu.extractor.gitrepository.model.GitRepository; diff --git a/src/main/java/ru/ulstu/extractor/service/FilteringService.java b/src/main/java/ru/ulstu/extractor/gitrepository/service/FilteringService.java similarity index 92% rename from src/main/java/ru/ulstu/extractor/service/FilteringService.java rename to src/main/java/ru/ulstu/extractor/gitrepository/service/FilteringService.java index ddeda0c..ccc29de 100644 --- a/src/main/java/ru/ulstu/extractor/service/FilteringService.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/service/FilteringService.java @@ -3,16 +3,16 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.service; +package ru.ulstu.extractor.gitrepository.service; import com.sun.istack.NotNull; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import ru.ulstu.extractor.author.repository.AuthorRepository; import ru.ulstu.extractor.commit.repository.CommitRepository; -import ru.ulstu.extractor.gitrepository.GitRepositoryRepository; +import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository; import ru.ulstu.extractor.model.Commit; -import ru.ulstu.extractor.repository.AuthorRepository; import java.util.List; import java.util.Map; diff --git a/src/main/java/ru/ulstu/extractor/gitrepository/GitRepositoryService.java b/src/main/java/ru/ulstu/extractor/gitrepository/service/GitRepositoryService.java similarity index 98% rename from src/main/java/ru/ulstu/extractor/gitrepository/GitRepositoryService.java rename to src/main/java/ru/ulstu/extractor/gitrepository/service/GitRepositoryService.java index 934f920..78038ad 100644 --- a/src/main/java/ru/ulstu/extractor/gitrepository/GitRepositoryService.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/service/GitRepositoryService.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.gitrepository; +package ru.ulstu.extractor.gitrepository.service; import org.apache.commons.io.FileUtils; import org.eclipse.jgit.api.CreateBranchCommand; @@ -18,16 +18,17 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import ru.ulstu.extractor.author.model.Author; import ru.ulstu.extractor.branch.model.Branch; +import ru.ulstu.extractor.gitrepository.model.FileChange; import ru.ulstu.extractor.gitrepository.model.GitRepository; +import ru.ulstu.extractor.gitrepository.model.LineChange; +import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository; import ru.ulstu.extractor.heuristic.model.BusinessLogicUnit; import ru.ulstu.extractor.heuristic.model.EntityUnit; import ru.ulstu.extractor.heuristic.model.ResourceUnit; import ru.ulstu.extractor.heuristic.service.StructuralUnitService; -import ru.ulstu.extractor.model.Author; import ru.ulstu.extractor.model.Commit; -import ru.ulstu.extractor.model.FileChange; -import ru.ulstu.extractor.model.LineChange; import java.io.ByteArrayOutputStream; import java.io.File; diff --git a/src/main/java/ru/ulstu/extractor/service/IndexService.java b/src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java similarity index 93% rename from src/main/java/ru/ulstu/extractor/service/IndexService.java rename to src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java index d5415e2..5d2c1c2 100644 --- a/src/main/java/ru/ulstu/extractor/service/IndexService.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.service; +package ru.ulstu.extractor.gitrepository.service; import com.sun.istack.NotNull; import org.eclipse.jgit.api.errors.GitAPIException; @@ -12,11 +12,10 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import ru.ulstu.extractor.branch.model.Branch; import ru.ulstu.extractor.branch.service.BranchService; -import ru.ulstu.extractor.gitrepository.GitRepositoryRepository; -import ru.ulstu.extractor.gitrepository.GitRepositoryService; import ru.ulstu.extractor.gitrepository.model.GitRepository; +import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository; import ru.ulstu.extractor.model.Commit; -import ru.ulstu.extractor.ts.AbstractTimeSeriesCreator; +import ru.ulstu.extractor.ts.creator.AbstractTimeSeriesCreator; import java.io.IOException; import java.util.Collections; diff --git a/src/main/java/ru/ulstu/extractor/heuristic/controller/StructuralUnitController.java b/src/main/java/ru/ulstu/extractor/heuristic/controller/StructuralUnitController.java index ccedc05..db95ab2 100644 --- a/src/main/java/ru/ulstu/extractor/heuristic/controller/StructuralUnitController.java +++ b/src/main/java/ru/ulstu/extractor/heuristic/controller/StructuralUnitController.java @@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import ru.ulstu.extractor.gitrepository.GitRepositoryService; +import ru.ulstu.extractor.gitrepository.service.GitRepositoryService; import ru.ulstu.extractor.heuristic.model.BusinessLogicUnit; import ru.ulstu.extractor.heuristic.model.EntityUnit; import ru.ulstu.extractor.heuristic.model.ResourceUnit; diff --git a/src/main/java/ru/ulstu/extractor/http/JsonTimeSeries.java b/src/main/java/ru/ulstu/extractor/http/JsonTimeSeries.java index 71506d1..957869c 100644 --- a/src/main/java/ru/ulstu/extractor/http/JsonTimeSeries.java +++ b/src/main/java/ru/ulstu/extractor/http/JsonTimeSeries.java @@ -1,6 +1,6 @@ package ru.ulstu.extractor.http; -import ru.ulstu.extractor.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeries; import java.util.List; import java.util.stream.Collectors; diff --git a/src/main/java/ru/ulstu/extractor/http/JsonTimeSeriesValue.java b/src/main/java/ru/ulstu/extractor/http/JsonTimeSeriesValue.java index f615f7d..a50681c 100644 --- a/src/main/java/ru/ulstu/extractor/http/JsonTimeSeriesValue.java +++ b/src/main/java/ru/ulstu/extractor/http/JsonTimeSeriesValue.java @@ -1,6 +1,6 @@ package ru.ulstu.extractor.http; -import ru.ulstu.extractor.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; import java.time.LocalDateTime; import java.time.ZoneId; diff --git a/src/main/java/ru/ulstu/extractor/controller/RuleController.java b/src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java similarity index 82% rename from src/main/java/ru/ulstu/extractor/controller/RuleController.java rename to src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java index 038005b..6369e5f 100644 --- a/src/main/java/ru/ulstu/extractor/controller/RuleController.java +++ b/src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.controller; +package ru.ulstu.extractor.rule.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -7,14 +7,14 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import ru.ulstu.extractor.model.mvc.AddRuleForm; -import ru.ulstu.extractor.service.AntecedentValueService; -import ru.ulstu.extractor.service.RuleService; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.rule.model.AddRuleForm; +import ru.ulstu.extractor.rule.service.AntecedentValueService; +import ru.ulstu.extractor.rule.service.RuleService; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import springfox.documentation.annotations.ApiIgnore; -import static ru.ulstu.extractor.controller.Route.ADD_RULE; -import static ru.ulstu.extractor.controller.Route.LIST_RULE; +import static ru.ulstu.extractor.core.Route.ADD_RULE; +import static ru.ulstu.extractor.core.Route.LIST_RULE; @Controller @ApiIgnore diff --git a/src/main/java/ru/ulstu/extractor/model/mvc/AddRuleForm.java b/src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java similarity index 97% rename from src/main/java/ru/ulstu/extractor/model/mvc/AddRuleForm.java rename to src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java index cf164d8..1fd344e 100644 --- a/src/main/java/ru/ulstu/extractor/model/mvc/AddRuleForm.java +++ b/src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java @@ -1,4 +1,4 @@ -package ru.ulstu.extractor.model.mvc; +package ru.ulstu.extractor.rule.model; public class AddRuleForm { private Integer firstAntecedentValueId; diff --git a/src/main/java/ru/ulstu/extractor/model/AntecedentValue.java b/src/main/java/ru/ulstu/extractor/rule/model/AntecedentValue.java similarity index 85% rename from src/main/java/ru/ulstu/extractor/model/AntecedentValue.java rename to src/main/java/ru/ulstu/extractor/rule/model/AntecedentValue.java index 1ed3473..39b5eb6 100644 --- a/src/main/java/ru/ulstu/extractor/model/AntecedentValue.java +++ b/src/main/java/ru/ulstu/extractor/rule/model/AntecedentValue.java @@ -1,4 +1,6 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.rule.model; + +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/model/Rule.java b/src/main/java/ru/ulstu/extractor/rule/model/Rule.java similarity index 95% rename from src/main/java/ru/ulstu/extractor/model/Rule.java rename to src/main/java/ru/ulstu/extractor/rule/model/Rule.java index baf8565..e9efa92 100644 --- a/src/main/java/ru/ulstu/extractor/model/Rule.java +++ b/src/main/java/ru/ulstu/extractor/rule/model/Rule.java @@ -1,4 +1,7 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.rule.model; + +import ru.ulstu.extractor.core.BaseEntity; +import ru.ulstu.extractor.ts.model.TimeSeries; import javax.persistence.Entity; import javax.persistence.ManyToOne; diff --git a/src/main/java/ru/ulstu/extractor/repository/AntecedentValueRepository.java b/src/main/java/ru/ulstu/extractor/rule/repository/AntecedentValueRepository.java similarity index 62% rename from src/main/java/ru/ulstu/extractor/repository/AntecedentValueRepository.java rename to src/main/java/ru/ulstu/extractor/rule/repository/AntecedentValueRepository.java index 86ea561..1ea84d7 100644 --- a/src/main/java/ru/ulstu/extractor/repository/AntecedentValueRepository.java +++ b/src/main/java/ru/ulstu/extractor/rule/repository/AntecedentValueRepository.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.repository; +package ru.ulstu.extractor.rule.repository; import org.springframework.data.jpa.repository.JpaRepository; -import ru.ulstu.extractor.model.AntecedentValue; +import ru.ulstu.extractor.rule.model.AntecedentValue; public interface AntecedentValueRepository extends JpaRepository { } diff --git a/src/main/java/ru/ulstu/extractor/repository/RuleRepository.java b/src/main/java/ru/ulstu/extractor/rule/repository/RuleRepository.java similarity index 61% rename from src/main/java/ru/ulstu/extractor/repository/RuleRepository.java rename to src/main/java/ru/ulstu/extractor/rule/repository/RuleRepository.java index e931488..2504386 100644 --- a/src/main/java/ru/ulstu/extractor/repository/RuleRepository.java +++ b/src/main/java/ru/ulstu/extractor/rule/repository/RuleRepository.java @@ -1,7 +1,7 @@ -package ru.ulstu.extractor.repository; +package ru.ulstu.extractor.rule.repository; import org.springframework.data.jpa.repository.JpaRepository; -import ru.ulstu.extractor.model.Rule; +import ru.ulstu.extractor.rule.model.Rule; public interface RuleRepository extends JpaRepository { } diff --git a/src/main/java/ru/ulstu/extractor/service/AntecedentValueService.java b/src/main/java/ru/ulstu/extractor/rule/service/AntecedentValueService.java similarity index 81% rename from src/main/java/ru/ulstu/extractor/service/AntecedentValueService.java rename to src/main/java/ru/ulstu/extractor/rule/service/AntecedentValueService.java index e2c48e6..ef3c124 100644 --- a/src/main/java/ru/ulstu/extractor/service/AntecedentValueService.java +++ b/src/main/java/ru/ulstu/extractor/rule/service/AntecedentValueService.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.service; +package ru.ulstu.extractor.rule.service; import org.springframework.stereotype.Service; -import ru.ulstu.extractor.model.AntecedentValue; -import ru.ulstu.extractor.repository.AntecedentValueRepository; +import ru.ulstu.extractor.rule.model.AntecedentValue; +import ru.ulstu.extractor.rule.repository.AntecedentValueRepository; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/service/RuleService.java b/src/main/java/ru/ulstu/extractor/rule/service/RuleService.java similarity index 82% rename from src/main/java/ru/ulstu/extractor/service/RuleService.java rename to src/main/java/ru/ulstu/extractor/rule/service/RuleService.java index 5c8acd7..46a95a6 100644 --- a/src/main/java/ru/ulstu/extractor/service/RuleService.java +++ b/src/main/java/ru/ulstu/extractor/rule/service/RuleService.java @@ -1,9 +1,10 @@ -package ru.ulstu.extractor.service; +package ru.ulstu.extractor.rule.service; import org.springframework.stereotype.Service; -import ru.ulstu.extractor.model.Rule; -import ru.ulstu.extractor.model.mvc.AddRuleForm; -import ru.ulstu.extractor.repository.RuleRepository; +import ru.ulstu.extractor.rule.model.AddRuleForm; +import ru.ulstu.extractor.rule.model.Rule; +import ru.ulstu.extractor.rule.repository.RuleRepository; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java b/src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java similarity index 87% rename from src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java rename to src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java index 07b516b..ce4593d 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java @@ -1,13 +1,13 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.Comparator; import java.util.List; import java.util.Map; -import static ru.ulstu.extractor.ts.TimeSeriesDateMapper.mapTimeSeriesToInterval; +import static ru.ulstu.extractor.ts.util.TimeSeriesDateMapper.mapTimeSeriesToInterval; public abstract class AbstractTimeSeriesCreator { diff --git a/src/main/java/ru/ulstu/extractor/ts/AuthorTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/AuthorTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java index a6d01dc..63e4b3b 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/AuthorsCommentTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java similarity index 84% rename from src/main/java/ru/ulstu/extractor/ts/AuthorsCommentTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java index 62ea9a7..bb1ebef 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorsCommentTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/AuthorsCompletedIssueTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java similarity index 84% rename from src/main/java/ru/ulstu/extractor/ts/AuthorsCompletedIssueTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java index 7453fdb..5112c0b 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorsCompletedIssueTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/AuthorsIssueTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java similarity index 84% rename from src/main/java/ru/ulstu/extractor/ts/AuthorsIssueTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java index d7318da..209ee59 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorsIssueTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/BranchTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/BranchTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java index 6233909..95c237d 100644 --- a/src/main/java/ru/ulstu/extractor/ts/BranchTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/ClassTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/ClassTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java index 1fdf504..c6bb4a1 100644 --- a/src/main/java/ru/ulstu/extractor/ts/ClassTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/CommitsTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java similarity index 88% rename from src/main/java/ru/ulstu/extractor/ts/CommitsTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java index 2196c20..cbd444f 100644 --- a/src/main/java/ru/ulstu/extractor/ts/CommitsTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java @@ -1,10 +1,10 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; import ru.ulstu.extractor.commit.service.CommitService; -import ru.ulstu.extractor.gitrepository.GitRepositoryService; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.gitrepository.service.GitRepositoryService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/DependenceTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/DependenceTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java index 26c0e39..dd511fb 100644 --- a/src/main/java/ru/ulstu/extractor/ts/DependenceTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/EntityTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/EntityTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java index ff6a2d9..183a12e 100644 --- a/src/main/java/ru/ulstu/extractor/ts/EntityTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/FileTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/FileTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java index e90ce57..cb2279b 100644 --- a/src/main/java/ru/ulstu/extractor/ts/FileTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/InterfaceTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/InterfaceTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java index 7d26f00..55d4341 100644 --- a/src/main/java/ru/ulstu/extractor/ts/InterfaceTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/IssuesTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java similarity index 84% rename from src/main/java/ru/ulstu/extractor/ts/IssuesTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java index 51ecffd..23a40d5 100644 --- a/src/main/java/ru/ulstu/extractor/ts/IssuesTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/ProcessTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/ProcessTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java index bc4b322..0a7c05f 100644 --- a/src/main/java/ru/ulstu/extractor/ts/ProcessTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/ts/StarTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java similarity index 83% rename from src/main/java/ru/ulstu/extractor/ts/StarTS.java rename to src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java index 38455a3..ddab245 100644 --- a/src/main/java/ru/ulstu/extractor/ts/StarTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.service.TimeSeriesService; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/model/TimeSeries.java b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java similarity index 93% rename from src/main/java/ru/ulstu/extractor/model/TimeSeries.java rename to src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java index d04db07..8be74b1 100644 --- a/src/main/java/ru/ulstu/extractor/model/TimeSeries.java +++ b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java @@ -1,7 +1,8 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.ts.model; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.CascadeType; import javax.persistence.Entity; diff --git a/src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesValue.java similarity index 89% rename from src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java rename to src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesValue.java index 06fc168..112b4c5 100644 --- a/src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java +++ b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesValue.java @@ -1,4 +1,6 @@ -package ru.ulstu.extractor.model; +package ru.ulstu.extractor.ts.model; + +import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.Entity; import java.util.Date; diff --git a/src/main/java/ru/ulstu/extractor/repository/TimeSeriesRepository.java b/src/main/java/ru/ulstu/extractor/ts/repository/TimeSeriesRepository.java similarity index 71% rename from src/main/java/ru/ulstu/extractor/repository/TimeSeriesRepository.java rename to src/main/java/ru/ulstu/extractor/ts/repository/TimeSeriesRepository.java index e324774..fbb123e 100644 --- a/src/main/java/ru/ulstu/extractor/repository/TimeSeriesRepository.java +++ b/src/main/java/ru/ulstu/extractor/ts/repository/TimeSeriesRepository.java @@ -1,7 +1,7 @@ -package ru.ulstu.extractor.repository; +package ru.ulstu.extractor.ts.repository; import org.springframework.data.jpa.repository.JpaRepository; -import ru.ulstu.extractor.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeries; import java.util.Optional; diff --git a/src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java b/src/main/java/ru/ulstu/extractor/ts/repository/TimeSeriesValueRepository.java similarity index 80% rename from src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java rename to src/main/java/ru/ulstu/extractor/ts/repository/TimeSeriesValueRepository.java index b603ed5..e334bf2 100644 --- a/src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java +++ b/src/main/java/ru/ulstu/extractor/ts/repository/TimeSeriesValueRepository.java @@ -1,7 +1,7 @@ -package ru.ulstu.extractor.repository; +package ru.ulstu.extractor.ts.repository; import org.springframework.data.jpa.repository.JpaRepository; -import ru.ulstu.extractor.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; import java.util.List; diff --git a/src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java similarity index 91% rename from src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java rename to src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java index f978433..f587ea2 100644 --- a/src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java +++ b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java @@ -3,7 +3,7 @@ * You may use, distribute and modify this code, please write to: romanov73@gmail.com. */ -package ru.ulstu.extractor.service; +package ru.ulstu.extractor.ts.service; import org.json.JSONObject; import org.slf4j.Logger; @@ -11,14 +11,18 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import ru.ulstu.extractor.http.HttpService; import ru.ulstu.extractor.http.JsonTimeSeries; -import ru.ulstu.extractor.model.TimeSeries; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.repository.TimeSeriesRepository; -import ru.ulstu.extractor.repository.TimeSeriesValueRepository; -import ru.ulstu.extractor.ts.TimeSeriesDateMapper; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.repository.TimeSeriesRepository; +import ru.ulstu.extractor.ts.repository.TimeSeriesValueRepository; +import ru.ulstu.extractor.ts.util.TimeSeriesDateMapper; import javax.transaction.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; @Service diff --git a/src/main/java/ru/ulstu/extractor/ts/TimeSeriesDateMapper.java b/src/main/java/ru/ulstu/extractor/ts/util/TimeSeriesDateMapper.java similarity index 94% rename from src/main/java/ru/ulstu/extractor/ts/TimeSeriesDateMapper.java rename to src/main/java/ru/ulstu/extractor/ts/util/TimeSeriesDateMapper.java index dec6918..7a17646 100644 --- a/src/main/java/ru/ulstu/extractor/ts/TimeSeriesDateMapper.java +++ b/src/main/java/ru/ulstu/extractor/ts/util/TimeSeriesDateMapper.java @@ -1,8 +1,8 @@ -package ru.ulstu.extractor.ts; +package ru.ulstu.extractor.ts.util; import org.apache.commons.lang3.time.DateUtils; -import ru.ulstu.extractor.model.TimeSeries; -import ru.ulstu.extractor.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; import java.util.Calendar; import java.util.Date; diff --git a/src/test/java/ru/ulstu/TimeSeriesMapperTest.java b/src/test/java/ru/ulstu/TimeSeriesMapperTest.java index 91030f9..c1cae8d 100644 --- a/src/test/java/ru/ulstu/TimeSeriesMapperTest.java +++ b/src/test/java/ru/ulstu/TimeSeriesMapperTest.java @@ -2,9 +2,9 @@ package ru.ulstu; import org.junit.Assert; import org.junit.Test; -import ru.ulstu.extractor.model.TimeSeries; -import ru.ulstu.extractor.model.TimeSeriesValue; -import ru.ulstu.extractor.ts.TimeSeriesDateMapper; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.util.TimeSeriesDateMapper; import java.util.Arrays; import java.util.Calendar; From bfec08c1f4556943f2e764b6c6401946e85fbafc Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 15 Oct 2022 23:37:22 +0400 Subject: [PATCH 2/3] #72 -- add time series type --- .../ts/creator/AbstractTimeSeriesCreator.java | 23 ++++---- .../ulstu/extractor/ts/creator/AuthorTS.java | 14 ++--- .../ts/creator/AuthorsCommentTS.java | 33 ------------ .../extractor/ts/creator/AuthorsCommitTS.java | 33 ++++++++++++ .../ts/creator/AuthorsCompletedIssueTS.java | 20 +++---- .../extractor/ts/creator/AuthorsIssueTS.java | 20 +++---- .../ulstu/extractor/ts/creator/BranchTS.java | 14 ++--- .../ulstu/extractor/ts/creator/ClassTS.java | 20 +++---- .../ulstu/extractor/ts/creator/CommitsTS.java | 37 +++++++------ .../extractor/ts/creator/DependenceTS.java | 20 +++---- .../ulstu/extractor/ts/creator/EntityTS.java | 20 +++---- .../ru/ulstu/extractor/ts/creator/FileTS.java | 20 +++---- .../extractor/ts/creator/InterfaceTS.java | 20 +++---- .../ulstu/extractor/ts/creator/IssuesTS.java | 20 +++---- .../ulstu/extractor/ts/creator/ProcessTS.java | 20 +++---- .../ru/ulstu/extractor/ts/creator/StarTS.java | 20 +++---- .../ulstu/extractor/ts/model/TimeSeries.java | 18 +++++++ .../extractor/ts/model/TimeSeriesType.java | 28 ++++++++++ .../ts/service/TimeSeriesService.java | 52 ++++++------------- .../db/changelog-20221012_170000-schema.xml | 5 ++ 20 files changed, 246 insertions(+), 211 deletions(-) delete mode 100644 src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java create mode 100644 src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommitTS.java create mode 100644 src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesType.java diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java b/src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java index ce4593d..0f470f5 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AbstractTimeSeriesCreator.java @@ -1,17 +1,18 @@ package ru.ulstu.extractor.ts.creator; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesValue; import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.Comparator; import java.util.List; -import java.util.Map; import static ru.ulstu.extractor.ts.util.TimeSeriesDateMapper.mapTimeSeriesToInterval; public abstract class AbstractTimeSeriesCreator { - public abstract String getTimeSeriesName(); + public abstract TimeSeriesType getTimeSeriesType(); /** * Извлечь список точек временных рядов @@ -20,7 +21,7 @@ public abstract class AbstractTimeSeriesCreator { * @param branchName * @return */ - public abstract Map> getTimeSeriesValues(Integer repositoryId, String branchName); + public abstract List getTimeSeries(Integer repositoryId, String branchName); public abstract TimeSeriesService getTimeSeriesService(); @@ -31,18 +32,18 @@ public abstract class AbstractTimeSeriesCreator { * @param branchName */ public void addTimeSeries(Integer repositoryId, String branchName) { - // извлеченные точки временных рядов - Map> timeSeriesValues = getTimeSeriesValues(repositoryId, branchName); + // извлеченные временных рядов + List timeSeries = getTimeSeries(repositoryId, branchName); // сгруппированные по временным интервалам точки временных рядов - timeSeriesValues.replaceAll((k, v) -> mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), v)); - getTimeSeriesService().save(sortTimeSeriesValues(timeSeriesValues)); + timeSeries.forEach(ts -> ts.setValues(mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), ts.getValues()))); + getTimeSeriesService().save(sortTimeSeries(timeSeries)); } - private Map> sortTimeSeriesValues(Map> timeSeriesValues) { - for (Map.Entry> entry : timeSeriesValues.entrySet()) { - entry.getValue().sort(Comparator.comparing(TimeSeriesValue::getDate)); + private List sortTimeSeries(List timeSeries) { + for (TimeSeries ts : timeSeries) { + ts.getValues().sort(Comparator.comparing(TimeSeriesValue::getDate)); } - return timeSeriesValues; + return timeSeries; } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java index 63e4b3b..ae71399 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class AuthorTS extends AbstractTimeSeriesCreator { @@ -17,13 +17,13 @@ public class AuthorTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество Авторов"; + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.AUTHORS; } @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList<>(); } @Override diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java deleted file mode 100644 index bb1ebef..0000000 --- a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommentTS.java +++ /dev/null @@ -1,33 +0,0 @@ -package ru.ulstu.extractor.ts.creator; - -import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; -import ru.ulstu.extractor.ts.service.TimeSeriesService; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Component -public class AuthorsCommentTS extends AbstractTimeSeriesCreator { - private final TimeSeriesService timeSeriesService; - - public AuthorsCommentTS(TimeSeriesService timeSeriesService) { - this.timeSeriesService = timeSeriesService; - } - - @Override - public String getTimeSeriesName() { - return "Количество коммитов авторов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); - } - - @Override - public TimeSeriesService getTimeSeriesService() { - return timeSeriesService; - } -} diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommitTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommitTS.java new file mode 100644 index 0000000..4be4592 --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCommitTS.java @@ -0,0 +1,33 @@ +package ru.ulstu.extractor.ts.creator; + +import org.springframework.stereotype.Component; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; +import ru.ulstu.extractor.ts.service.TimeSeriesService; + +import java.util.ArrayList; +import java.util.List; + +@Component +public class AuthorsCommitTS extends AbstractTimeSeriesCreator { + private final TimeSeriesService timeSeriesService; + + public AuthorsCommitTS(TimeSeriesService timeSeriesService) { + this.timeSeriesService = timeSeriesService; + } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.AUTHOR_COMMITS; + } + + @Override + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); + } + + @Override + public TimeSeriesService getTimeSeriesService() { + return timeSeriesService; + } +} diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java index 5112c0b..1fa3ebb 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsCompletedIssueTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество выполненных issues авторов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList<>(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.AUTHOR_COMPLETED_ISSUES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java index 209ee59..4ba5df2 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/AuthorsIssueTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class AuthorsIssueTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class AuthorsIssueTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество issues авторов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.AUTHOR_ISSUES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java index 95c237d..aa6592e 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/BranchTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class BranchTS extends AbstractTimeSeriesCreator { @@ -17,13 +17,13 @@ public class BranchTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество веток"; + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.BRANCHES; } @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList<>(); } @Override diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java index c6bb4a1..2e7e8ea 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/ClassTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class ClassTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class ClassTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество классов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.CLASSES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java index cbd444f..c686a90 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/CommitsTS.java @@ -3,12 +3,13 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; import ru.ulstu.extractor.commit.service.CommitService; import ru.ulstu.extractor.gitrepository.service.GitRepositoryService; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesValue; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; @Component @@ -26,26 +27,28 @@ public class CommitsTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество коммитов во времени"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { + public List getTimeSeries(Integer repositoryId, String branchName) { //TODO: добавить постраничное чтение - Map> result = new HashMap<>(); - result.put(String.format("%s %s %s", gitRepositoryService.findById(repositoryId).getName(), - branchName, - getTimeSeriesName()), - commitService.findByRepositoryIdAndName(repositoryId, branchName) - .stream() - .map(c -> new TimeSeriesValue(c.getDate(), 1.0)) - .collect(Collectors.toList())); - return result; + return Collections.singletonList( + new TimeSeries( + String.format("%s %s %s", + gitRepositoryService.findById(repositoryId).getName(), + branchName, + getTimeSeriesType().getDescription()), + getTimeSeriesType(), + commitService.findByRepositoryIdAndName(repositoryId, branchName) + .stream() + .map(c -> new TimeSeriesValue(c.getDate(), 1.0)) + .collect(Collectors.toList()))); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.COMMITS; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java index dd511fb..e534627 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/DependenceTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class DependenceTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class DependenceTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество зависимостей"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.DEPENDENCIES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java index 183a12e..c635556 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/EntityTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class EntityTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class EntityTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество сущностей"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.ENTITIES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java index cb2279b..5797212 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/FileTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class FileTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class FileTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество файлов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.FILES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java index 55d4341..8821f8c 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/InterfaceTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class InterfaceTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class InterfaceTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество интерфейсов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.INTERFACES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java index 23a40d5..eef0e20 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/IssuesTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class IssuesTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class IssuesTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество issues созданных во времени"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList<>(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.ISSUES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java index 0a7c05f..f375b66 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/ProcessTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class ProcessTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class ProcessTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество процессов"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList<>(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.PROCESSES; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java b/src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java index ddab245..557e9be 100644 --- a/src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/creator/StarTS.java @@ -1,12 +1,12 @@ package ru.ulstu.extractor.ts.creator; import org.springframework.stereotype.Component; -import ru.ulstu.extractor.ts.model.TimeSeriesValue; +import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; @Component public class StarTS extends AbstractTimeSeriesCreator { @@ -17,17 +17,17 @@ public class StarTS extends AbstractTimeSeriesCreator { } @Override - public String getTimeSeriesName() { - return "Количество звезд"; - } - - @Override - public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { - return new HashMap<>(); + public List getTimeSeries(Integer repositoryId, String branchName) { + return new ArrayList<>(); } @Override public TimeSeriesService getTimeSeriesService() { return timeSeriesService; } + + @Override + public TimeSeriesType getTimeSeriesType() { + return TimeSeriesType.STARS; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java index 8be74b1..b6d6931 100644 --- a/src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java +++ b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeries.java @@ -6,6 +6,8 @@ import ru.ulstu.extractor.core.BaseEntity; import javax.persistence.CascadeType; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; @@ -20,6 +22,9 @@ public class TimeSeries extends BaseEntity { @Fetch(FetchMode.SUBSELECT) private List values = new ArrayList<>(); + @Enumerated(EnumType.STRING) + private TimeSeriesType timeSeriesType; + public TimeSeries() { } @@ -32,6 +37,12 @@ public class TimeSeries extends BaseEntity { this.values = values; } + public TimeSeries(String name, TimeSeriesType timeSeriesType, List values) { + this.name = name; + this.values = values; + this.timeSeriesType = timeSeriesType; + } + public String getName() { return name; } @@ -48,4 +59,11 @@ public class TimeSeries extends BaseEntity { this.values = values; } + public TimeSeriesType getTimeSeriesType() { + return timeSeriesType; + } + + public void setTimeSeriesType(TimeSeriesType timeSeriesType) { + this.timeSeriesType = timeSeriesType; + } } diff --git a/src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesType.java b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesType.java new file mode 100644 index 0000000..636061e --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/ts/model/TimeSeriesType.java @@ -0,0 +1,28 @@ +package ru.ulstu.extractor.ts.model; + +public enum TimeSeriesType { + COMMITS("Временной ряд коммитов"), + AUTHOR_COMMITS("Временной ряд коммитов авторов"), + AUTHOR_ISSUES("Временной ряд задач авторов"), + AUTHOR_COMPLETED_ISSUES("Временной ряд завершенных задач авторов"), + AUTHORS("Временной ряд авторов"), + BRANCHES("Временной ряд веток"), + CLASSES("Временной ряд кклассов"), + DEPENDENCIES("Временной ряд зависимостей"), + ENTITIES("Временной ряд сущностей"), + FILES("Временной файлов"), + INTERFACES("Временной ряд интерфейсов"), + ISSUES("Временной ряд задач"), + PROCESSES("Временной ряд процессов"), + STARS("Временной ряд звезд"); + + private final String description; + + TimeSeriesType(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } +} diff --git a/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java index f587ea2..c7da83c 100644 --- a/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java +++ b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java @@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; import ru.ulstu.extractor.http.HttpService; import ru.ulstu.extractor.http.JsonTimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesValue; import ru.ulstu.extractor.ts.repository.TimeSeriesRepository; import ru.ulstu.extractor.ts.repository.TimeSeriesValueRepository; @@ -19,11 +20,8 @@ import ru.ulstu.extractor.ts.util.TimeSeriesDateMapper; import javax.transaction.Transactional; import java.util.ArrayList; -import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Optional; -import java.util.stream.Collectors; @Service public class TimeSeriesService { @@ -42,27 +40,13 @@ public class TimeSeriesService { this.httpService = httpService; } - /** - * Сохранить список временных рядов - * - * @param timeSeriesValues - * @return - */ @Transactional - public List save(Map> timeSeriesValues) { - List results = new ArrayList<>(); - for (Map.Entry> entry : timeSeriesValues.entrySet()) { - results.add(save(entry.getKey(), entry.getValue())); - } - return results; - } - - @Transactional - public TimeSeries save(String timeSeriesName, List timeSeriesValues) { + public TimeSeries save(String timeSeriesName, TimeSeriesType timeSeriesType, List timeSeriesValues) { LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size()); final TimeSeries timeSeries = findOrCreate(timeSeriesName); List timeSeriesValuesToRemove = timeSeries.getValues(); timeSeries.setValues(timeSeriesValues); + timeSeries.setTimeSeriesType(timeSeriesType); LOG.debug("Save time series {} ", timeSeries.getName()); TimeSeries savedTimeSeries = timeSeriesRepository.save(timeSeries); LOG.debug("Clear {} time series values ", timeSeriesValuesToRemove.size()); @@ -80,23 +64,19 @@ public class TimeSeriesService { return timeSeriesRepository.save(new TimeSeries(timeSeriesName)); } - public List save(List timeSeriesValues) { - return timeSeriesValues.stream() - .map(timeSeriesValue -> { - timeSeriesValue.setValue((timeSeriesValue.getValue())); - timeSeriesValue.setDate((timeSeriesValue.getDate())); - return timeSeriesValueRepository.save(timeSeriesValue); - }).collect(Collectors.toList()); - } - - public void addTimeSeriesValue(String timeSeriesName, Date date, Double value) { - LOG.debug("Start add time series values to {} time series values ", timeSeriesName); - TimeSeries timeSeries = findOrCreate(timeSeriesName); - timeSeriesValueRepository.save(new TimeSeriesValue(timeSeries, date, value)); - } - - public List findAll() { - return timeSeriesValueRepository.findAll(); + /** + * Сохранить список временных рядов + * + * @param timeSeries список ВР + * @return сохраненный список ВР + */ + @Transactional + public List save(List timeSeries) { + List results = new ArrayList<>(); + for (TimeSeries ts : timeSeries) { + results.add(save(ts.getName(), ts.getTimeSeriesType(), ts.getValues())); + } + return results; } public TimeSeriesDateMapper.TimeSeriesInterval getTimeSeriesInterval() { diff --git a/src/main/resources/db/changelog-20221012_170000-schema.xml b/src/main/resources/db/changelog-20221012_170000-schema.xml index 76ad715..61b2f4f 100644 --- a/src/main/resources/db/changelog-20221012_170000-schema.xml +++ b/src/main/resources/db/changelog-20221012_170000-schema.xml @@ -44,4 +44,9 @@ referencedTableName="time_series" referencedColumnNames="id"/> + + + + + \ No newline at end of file From 49598824db667b6807f0b17bfcce37c6e80f3549 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sun, 16 Oct 2022 01:15:26 +0400 Subject: [PATCH 3/3] #72 -- fix data model --- .../rule/controller/RuleController.java | 6 ++- .../extractor/rule/model/AddRuleForm.java | 12 ++--- .../ru/ulstu/extractor/rule/model/Rule.java | 39 ++++++---------- .../extractor/rule/service/RuleService.java | 5 ++- .../ts/service/TimeSeriesService.java | 5 +++ .../db/changelog-20221012_170000-schema.xml | 31 +++++++++++++ src/main/resources/templates/addRule.html | 45 ++++++++++--------- src/main/resources/templates/listRules.html | 4 +- 8 files changed, 88 insertions(+), 59 deletions(-) diff --git a/src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java b/src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java index 6369e5f..7aeeff1 100644 --- a/src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java +++ b/src/main/java/ru/ulstu/extractor/rule/controller/RuleController.java @@ -23,7 +23,9 @@ public class RuleController { private final AntecedentValueService antecedentValueService; private final TimeSeriesService timeSeriesService; - public RuleController(RuleService ruleService, AntecedentValueService antecedentValueService, TimeSeriesService timeSeriesService) { + public RuleController(RuleService ruleService, + AntecedentValueService antecedentValueService, + TimeSeriesService timeSeriesService) { this.ruleService = ruleService; this.antecedentValueService = antecedentValueService; this.timeSeriesService = timeSeriesService; @@ -38,7 +40,7 @@ public class RuleController { @GetMapping(ADD_RULE) public String getAntecedent(Model model) { model.addAttribute("antecedentValues", antecedentValueService.getList()); - model.addAttribute("antecedents", timeSeriesService.getAllTimeSeries()); + model.addAttribute("antecedents", timeSeriesService.getAllTimeSeriesTypes()); model.addAttribute("addRuleForm", new AddRuleForm()); return ADD_RULE; } diff --git a/src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java b/src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java index 1fd344e..3b64bdd 100644 --- a/src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java +++ b/src/main/java/ru/ulstu/extractor/rule/model/AddRuleForm.java @@ -2,9 +2,9 @@ package ru.ulstu.extractor.rule.model; public class AddRuleForm { private Integer firstAntecedentValueId; - private Integer firstAntecedentId; + private String firstAntecedentId; private Integer secondAntecedentValueId; - private Integer secondAntecedentId; + private String secondAntecedentId; private String consequent; public AddRuleForm() { @@ -18,11 +18,11 @@ public class AddRuleForm { this.firstAntecedentValueId = firstAntecedentValueId; } - public Integer getFirstAntecedentId() { + public String getFirstAntecedentId() { return firstAntecedentId; } - public void setFirstAntecedentId(Integer firstAntecedentId) { + public void setFirstAntecedentId(String firstAntecedentId) { this.firstAntecedentId = firstAntecedentId; } @@ -34,11 +34,11 @@ public class AddRuleForm { this.secondAntecedentValueId = secondAntecedentValueId; } - public Integer getSecondAntecedentId() { + public String getSecondAntecedentId() { return secondAntecedentId; } - public void setSecondAntecedentId(Integer secondAntecedentId) { + public void setSecondAntecedentId(String secondAntecedentId) { this.secondAntecedentId = secondAntecedentId; } diff --git a/src/main/java/ru/ulstu/extractor/rule/model/Rule.java b/src/main/java/ru/ulstu/extractor/rule/model/Rule.java index e9efa92..73d015c 100644 --- a/src/main/java/ru/ulstu/extractor/rule/model/Rule.java +++ b/src/main/java/ru/ulstu/extractor/rule/model/Rule.java @@ -1,9 +1,11 @@ package ru.ulstu.extractor.rule.model; import ru.ulstu.extractor.core.BaseEntity; -import ru.ulstu.extractor.ts.model.TimeSeries; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.ManyToOne; @Entity @@ -11,14 +13,14 @@ public class Rule extends BaseEntity { @ManyToOne private AntecedentValue firstAntecedentValue; - @ManyToOne - private TimeSeries firstAntecedent; + @Enumerated(EnumType.STRING) + private TimeSeriesType firstAntecedent; @ManyToOne private AntecedentValue secondAntecedentValue; - @ManyToOne - private TimeSeries secondAntecedent; + @Enumerated(EnumType.STRING) + private TimeSeriesType secondAntecedent; private String consequent; @@ -26,9 +28,9 @@ public class Rule extends BaseEntity { } public Rule(AntecedentValue firstAntecedentValue, - TimeSeries firstAntecedent, + TimeSeriesType firstAntecedent, AntecedentValue secondAntecedentValue, - TimeSeries secondAntecedent, + TimeSeriesType secondAntecedent, String consequent) { this.firstAntecedentValue = firstAntecedentValue; this.firstAntecedent = firstAntecedent; @@ -37,21 +39,6 @@ public class Rule extends BaseEntity { this.consequent = consequent; } - public Rule(Integer id, - Integer version, - AntecedentValue firstAntecedentValue, - TimeSeries firstAntecedent, - AntecedentValue secondAntecedentValue, - TimeSeries secondAntecedent, - String consequent) { - super(id, version); - this.firstAntecedentValue = firstAntecedentValue; - this.firstAntecedent = firstAntecedent; - this.secondAntecedentValue = secondAntecedentValue; - this.secondAntecedent = secondAntecedent; - this.consequent = consequent; - } - public AntecedentValue getFirstAntecedentValue() { return firstAntecedentValue; } @@ -60,11 +47,11 @@ public class Rule extends BaseEntity { this.firstAntecedentValue = firstAntecedentValue; } - public TimeSeries getFirstAntecedent() { + public TimeSeriesType getFirstAntecedent() { return firstAntecedent; } - public void setFirstAntecedent(TimeSeries firstAntecedent) { + public void setFirstAntecedent(TimeSeriesType firstAntecedent) { this.firstAntecedent = firstAntecedent; } @@ -76,11 +63,11 @@ public class Rule extends BaseEntity { this.secondAntecedentValue = secondAntecedentValue; } - public TimeSeries getSecondAntecedent() { + public TimeSeriesType getSecondAntecedent() { return secondAntecedent; } - public void setSecondAntecedent(TimeSeries secondAntecedent) { + public void setSecondAntecedent(TimeSeriesType secondAntecedent) { this.secondAntecedent = secondAntecedent; } diff --git a/src/main/java/ru/ulstu/extractor/rule/service/RuleService.java b/src/main/java/ru/ulstu/extractor/rule/service/RuleService.java index 46a95a6..63413b9 100644 --- a/src/main/java/ru/ulstu/extractor/rule/service/RuleService.java +++ b/src/main/java/ru/ulstu/extractor/rule/service/RuleService.java @@ -4,6 +4,7 @@ import org.springframework.stereotype.Service; import ru.ulstu.extractor.rule.model.AddRuleForm; import ru.ulstu.extractor.rule.model.Rule; import ru.ulstu.extractor.rule.repository.RuleRepository; +import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.service.TimeSeriesService; import java.util.List; @@ -28,9 +29,9 @@ public class RuleService { public void saveRule(AddRuleForm addRuleForm) { ruleRepository.save(new Rule(antecedentValueService.getById(addRuleForm.getFirstAntecedentValueId()), - timeSeriesService.getById(addRuleForm.getFirstAntecedentId()), + TimeSeriesType.valueOf(addRuleForm.getFirstAntecedentId()), antecedentValueService.getById(addRuleForm.getSecondAntecedentValueId()), - timeSeriesService.getById(addRuleForm.getSecondAntecedentId()), + TimeSeriesType.valueOf(addRuleForm.getSecondAntecedentId()), addRuleForm.getConsequent())); } } diff --git a/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java index c7da83c..9c79d0f 100644 --- a/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java +++ b/src/main/java/ru/ulstu/extractor/ts/service/TimeSeriesService.java @@ -20,6 +20,7 @@ import ru.ulstu.extractor.ts.util.TimeSeriesDateMapper; import javax.transaction.Transactional; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -102,4 +103,8 @@ public class TimeSeriesService { return timeSeriesRepository.findById(tsId) .orElseThrow(() -> new RuntimeException("Time series not found by id " + tsId)); } + + public List getAllTimeSeriesTypes() { + return Arrays.asList(TimeSeriesType.values()); + } } diff --git a/src/main/resources/db/changelog-20221012_170000-schema.xml b/src/main/resources/db/changelog-20221012_170000-schema.xml index 61b2f4f..765df26 100644 --- a/src/main/resources/db/changelog-20221012_170000-schema.xml +++ b/src/main/resources/db/changelog-20221012_170000-schema.xml @@ -49,4 +49,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/addRule.html b/src/main/resources/templates/addRule.html index 8c709d0..191e07a 100644 --- a/src/main/resources/templates/addRule.html +++ b/src/main/resources/templates/addRule.html @@ -12,6 +12,19 @@
Если
+
+ +
+
+ имеет тенденцию +
- и + имеет тенденцию
-
- временной ряд -
-
- -
то:
-
+
-
+
+
+
+
diff --git a/src/main/resources/templates/listRules.html b/src/main/resources/templates/listRules.html index 93e139a..1f71b46 100644 --- a/src/main/resources/templates/listRules.html +++ b/src/main/resources/templates/listRules.html @@ -16,10 +16,10 @@ Если - + и - + то