|
|
@ -3,7 +3,9 @@ package ru.ulstu.extractor.ts.creator;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import ru.ulstu.extractor.author.model.Author;
|
|
|
|
import ru.ulstu.extractor.author.model.Author;
|
|
|
|
import ru.ulstu.extractor.author.service.AuthorService;
|
|
|
|
import ru.ulstu.extractor.author.service.AuthorService;
|
|
|
|
|
|
|
|
import ru.ulstu.extractor.branch.service.BranchService;
|
|
|
|
import ru.ulstu.extractor.commit.service.CommitService;
|
|
|
|
import ru.ulstu.extractor.commit.service.CommitService;
|
|
|
|
|
|
|
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
|
|
|
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
|
|
|
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
|
|
|
import ru.ulstu.extractor.ts.model.TimeSeries;
|
|
|
|
import ru.ulstu.extractor.ts.model.TimeSeries;
|
|
|
|
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
|
|
|
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
|
|
@ -19,14 +21,18 @@ public class AuthorTS extends AbstractTimeSeriesCreator {
|
|
|
|
private final CommitService commitService;
|
|
|
|
private final CommitService commitService;
|
|
|
|
private final AuthorService authorService;
|
|
|
|
private final AuthorService authorService;
|
|
|
|
private final GitRepositoryService gitRepositoryService;
|
|
|
|
private final GitRepositoryService gitRepositoryService;
|
|
|
|
|
|
|
|
private final BranchService branchService;
|
|
|
|
|
|
|
|
|
|
|
|
public AuthorTS(TimeSeriesService timeSeriesService,
|
|
|
|
public AuthorTS(TimeSeriesService timeSeriesService,
|
|
|
|
CommitService commitService,
|
|
|
|
CommitService commitService,
|
|
|
|
AuthorService authorService, GitRepositoryService gitRepositoryService) {
|
|
|
|
AuthorService authorService,
|
|
|
|
|
|
|
|
GitRepositoryService gitRepositoryService,
|
|
|
|
|
|
|
|
BranchService branchService) {
|
|
|
|
this.timeSeriesService = timeSeriesService;
|
|
|
|
this.timeSeriesService = timeSeriesService;
|
|
|
|
this.commitService = commitService;
|
|
|
|
this.commitService = commitService;
|
|
|
|
this.authorService = authorService;
|
|
|
|
this.authorService = authorService;
|
|
|
|
this.gitRepositoryService = gitRepositoryService;
|
|
|
|
this.gitRepositoryService = gitRepositoryService;
|
|
|
|
|
|
|
|
this.branchService = branchService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -38,14 +44,16 @@ public class AuthorTS extends AbstractTimeSeriesCreator {
|
|
|
|
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
|
|
|
|
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
|
|
|
|
List<TimeSeries> timeSeriesResult = new ArrayList<>();
|
|
|
|
List<TimeSeries> timeSeriesResult = new ArrayList<>();
|
|
|
|
List<Author> authors = authorService.findAll();
|
|
|
|
List<Author> authors = authorService.findAll();
|
|
|
|
|
|
|
|
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
|
|
|
|
List<ru.ulstu.extractor.model.Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
|
|
|
|
List<ru.ulstu.extractor.model.Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
|
|
|
|
for (Author author : authors) {
|
|
|
|
for (Author author : authors) {
|
|
|
|
TimeSeries timeSeries = new TimeSeries(
|
|
|
|
TimeSeries timeSeries = new TimeSeries(
|
|
|
|
String.format("%s %s %s %s",
|
|
|
|
String.format("%s %s %s %s",
|
|
|
|
gitRepositoryService.findById(repositoryId).getName(),
|
|
|
|
gitRepository.getName(),
|
|
|
|
branchName,
|
|
|
|
branchName,
|
|
|
|
author.getName(),
|
|
|
|
author.getName(),
|
|
|
|
getTimeSeriesType().getDescription()),
|
|
|
|
getTimeSeriesType().getDescription()),
|
|
|
|
|
|
|
|
branchService.findByRepositoryAndName(gitRepository, branchName),
|
|
|
|
getTimeSeriesType());
|
|
|
|
getTimeSeriesType());
|
|
|
|
for (ru.ulstu.extractor.model.Commit commit : commits) {
|
|
|
|
for (ru.ulstu.extractor.model.Commit commit : commits) {
|
|
|
|
if (commit.getAuthor().equals(author)) {
|
|
|
|
if (commit.getAuthor().equals(author)) {
|
|
|
|