WIP: страницы для правил #62
@ -56,8 +56,8 @@ public class GitRepositoryService {
|
||||
private static final String BRANCH_PREFIX = "refs/remotes/origin/";
|
||||
@Value("${extractor.custom-projects-dir}")
|
||||
private String customProjectsDir;
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(4);
|
||||
private final ExecutorService executorServiceCommits = Executors.newFixedThreadPool(4);
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(8);
|
||||
private final ExecutorService executorServiceCommits = Executors.newFixedThreadPool(8);
|
||||
private final StructuralUnitService structuralUnitService;
|
||||
private final GitRepositoryRepository gitRepositoryRepository;
|
||||
|
||||
@ -370,4 +370,8 @@ public class GitRepositoryService {
|
||||
public Page<GitRepository> findAll(Pageable pageable) {
|
||||
return gitRepositoryRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
public GitRepository findById(Integer id) {
|
||||
return gitRepositoryRepository.getOne(id);
|
||||
}
|
||||
}
|
||||
|
@ -22,4 +22,11 @@ public class GitRepository extends BaseEntity {
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
int lastDelimiterIndex = url.lastIndexOf("/");
|
||||
return (lastDelimiterIndex > 0 && lastDelimiterIndex < url.length())
|
||||
? url.substring(lastDelimiterIndex + 1)
|
||||
: url;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package ru.ulstu.extractor.ts;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.ulstu.extractor.commit.service.CommitService;
|
||||
import ru.ulstu.extractor.gitrepository.GitRepositoryService;
|
||||
import ru.ulstu.extractor.model.TimeSeriesValue;
|
||||
import ru.ulstu.extractor.service.TimeSeriesService;
|
||||
|
||||
@ -14,11 +15,14 @@ import java.util.stream.Collectors;
|
||||
public class CommitsTS extends AbstractTimeSeriesCreator {
|
||||
private final TimeSeriesService timeSeriesService;
|
||||
private final CommitService commitService;
|
||||
private final GitRepositoryService gitRepositoryService;
|
||||
|
||||
public CommitsTS(TimeSeriesService timeSeriesService,
|
||||
CommitService commitService) {
|
||||
CommitService commitService,
|
||||
GitRepositoryService gitRepositoryService) {
|
||||
this.timeSeriesService = timeSeriesService;
|
||||
this.commitService = commitService;
|
||||
this.gitRepositoryService = gitRepositoryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -30,7 +34,9 @@ public class CommitsTS extends AbstractTimeSeriesCreator {
|
||||
public Map<String, List<TimeSeriesValue>> getTimeSeriesValues(Integer repositoryId, String branchName) {
|
||||
//TODO: добавить постраничное чтение
|
||||
Map<String, List<TimeSeriesValue>> result = new HashMap<>();
|
||||
result.put(String.format("%s %s %s", getTimeSeriesName(), repositoryId, branchName),
|
||||
result.put(String.format("%s %s %s", gitRepositoryService.findById(repositoryId).getName(),
|
||||
branchName,
|
||||
getTimeSeriesName()),
|
||||
commitService.findByRepositoryIdAndName(repositoryId, branchName)
|
||||
.stream()
|
||||
.map(c -> new TimeSeriesValue(c.getDate(), 1.0))
|
||||
|
Loading…
Reference in New Issue
Block a user