|
|
|
@ -2,19 +2,16 @@ package ru.ulstu.extractor.rule.controller;
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
import ru.ulstu.extractor.rule.model.AddRuleForm;
|
|
|
|
|
import ru.ulstu.extractor.rule.repository.RuleRepository;
|
|
|
|
|
import ru.ulstu.extractor.rule.service.AntecedentValueService;
|
|
|
|
|
import ru.ulstu.extractor.rule.service.RuleService;
|
|
|
|
|
import ru.ulstu.extractor.ts.service.TimeSeriesService;
|
|
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
|
|
|
|
import static ru.ulstu.extractor.core.Route.ADD_RULE;
|
|
|
|
|
import static ru.ulstu.extractor.core.Route.LIST_RULE;
|
|
|
|
|
import static ru.ulstu.extractor.core.Route.*;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
@ApiIgnore
|
|
|
|
@ -22,13 +19,15 @@ public class RuleController {
|
|
|
|
|
private final RuleService ruleService;
|
|
|
|
|
private final AntecedentValueService antecedentValueService;
|
|
|
|
|
private final TimeSeriesService timeSeriesService;
|
|
|
|
|
private final RuleRepository ruleRepository;
|
|
|
|
|
|
|
|
|
|
public RuleController(RuleService ruleService,
|
|
|
|
|
AntecedentValueService antecedentValueService,
|
|
|
|
|
TimeSeriesService timeSeriesService) {
|
|
|
|
|
TimeSeriesService timeSeriesService, RuleRepository ruleRepository) {
|
|
|
|
|
this.ruleService = ruleService;
|
|
|
|
|
this.antecedentValueService = antecedentValueService;
|
|
|
|
|
this.timeSeriesService = timeSeriesService;
|
|
|
|
|
this.ruleRepository = ruleRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(LIST_RULE)
|
|
|
|
@ -50,4 +49,27 @@ public class RuleController {
|
|
|
|
|
ruleService.saveRule(ruleForm);
|
|
|
|
|
return "redirect:/" + LIST_RULE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(DELETE_RULE)
|
|
|
|
|
public String deleteRule(Model model,
|
|
|
|
|
@RequestParam Integer id) {
|
|
|
|
|
ruleRepository.deleteById(id);
|
|
|
|
|
model.addAttribute("rule", ruleRepository.findAll());
|
|
|
|
|
return "redirect:/" + LIST_RULE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @RequestMapping(value = FILTER_COMMITS, method = RequestMethod.GET)
|
|
|
|
|
// public String editRule(Model model,
|
|
|
|
|
// @RequestParam Optional<Integer> firstAntecedentValueId,
|
|
|
|
|
// @RequestParam Optional<String > firstAntecedentId,
|
|
|
|
|
// @RequestParam Optional<Integer> secondAntecedentValueId,
|
|
|
|
|
// @RequestParam Optional<String> secondAntecedentId,
|
|
|
|
|
// @RequestParam Optional<String> consequent){
|
|
|
|
|
// AddRuleForm addRuleForm = new AddRuleForm();
|
|
|
|
|
// addRuleForm.setFirstAntecedentId(firstAntecedentValueId.);
|
|
|
|
|
// addRuleForm.setFirstAntecedentValueId();
|
|
|
|
|
// addRuleForm.setSecondAntecedentId();
|
|
|
|
|
// addRuleForm.setSecondAntecedentValueId();
|
|
|
|
|
// addRuleForm.setConsequent();
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|