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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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