WIP: страницы для правил #62
@ -6,14 +6,7 @@ import ru.ulstu.extractor.commit.model.Commit;
|
||||
import ru.ulstu.extractor.core.BaseEntity;
|
||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -21,6 +14,7 @@ import static ru.ulstu.extractor.branch.model.IndexingStatus.EMPTY;
|
||||
|
||||
@Entity
|
||||
public class Branch extends BaseEntity {
|
||||
public static Integer GENERATED_BRANCH_ID = 1;
|
||||
private String name;
|
||||
|
||||
@ManyToOne
|
||||
|
@ -7,8 +7,11 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static ru.ulstu.extractor.core.Route.DELETE_INDEXED_REPOSITORY;
|
||||
import static ru.ulstu.extractor.core.Route.LIST_INDEXED_REPOSITORIES;
|
||||
import static ru.ulstu.extractor.gitrepository.model.GitRepository.GENERATED_REPOSITORY_ID;
|
||||
|
||||
@Controller
|
||||
@ApiIgnore
|
||||
@ -21,7 +24,10 @@ public class RepositoryController {
|
||||
|
||||
@GetMapping(LIST_INDEXED_REPOSITORIES)
|
||||
public String indexNewRepo(Model model) {
|
||||
model.addAttribute("repositories", gitRepositoryRepository.findAll());
|
||||
model.addAttribute("repositories", gitRepositoryRepository.findAll()
|
||||
.stream()
|
||||
.filter(r -> !r.getId().equals(GENERATED_REPOSITORY_ID))
|
||||
.collect(Collectors.toList()));
|
||||
return LIST_INDEXED_REPOSITORIES;
|
||||
}
|
||||
|
||||
@ -29,7 +35,10 @@ public class RepositoryController {
|
||||
public String deleteRepo(Model model,
|
||||
@RequestParam Integer id) {
|
||||
gitRepositoryRepository.deleteById(id);
|
||||
model.addAttribute("repositories", gitRepositoryRepository.findAll());
|
||||
model.addAttribute("repositories", gitRepositoryRepository.findAll()
|
||||
.stream()
|
||||
.filter(r -> !r.getId().equals(GENERATED_REPOSITORY_ID))
|
||||
.collect(Collectors.toList()));
|
||||
return "redirect:/" + LIST_INDEXED_REPOSITORIES;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static ru.ulstu.extractor.branch.model.Branch.GENERATED_BRANCH_ID;
|
||||
import static ru.ulstu.extractor.core.Route.STATISTIC;
|
||||
|
||||
@Controller
|
||||
@ -60,7 +61,9 @@ public class StatisticController {
|
||||
filterForm.setEntity(entity.orElse(null));
|
||||
model.addAttribute("filterForm", filterForm);
|
||||
model.addAttribute("entityPresent", filteringService.getEntityPresent());
|
||||
model.addAttribute("branches", branchService.findAll());
|
||||
model.addAttribute("branches", branchService.findAll().stream()
|
||||
.filter(r -> !r.getId().equals(GENERATED_BRANCH_ID))
|
||||
.collect(Collectors.toList()));
|
||||
model.addAttribute("authors", filteringService.getRepositoryAuthors(branchId.orElse(null)));
|
||||
return STATISTIC;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class GitRepository extends BaseEntity {
|
||||
|
||||
public static Integer GENERATED_REPOSITORY_ID = 1;
|
||||
private String url;
|
||||
private String repositoryId;
|
||||
|
||||
|
@ -14,6 +14,9 @@ import ru.ulstu.extractor.ts.service.TimeSeriesService;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static ru.ulstu.extractor.branch.model.Branch.GENERATED_BRANCH_ID;
|
||||
|
||||
@Controller
|
||||
@ApiIgnore
|
||||
@ -32,14 +35,18 @@ public class TimeSeriesMarkupController {
|
||||
|
||||
@GetMapping("time-series-markup")
|
||||
public String markupTs(Model model) {
|
||||
model.addAttribute("branches", branchService.findAllValid());
|
||||
model.addAttribute("branches", branchService.findAllValid().stream()
|
||||
.filter(r -> !r.getId().equals(GENERATED_BRANCH_ID))
|
||||
.collect(Collectors.toList()));
|
||||
model.addAttribute("markupForm", new MarkupForm());
|
||||
return "markup";
|
||||
}
|
||||
|
||||
@PostMapping("time-series-markup")
|
||||
public String filter(Model model, @ModelAttribute MarkupForm markupForm) {
|
||||
model.addAttribute("branches", branchService.findAllValid());
|
||||
model.addAttribute("branches", branchService.findAllValid().stream()
|
||||
.filter(r -> !r.getId().equals(GENERATED_BRANCH_ID))
|
||||
.collect(Collectors.toList()));
|
||||
if (markupForm != null && markupForm.getBranchId() != null) {
|
||||
List<TimeSeriesForMarkup> tss = markupService.getTimeSeriesForMarkup(
|
||||
timeSeriesService.getGroupedTendencies(
|
||||
@ -56,7 +63,9 @@ public class TimeSeriesMarkupController {
|
||||
|
||||
@PostMapping(Route.ADD_MARKUP)
|
||||
public String addMarkups(Model model, @ModelAttribute MarkupForm markupForm) {
|
||||
model.addAttribute("branches", branchService.findAllValid());
|
||||
model.addAttribute("branches", branchService.findAllValid().stream()
|
||||
.filter(r -> !r.getId().equals(GENERATED_BRANCH_ID))
|
||||
.collect(Collectors.toList()));
|
||||
if (markupForm != null && markupForm.getBranchId() != null) {
|
||||
List<TimeSeriesForMarkup> tss = markupService.getTimeSeriesForMarkup(
|
||||
timeSeriesService.getGroupedTendencies(
|
||||
|
@ -9,6 +9,9 @@ import ru.ulstu.extractor.branch.service.BranchService;
|
||||
import ru.ulstu.extractor.ts.creator.scheduled.ScheduledTimeSeriesCreator;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static ru.ulstu.extractor.branch.model.Branch.GENERATED_BRANCH_ID;
|
||||
|
||||
@Service
|
||||
public class ScheduledTimeSeriesService {
|
||||
@ -25,7 +28,10 @@ public class ScheduledTimeSeriesService {
|
||||
@Scheduled(cron = "0 0 8 * * *")
|
||||
public void addTimeSeriesPoints() {
|
||||
log.info("Старт добавления новых точек временного ряда");
|
||||
List<Branch> branches = branchService.findAll();
|
||||
List<Branch> branches = branchService.findAll()
|
||||
.stream()
|
||||
.filter(b -> !b.getId().equals(GENERATED_BRANCH_ID))
|
||||
.collect(Collectors.toList());
|
||||
branches.forEach(branch -> {
|
||||
scheduledTimeSeriesCreators.forEach(creator -> creator.addTimeSeriesValue(branch));
|
||||
});
|
||||
|
@ -46,4 +46,15 @@
|
||||
|
||||
</sql>
|
||||
</changeSet>
|
||||
<changeSet author="orion" id="20240510-210000-1">
|
||||
<insert tableName="git_repository">
|
||||
<column name="id">1</column>
|
||||
<column name="url">Генерированный репозиторий</column>
|
||||
</insert>
|
||||
<insert tableName="branch">
|
||||
<column name="id">1</column>
|
||||
<column name="name">Сгенерированные показатели</column>
|
||||
<column name="git_repository_id">1</column>
|
||||
</insert>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
Loading…
Reference in New Issue
Block a user