Временные ряды #59
@ -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 {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
versionSpringBoot = '2.3.9.RELEASE'
|
versionSpringBoot = '2.3.9.RELEASE'
|
||||||
|
@ -1,28 +1,22 @@
|
|||||||
package ru.ulstu.extractor.model;
|
package ru.ulstu.extractor.model;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class TimeSeriesValue extends BaseEntity {
|
public class TimeSeriesValue extends BaseEntity {
|
||||||
private Date date;
|
private Date date;
|
||||||
private Integer value;
|
private Integer value;
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
|
||||||
private TimeSeries timeSeries;
|
|
||||||
|
|
||||||
public TimeSeriesValue() {
|
public TimeSeriesValue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSeriesValue(Date date, Integer value) {
|
public TimeSeriesValue(Date date, Integer value) {
|
||||||
this.timeSeries = timeSeries;
|
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSeriesValue(TimeSeries timeSeries, Date date, Integer value) {
|
public TimeSeriesValue(TimeSeries timeSeries, Date date, Integer value) {
|
||||||
this.timeSeries = timeSeries;
|
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
@ -42,12 +36,4 @@ public class TimeSeriesValue extends BaseEntity {
|
|||||||
public void setValue(Integer value) {
|
public void setValue(Integer value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSeries getTimeSeries() {
|
|
||||||
return timeSeries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTimeSeries(TimeSeries timeSeries) {
|
|
||||||
this.timeSeries = timeSeries;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,12 @@ package ru.ulstu.extractor.repository;
|
|||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import ru.ulstu.extractor.model.TimeSeriesValue;
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface TimeSeriesValueRepository extends JpaRepository<TimeSeriesValue, Integer> {
|
public interface TimeSeriesValueRepository extends JpaRepository<TimeSeriesValue, Integer> {
|
||||||
//TimeSeriesValue findByTimeSeriesAndName(TimeSeries timeSeries, String name);
|
//TimeSeriesValue findByTimeSeriesAndName(TimeSeries timeSeries, String name);
|
||||||
|
|
||||||
//List<TimeSeriesValue> findTimeSeriesValueById(Integer repositoryId);
|
//List<TimeSeriesValue> findTimeSeriesValueById(Integer repositoryId);
|
||||||
|
|
||||||
|
void deleteAllByIdIn(List<Integer> ids);
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,17 @@ package ru.ulstu.extractor.service;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.extractor.model.BaseEntity;
|
|
||||||
import ru.ulstu.extractor.model.TimeSeries;
|
import ru.ulstu.extractor.model.TimeSeries;
|
||||||
import ru.ulstu.extractor.model.TimeSeriesValue;
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.repository.TimeSeriesRepository;
|
import ru.ulstu.extractor.repository.TimeSeriesRepository;
|
||||||
import ru.ulstu.extractor.repository.TimeSeriesValueRepository;
|
import ru.ulstu.extractor.repository.TimeSeriesValueRepository;
|
||||||
import ru.ulstu.extractor.ts.TimeSeriesDateMapper;
|
import ru.ulstu.extractor.ts.TimeSeriesDateMapper;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -32,15 +34,31 @@ public class TimeSeriesService {
|
|||||||
this.timeSeriesValueRepository = timeSeriesValueRepository;
|
this.timeSeriesValueRepository = timeSeriesValueRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Сохранить список временных рядов
|
||||||
|
*
|
||||||
|
* @param timeSeriesValues
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public List<TimeSeries> save(Map<String, List<TimeSeriesValue>> timeSeriesValues) {
|
||||||
|
List<TimeSeries> results = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, List<TimeSeriesValue>> entry : timeSeriesValues.entrySet()) {
|
||||||
|
results.add(save(entry.getKey(), entry.getValue()));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public TimeSeries save(String timeSeriesName, List<TimeSeriesValue> timeSeriesValues) {
|
public TimeSeries save(String timeSeriesName, List<TimeSeriesValue> timeSeriesValues) {
|
||||||
LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size());
|
LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size());
|
||||||
final TimeSeries timeSeries = findOrCreate(timeSeriesName);
|
final TimeSeries timeSeries = findOrCreate(timeSeriesName);
|
||||||
List<Integer> timeSeriesValuesToRemoveIds = timeSeries.getValues().stream().map(BaseEntity::getId).collect(Collectors.toList());
|
List<TimeSeriesValue> timeSeriesValuesToRemove = timeSeries.getValues();
|
||||||
timeSeriesValues.forEach(v -> v.setTimeSeries(timeSeries));
|
|
||||||
timeSeries.setValues(timeSeriesValues);
|
timeSeries.setValues(timeSeriesValues);
|
||||||
LOG.debug("Save time series {} ", timeSeries.getName());
|
LOG.debug("Save time series {} ", timeSeries.getName());
|
||||||
TimeSeries savedTimeSeries = timeSeriesRepository.save(timeSeries);
|
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;
|
return savedTimeSeries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,19 +4,37 @@ import ru.ulstu.extractor.model.TimeSeriesValue;
|
|||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static ru.ulstu.extractor.ts.TimeSeriesDateMapper.mapTimeSeriesToInterval;
|
||||||
|
|
||||||
public abstract class AbstractTimeSeriesCreator {
|
public abstract class AbstractTimeSeriesCreator {
|
||||||
|
|
||||||
public abstract String getTimeSeriesName();
|
public abstract String getTimeSeriesName();
|
||||||
|
|
||||||
public abstract List<TimeSeriesValue> getTimeSeriesValues(Integer repositoryId, String branchName);
|
/**
|
||||||
|
* Извлечь список точек временных рядов
|
||||||
|
*
|
||||||
|
* @param repositoryId
|
||||||
|
* @param branchName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public abstract Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName);
|
||||||
|
|
||||||
public abstract TimeSeriesService getTimeSeriesService();
|
public abstract TimeSeriesService getTimeSeriesService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Сохранить извлеченные временные ряды
|
||||||
|
*
|
||||||
|
* @param repositoryId
|
||||||
|
* @param branchName
|
||||||
|
*/
|
||||||
public void addTimeSeries(Integer repositoryId, String branchName) {
|
public void addTimeSeries(Integer repositoryId, String branchName) {
|
||||||
getTimeSeriesService().save(
|
// извлеченные точки временных рядов
|
||||||
String.format("%s %s %s", getTimeSeriesName(), repositoryId, branchName),
|
Map<String, List<TimeSeriesValue>> timeSeriesValues = getTimeSeriesValues(repositoryId, branchName);
|
||||||
TimeSeriesDateMapper.mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(),
|
|
||||||
getTimeSeriesValues(repositoryId, branchName)));
|
// сгруппированные по временным интервалам точки временных рядов
|
||||||
|
timeSeriesValues.replaceAll((k, v) -> mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), v));
|
||||||
|
getTimeSeriesService().save(timeSeriesValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AuthorTS extends AbstractTSExtractor {
|
public class AuthorTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public AuthorTS(TimeSeriesService timeSeriesService) {
|
public AuthorTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class AuthorTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество Авторов";
|
return "Количество Авторов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AuthorsCommentTS extends AbstractTSExtractor {
|
public class AuthorsCommentTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public AuthorsCommentTS(TimeSeriesService timeSeriesService) {
|
public AuthorsCommentTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class AuthorsCommentTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество коммитов авторов";
|
return "Количество коммитов авторов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AuthorsCompletedIssueTS extends AbstractTSExtractor {
|
public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService) {
|
public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class AuthorsCompletedIssueTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество выполненных issues авторов";
|
return "Количество выполненных issues авторов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AuthorsIssueTS extends AbstractTSExtractor {
|
public class AuthorsIssueTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public AuthorsIssueTS(TimeSeriesService timeSeriesService) {
|
public AuthorsIssueTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class AuthorsIssueTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество issues авторов";
|
return "Количество issues авторов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class BranchTS extends AbstractTSExtractor {
|
public class BranchTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public BranchTS(TimeSeriesService timeSeriesService) {
|
public BranchTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class BranchTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество веток";
|
return "Количество веток";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ClassTS extends AbstractTSExtractor {
|
public class ClassTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public ClassTS(TimeSeriesService timeSeriesService) {
|
public ClassTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class ClassTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество классов";
|
return "Количество классов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -5,7 +5,9 @@ import ru.ulstu.extractor.commit.service.CommitService;
|
|||||||
import ru.ulstu.extractor.model.TimeSeriesValue;
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -25,12 +27,15 @@ public class CommitsTS extends AbstractTimeSeriesCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TimeSeriesValue> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
//TODO: добавить постраничное чтение
|
//TODO: добавить постраничное чтение
|
||||||
return commitService.findByRepositoryIdAndName(repositoryId, branchName)
|
Map<String, List<TimeSeriesValue>> result = new HashMap<>();
|
||||||
.stream()
|
result.put(String.format("%s %s %s", getTimeSeriesName(), repositoryId, branchName),
|
||||||
.map(c -> new TimeSeriesValue(c.getDate(), 1))
|
commitService.findByRepositoryIdAndName(repositoryId, branchName)
|
||||||
.collect(Collectors.toList());
|
.stream()
|
||||||
|
.map(c -> new TimeSeriesValue(c.getDate(), 1))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class DependenceTS extends AbstractTSExtractor {
|
public class DependenceTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public DependenceTS(TimeSeriesService timeSeriesService) {
|
public DependenceTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class DependenceTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество зависимостей";
|
return "Количество зависимостей";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class EntityTS extends AbstractTSExtractor {
|
public class EntityTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public EntityTS(TimeSeriesService timeSeriesService) {
|
public EntityTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class EntityTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество сущностей";
|
return "Количество сущностей";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FileTS extends AbstractTSExtractor {
|
public class FileTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public FileTS(TimeSeriesService timeSeriesService) {
|
public FileTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class FileTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество файлов";
|
return "Количество файлов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class InterfaceTS extends AbstractTSExtractor {
|
public class InterfaceTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public InterfaceTS(TimeSeriesService timeSeriesService) {
|
public InterfaceTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class InterfaceTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество интерфейсов";
|
return "Количество интерфейсов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class IssuesTS extends AbstractTSExtractor {
|
public class IssuesTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public IssuesTS(TimeSeriesService timeSeriesService) {
|
public IssuesTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,12 +17,17 @@ public class IssuesTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество issues созданных во времени";
|
return "Количество issues созданных во времени";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return null;
|
return timeSeriesService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ProcessTS extends AbstractTSExtractor {
|
public class ProcessTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public ProcessTS(TimeSeriesService timeSeriesService) {
|
public ProcessTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class ProcessTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество процессов";
|
return "Количество процессов";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package ru.ulstu.extractor.ts;
|
package ru.ulstu.extractor.ts;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class StarTS extends AbstractTSExtractor {
|
public class StarTS extends AbstractTimeSeriesCreator {
|
||||||
private final TimeSeriesService timeSeriesService;
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
public StarTS(TimeSeriesService timeSeriesService) {
|
public StarTS(TimeSeriesService timeSeriesService) {
|
||||||
@ -12,10 +17,15 @@ public class StarTS extends AbstractTSExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTSName() {
|
public String getTimeSeriesName() {
|
||||||
return "Количество звезд";
|
return "Количество звезд";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeSeriesService getTimeSeriesService() {
|
public TimeSeriesService getTimeSeriesService() {
|
||||||
return timeSeriesService;
|
return timeSeriesService;
|
||||||
|
@ -8,4 +8,7 @@
|
|||||||
<changeSet author="orion" id="20220621-120000-2">
|
<changeSet author="orion" id="20220621-120000-2">
|
||||||
<renameTable oldTableName="repository" newTableName="git_repository"/>
|
<renameTable oldTableName="repository" newTableName="git_repository"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
<changeSet author="orion" id="20221006-120000-1">
|
||||||
|
<dropNotNullConstraint tableName="time_series_value" columnName="time_series_id"/>
|
||||||
|
</changeSet>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
Loading…
Reference in New Issue
Block a user