WIP: страницы для правил #62

Closed
Ghost wants to merge 132 commits from master into 61-rules-pages
13 changed files with 134 additions and 29 deletions
Showing only changes of commit da3de8e4c8 - Show all commits

View File

@ -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)) {

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,11 +15,15 @@ import java.util.List;
@Component @Component
public class AuthorsCommitTS extends AbstractTimeSeriesCreator { public class AuthorsCommitTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public AuthorsCommitTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public AuthorsCommitTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@ -28,12 +34,15 @@ public class AuthorsCommitTS extends AbstractTimeSeriesCreator {
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
//TODO: добавить постраничное чтение
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,35 +1,43 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy; import ru.ulstu.extractor.ts.util.Dummy;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator { public class AuthorsCompletedIssueTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public AuthorsCompletedIssueTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
//TODO: добавить постраничное чтение
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,22 +15,28 @@ import java.util.List;
@Component @Component
public class AuthorsIssueTS extends AbstractTimeSeriesCreator { public class AuthorsIssueTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public AuthorsIssueTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public AuthorsIssueTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,11 +15,15 @@ import java.util.List;
@Component @Component
public class BranchTS extends AbstractTimeSeriesCreator { public class BranchTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public BranchTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public BranchTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@ -28,12 +34,14 @@ public class BranchTS extends AbstractTimeSeriesCreator {
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,22 +15,28 @@ import java.util.List;
@Component @Component
public class ClassTS extends AbstractTimeSeriesCreator { public class ClassTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public ClassTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public ClassTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,22 +15,28 @@ import java.util.List;
@Component @Component
public class DependenceTS extends AbstractTimeSeriesCreator { public class DependenceTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public DependenceTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public DependenceTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,8 +1,10 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
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.FileChange; import ru.ulstu.extractor.gitrepository.model.FileChange;
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,22 +21,28 @@ public class EntityTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final CommitService commitService; private final CommitService commitService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
private final BranchService branchService;
public EntityTS(TimeSeriesService timeSeriesService,
public EntityTS(TimeSeriesService timeSeriesService, CommitService commitService, GitRepositoryService gitRepositoryService) { CommitService commitService,
GitRepositoryService gitRepositoryService,
BranchService branchService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.commitService = commitService; this.commitService = commitService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
this.branchService = branchService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
commitService.findByRepositoryIdAndName(repositoryId, branchName) commitService.findByRepositoryIdAndName(repositoryId, branchName)
.stream() .stream()

View File

@ -1,8 +1,10 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
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.FileChange; import ru.ulstu.extractor.gitrepository.model.FileChange;
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.model.Commit; import ru.ulstu.extractor.model.Commit;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
@ -18,23 +20,30 @@ public class FileTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
private final CommitService commitService; private final CommitService commitService;
private final BranchService branchService;
public FileTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService, CommitService commitService) { public FileTS(TimeSeriesService timeSeriesService,
GitRepositoryService gitRepositoryService,
CommitService commitService,
BranchService branchService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
this.commitService = commitService; this.commitService = commitService;
this.branchService = branchService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
List<TimeSeries> timeSeriesResult = new ArrayList<>(); List<TimeSeries> timeSeriesResult = new ArrayList<>();
List<Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName)); List<Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
double value = 0; double value = 0;
TimeSeries timeSeries = new TimeSeries( TimeSeries timeSeries = new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType()); getTimeSeriesType());
for (Commit commit : commits) { for (Commit commit : commits) {
for (FileChange fileChange : commit.getFileChanges()) { for (FileChange fileChange : commit.getFileChanges()) {

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,22 +15,28 @@ import java.util.List;
@Component @Component
public class InterfaceTS extends AbstractTimeSeriesCreator { public class InterfaceTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public InterfaceTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public InterfaceTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,22 +15,28 @@ import java.util.List;
@Component @Component
public class IssuesTS extends AbstractTimeSeriesCreator { public class IssuesTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public IssuesTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public IssuesTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,6 +1,8 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
@ -13,22 +15,28 @@ import java.util.List;
@Component @Component
public class ProcessTS extends AbstractTimeSeriesCreator { public class ProcessTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public ProcessTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public ProcessTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }

View File

@ -1,35 +1,42 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
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;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import ru.ulstu.extractor.ts.util.Dummy; import ru.ulstu.extractor.ts.util.Dummy;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Component @Component
public class StarTS extends AbstractTimeSeriesCreator { public class StarTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final BranchService branchService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
public StarTS(TimeSeriesService timeSeriesService, GitRepositoryService gitRepositoryService) { public StarTS(TimeSeriesService timeSeriesService,
BranchService branchService,
GitRepositoryService gitRepositoryService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.branchService = branchService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
Dummy.getDefaultTimeSeries())); Dummy.getDefaultTimeSeries()));
} }