show authors
parent
8365cf825a
commit
ddd5bc504e
@ -1,13 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Anton Romanov - All Rights Reserved
|
||||
* You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
||||
*/
|
||||
|
||||
package ru.ulstu.extractor.service;
|
||||
|
||||
import com.sun.istack.NotNull;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.extractor.model.Commit;
|
||||
import ru.ulstu.extractor.repository.AuthorRepository;
|
||||
import ru.ulstu.extractor.repository.CommitRepository;
|
||||
import ru.ulstu.extractor.repository.RepositoryRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FilteringService {
|
||||
private final AuthorRepository authorRepository;
|
||||
private final CommitRepository commitRepository;
|
||||
private final RepositoryRepository repositoryRepository;
|
||||
|
||||
public FilteringService(AuthorRepository authorRepository,
|
||||
CommitRepository commitRepository,
|
||||
RepositoryRepository repositoryRepository) {
|
||||
this.authorRepository = authorRepository;
|
||||
this.commitRepository = commitRepository;
|
||||
this.repositoryRepository = repositoryRepository;
|
||||
}
|
||||
|
||||
private final IndexService indexService;
|
||||
public List<String> getRepositoryAuthors(@NotNull String repositoryUrl,
|
||||
@NotNull String branchName) {
|
||||
return authorRepository.findByRepositoryAndBranch(
|
||||
repositoryRepository.findByUrl(repositoryUrl),
|
||||
branchName
|
||||
);
|
||||
}
|
||||
|
||||
public FilteringService(IndexService indexService) {
|
||||
this.indexService = indexService;
|
||||
public Page<Commit> getCommits(@NotNull String repositoryUrl,
|
||||
@NotNull String branchName,
|
||||
Pageable pageable) {
|
||||
return commitRepository.findByRepositoryAndBranch(
|
||||
pageable,
|
||||
repositoryRepository.findByUrl(repositoryUrl),
|
||||
branchName
|
||||
);
|
||||
}
|
||||
|
||||
/* @PostMapping("/sendFilter")
|
||||
public String sendFilter(@ModelAttribute FilterForm filterForm, Model model) throws GitAPIException, IOException {
|
||||
List<Commit> list = gitRepositoryService.getCommits(filterForm.getUrl(), filterForm.getBranch());
|
||||
model.addAttribute("commits", list);
|
||||
if (filterForm.getFilter() == null || filterForm.getFilter().isEmpty()) {
|
||||
model.addAttribute("error", "'Строка' не должно быть пустым");
|
||||
return "filtering";
|
||||
}
|
||||
return "resultRepo";
|
||||
}*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue