From 0dc4dc46d77aedef9081ee2dfddbd808f1b2cb30 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Thu, 6 Oct 2022 14:40:06 +0400 Subject: [PATCH] #59 -- fix multiple time series generation --- build.gradle | 5 ---- .../extractor/model/TimeSeriesValue.java | 14 ---------- .../repository/TimeSeriesValueRepository.java | 4 +++ .../extractor/service/TimeSeriesService.java | 26 ++++++++++++++--- .../ts/AbstractTimeSeriesCreator.java | 28 +++++++++++++++---- .../java/ru/ulstu/extractor/ts/AuthorTS.java | 14 ++++++++-- .../ulstu/extractor/ts/AuthorsCommentTS.java | 14 ++++++++-- .../extractor/ts/AuthorsCompletedIssueTS.java | 14 ++++++++-- .../ru/ulstu/extractor/ts/AuthorsIssueTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/BranchTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/ClassTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/CommitsTS.java | 15 ++++++---- .../ru/ulstu/extractor/ts/DependenceTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/EntityTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/FileTS.java | 14 ++++++++-- .../ru/ulstu/extractor/ts/InterfaceTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/IssuesTS.java | 16 +++++++++-- .../java/ru/ulstu/extractor/ts/ProcessTS.java | 14 ++++++++-- .../java/ru/ulstu/extractor/ts/StarTS.java | 14 ++++++++-- .../db/changelog-20220621_120000-schema.xml | 3 ++ 20 files changed, 219 insertions(+), 60 deletions(-) diff --git a/build.gradle b/build.gradle index 04deaca..29c6ed9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,3 @@ -/* - * Copyright (C) 2021 Anton Romanov - All Rights Reserved - * You may use, distribute and modify this code, please write to: romanov73@gmail.com. - */ - buildscript { ext { versionSpringBoot = '2.3.9.RELEASE' diff --git a/src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java b/src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java index 3efd621..673f156 100644 --- a/src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java +++ b/src/main/java/ru/ulstu/extractor/model/TimeSeriesValue.java @@ -1,28 +1,22 @@ package ru.ulstu.extractor.model; import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.ManyToOne; import java.util.Date; @Entity public class TimeSeriesValue extends BaseEntity { private Date date; private Integer value; - @ManyToOne(fetch = FetchType.LAZY) - private TimeSeries timeSeries; public TimeSeriesValue() { } public TimeSeriesValue(Date date, Integer value) { - this.timeSeries = timeSeries; this.date = date; this.value = value; } public TimeSeriesValue(TimeSeries timeSeries, Date date, Integer value) { - this.timeSeries = timeSeries; this.date = date; this.value = value; } @@ -42,12 +36,4 @@ public class TimeSeriesValue extends BaseEntity { public void setValue(Integer value) { this.value = value; } - - public TimeSeries getTimeSeries() { - return timeSeries; - } - - public void setTimeSeries(TimeSeries timeSeries) { - this.timeSeries = timeSeries; - } } diff --git a/src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java b/src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java index cad99ca..b603ed5 100644 --- a/src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java +++ b/src/main/java/ru/ulstu/extractor/repository/TimeSeriesValueRepository.java @@ -3,8 +3,12 @@ package ru.ulstu.extractor.repository; import org.springframework.data.jpa.repository.JpaRepository; import ru.ulstu.extractor.model.TimeSeriesValue; +import java.util.List; + public interface TimeSeriesValueRepository extends JpaRepository { //TimeSeriesValue findByTimeSeriesAndName(TimeSeries timeSeries, String name); //List findTimeSeriesValueById(Integer repositoryId); + + void deleteAllByIdIn(List ids); } diff --git a/src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java b/src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java index 644f6aa..9707172 100644 --- a/src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java +++ b/src/main/java/ru/ulstu/extractor/service/TimeSeriesService.java @@ -8,15 +8,17 @@ package ru.ulstu.extractor.service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import ru.ulstu.extractor.model.BaseEntity; 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 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; @@ -32,15 +34,31 @@ public class TimeSeriesService { this.timeSeriesValueRepository = timeSeriesValueRepository; } + /** + * Сохранить список временных рядов + * + * @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) { LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size()); final TimeSeries timeSeries = findOrCreate(timeSeriesName); - List timeSeriesValuesToRemoveIds = timeSeries.getValues().stream().map(BaseEntity::getId).collect(Collectors.toList()); - timeSeriesValues.forEach(v -> v.setTimeSeries(timeSeries)); + List timeSeriesValuesToRemove = timeSeries.getValues(); timeSeries.setValues(timeSeriesValues); LOG.debug("Save time series {} ", timeSeries.getName()); TimeSeries savedTimeSeries = timeSeriesRepository.save(timeSeries); - LOG.debug("Clear {} time series values ", timeSeriesValuesToRemoveIds.size()); + LOG.debug("Clear {} time series values ", timeSeriesValuesToRemove.size()); + timeSeriesValueRepository.deleteAll(timeSeriesValuesToRemove); return savedTimeSeries; } diff --git a/src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java b/src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java index 2cc9f4f..4fde2c8 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java +++ b/src/main/java/ru/ulstu/extractor/ts/AbstractTimeSeriesCreator.java @@ -4,19 +4,37 @@ import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; import java.util.List; +import java.util.Map; + +import static ru.ulstu.extractor.ts.TimeSeriesDateMapper.mapTimeSeriesToInterval; public abstract class AbstractTimeSeriesCreator { public abstract String getTimeSeriesName(); - public abstract List getTimeSeriesValues(Integer repositoryId, String branchName); + /** + * Извлечь список точек временных рядов + * + * @param repositoryId + * @param branchName + * @return + */ + public abstract Map> getTimeSeriesValues(Integer repositoryId, String branchName); public abstract TimeSeriesService getTimeSeriesService(); + /** + * Сохранить извлеченные временные ряды + * + * @param repositoryId + * @param branchName + */ public void addTimeSeries(Integer repositoryId, String branchName) { - getTimeSeriesService().save( - String.format("%s %s %s", getTimeSeriesName(), repositoryId, branchName), - TimeSeriesDateMapper.mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), - getTimeSeriesValues(repositoryId, branchName))); + // извлеченные точки временных рядов + Map> timeSeriesValues = getTimeSeriesValues(repositoryId, branchName); + + // сгруппированные по временным интервалам точки временных рядов + timeSeriesValues.replaceAll((k, v) -> mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), v)); + getTimeSeriesService().save(timeSeriesValues); } } diff --git a/src/main/java/ru/ulstu/extractor/ts/AuthorTS.java b/src/main/java/ru/ulstu/extractor/ts/AuthorTS.java index a25a835..a6d01dc 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/AuthorTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class AuthorTS extends AbstractTSExtractor { +public class AuthorTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public AuthorTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class AuthorTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/AuthorsCommentTS.java b/src/main/java/ru/ulstu/extractor/ts/AuthorsCommentTS.java index 0a2feea..62ea9a7 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorsCommentTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/AuthorsCommentTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class AuthorsCommentTS extends AbstractTSExtractor { +public class AuthorsCommentTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public AuthorsCommentTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class AuthorsCommentTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/AuthorsCompletedIssueTS.java b/src/main/java/ru/ulstu/extractor/ts/AuthorsCompletedIssueTS.java index d6df385..7453fdb 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorsCompletedIssueTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/AuthorsCompletedIssueTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class AuthorsCompletedIssueTS extends AbstractTSExtractor { +public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class AuthorsCompletedIssueTS extends AbstractTSExtractor { } @Override - public String getTSName() { + public String getTimeSeriesName() { return "Количество выполненных issues авторов"; } + @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/AuthorsIssueTS.java b/src/main/java/ru/ulstu/extractor/ts/AuthorsIssueTS.java index a780b4f..d7318da 100644 --- a/src/main/java/ru/ulstu/extractor/ts/AuthorsIssueTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/AuthorsIssueTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class AuthorsIssueTS extends AbstractTSExtractor { +public class AuthorsIssueTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public AuthorsIssueTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class AuthorsIssueTS extends AbstractTSExtractor { } @Override - public String getTSName() { + public String getTimeSeriesName() { return "Количество issues авторов"; } + @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/BranchTS.java b/src/main/java/ru/ulstu/extractor/ts/BranchTS.java index 6f6200c..6233909 100644 --- a/src/main/java/ru/ulstu/extractor/ts/BranchTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/BranchTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class BranchTS extends AbstractTSExtractor { +public class BranchTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public BranchTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class BranchTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/ClassTS.java b/src/main/java/ru/ulstu/extractor/ts/ClassTS.java index 4d68d4c..1fdf504 100644 --- a/src/main/java/ru/ulstu/extractor/ts/ClassTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/ClassTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class ClassTS extends AbstractTSExtractor { +public class ClassTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public ClassTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class ClassTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/CommitsTS.java b/src/main/java/ru/ulstu/extractor/ts/CommitsTS.java index 8f7dae0..47f447a 100644 --- a/src/main/java/ru/ulstu/extractor/ts/CommitsTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/CommitsTS.java @@ -5,7 +5,9 @@ import ru.ulstu.extractor.commit.service.CommitService; import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Component @@ -25,12 +27,15 @@ public class CommitsTS extends AbstractTimeSeriesCreator { } @Override - public List getTimeSeriesValues(Integer repositoryId, String branchName) { + public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { //TODO: добавить постраничное чтение - return commitService.findByRepositoryIdAndName(repositoryId, branchName) - .stream() - .map(c -> new TimeSeriesValue(c.getDate(), 1)) - .collect(Collectors.toList()); + Map> result = new HashMap<>(); + result.put(String.format("%s %s %s", getTimeSeriesName(), repositoryId, branchName), + commitService.findByRepositoryIdAndName(repositoryId, branchName) + .stream() + .map(c -> new TimeSeriesValue(c.getDate(), 1)) + .collect(Collectors.toList())); + return result; } @Override diff --git a/src/main/java/ru/ulstu/extractor/ts/DependenceTS.java b/src/main/java/ru/ulstu/extractor/ts/DependenceTS.java index 0df8357..26c0e39 100644 --- a/src/main/java/ru/ulstu/extractor/ts/DependenceTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/DependenceTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class DependenceTS extends AbstractTSExtractor { +public class DependenceTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public DependenceTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class DependenceTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/EntityTS.java b/src/main/java/ru/ulstu/extractor/ts/EntityTS.java index dc687bf..ff6a2d9 100644 --- a/src/main/java/ru/ulstu/extractor/ts/EntityTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/EntityTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class EntityTS extends AbstractTSExtractor { +public class EntityTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public EntityTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class EntityTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/FileTS.java b/src/main/java/ru/ulstu/extractor/ts/FileTS.java index 5325dd4..e90ce57 100644 --- a/src/main/java/ru/ulstu/extractor/ts/FileTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/FileTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class FileTS extends AbstractTSExtractor { +public class FileTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public FileTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class FileTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/InterfaceTS.java b/src/main/java/ru/ulstu/extractor/ts/InterfaceTS.java index 9899c64..7d26f00 100644 --- a/src/main/java/ru/ulstu/extractor/ts/InterfaceTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/InterfaceTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class InterfaceTS extends AbstractTSExtractor { +public class InterfaceTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public InterfaceTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class InterfaceTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/IssuesTS.java b/src/main/java/ru/ulstu/extractor/ts/IssuesTS.java index e565172..51ecffd 100644 --- a/src/main/java/ru/ulstu/extractor/ts/IssuesTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/IssuesTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class IssuesTS extends AbstractTSExtractor { +public class IssuesTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public IssuesTS(TimeSeriesService timeSeriesService) { @@ -12,12 +17,17 @@ public class IssuesTS extends AbstractTSExtractor { } @Override - public String getTSName() { + public String getTimeSeriesName() { return "Количество issues созданных во времени"; } + @Override + public Map> getTimeSeriesValues(Integer repositoryId, String branchName) { + return new HashMap<>(); + } + @Override public TimeSeriesService getTimeSeriesService() { - return null; + return timeSeriesService; } } diff --git a/src/main/java/ru/ulstu/extractor/ts/ProcessTS.java b/src/main/java/ru/ulstu/extractor/ts/ProcessTS.java index 03198fa..bc4b322 100644 --- a/src/main/java/ru/ulstu/extractor/ts/ProcessTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/ProcessTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class ProcessTS extends AbstractTSExtractor { +public class ProcessTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public ProcessTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class ProcessTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/StarTS.java b/src/main/java/ru/ulstu/extractor/ts/StarTS.java index 839e039..38455a3 100644 --- a/src/main/java/ru/ulstu/extractor/ts/StarTS.java +++ b/src/main/java/ru/ulstu/extractor/ts/StarTS.java @@ -1,10 +1,15 @@ package ru.ulstu.extractor.ts; import org.springframework.stereotype.Component; +import ru.ulstu.extractor.model.TimeSeriesValue; import ru.ulstu.extractor.service.TimeSeriesService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @Component -public class StarTS extends AbstractTSExtractor { +public class StarTS extends AbstractTimeSeriesCreator { private final TimeSeriesService timeSeriesService; public StarTS(TimeSeriesService timeSeriesService) { @@ -12,10 +17,15 @@ public class StarTS extends AbstractTSExtractor { } @Override - public String getTSName() { + 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/resources/db/changelog-20220621_120000-schema.xml b/src/main/resources/db/changelog-20220621_120000-schema.xml index 2df5c58..aaccfc8 100644 --- a/src/main/resources/db/changelog-20220621_120000-schema.xml +++ b/src/main/resources/db/changelog-20220621_120000-schema.xml @@ -8,4 +8,7 @@ + + + \ No newline at end of file