|
|
|
@ -2,11 +2,7 @@ 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.RequestParam;
|
|
|
|
|
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;
|
|
|
|
@ -15,9 +11,7 @@ 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.DELETE_RULE;
|
|
|
|
|
import static ru.ulstu.extractor.core.Route.LIST_RULE;
|
|
|
|
|
import static ru.ulstu.extractor.core.Route.*;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
@ApiIgnore
|
|
|
|
@ -46,12 +40,7 @@ public class RuleController {
|
|
|
|
|
public String getAntecedent(Model model, @RequestParam(required = false) Integer ruleId) {
|
|
|
|
|
model.addAttribute("antecedentValues", antecedentValueService.getList());
|
|
|
|
|
model.addAttribute("antecedents", timeSeriesService.getAllTimeSeriesTypes());
|
|
|
|
|
model.addAttribute("addRuleForm",
|
|
|
|
|
ruleId != null
|
|
|
|
|
? new AddRuleForm(ruleRepository
|
|
|
|
|
.findById(ruleId)
|
|
|
|
|
.orElseThrow(() -> new RuntimeException("Правило не найдено")))
|
|
|
|
|
: new AddRuleForm());
|
|
|
|
|
model.addAttribute("addRuleForm", ruleService.getAddRuleFormOrDefault(ruleId));
|
|
|
|
|
return ADD_RULE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -67,19 +56,4 @@ public class RuleController {
|
|
|
|
|
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();
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|