66-derivation-of-rules #67

Merged
romanov73 merged 1 commits from 66-derivation-of-rules into master 2022-10-14 11:29:16 +04:00
6 changed files with 68 additions and 12 deletions
Showing only changes of commit 2e18e34647 - Show all commits

View File

@ -16,6 +16,7 @@ public class Route {
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
public static final String FILTER_COMMITS = "filterCommits";
public static final String STATISTIC = "statistic";
public static final String LIST_RULE = "listRules";
public static String getLIST_INDEXED_REPOSITORIES() {
return LIST_INDEXED_REPOSITORIES;

View File

@ -0,0 +1,25 @@
package ru.ulstu.extractor.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import ru.ulstu.extractor.service.RuleService;
import springfox.documentation.annotations.ApiIgnore;
import static ru.ulstu.extractor.controller.Route.LIST_RULE;
@Controller
@ApiIgnore
public class RuleController {
private RuleService ruleService;
public RuleController(RuleService ruleService) {
this.ruleService = ruleService;
}
@GetMapping(LIST_RULE)
public String getList(Model model) {
model.addAttribute("rules", ruleService.getList());
return LIST_RULE;
}
}

View File

@ -31,11 +31,11 @@ public class Rule extends BaseEntity {
this.consequent = consequent;
}
public AntecedentValue getFirstValue() {
public AntecedentValue getFirstAntecedentValue() {
return firstAntecedentValue;
}
public void setFirstValue(AntecedentValue firstAntecedentValue) {
public void setFirstAntecedentValue(AntecedentValue firstAntecedentValue) {
this.firstAntecedentValue = firstAntecedentValue;
}
@ -47,11 +47,11 @@ public class Rule extends BaseEntity {
this.firstAntecedent = firstAntecedent;
}
public AntecedentValue getSecondValue() {
public AntecedentValue getSecondAntecedentValue() {
return secondAntecedentValue;
}
public void setSecondValue(AntecedentValue secondAntecedentValue) {
public void setSecondAntecedentValue(AntecedentValue secondAntecedentValue) {
this.secondAntecedentValue = secondAntecedentValue;
}

View File

@ -0,0 +1,7 @@
package ru.ulstu.extractor.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.ulstu.extractor.model.Rule;
public interface RuleRepository extends JpaRepository<Rule, Integer> {
}

View File

@ -0,0 +1,20 @@
package ru.ulstu.extractor.service;
import org.springframework.stereotype.Service;
import ru.ulstu.extractor.model.Rule;
import ru.ulstu.extractor.repository.RuleRepository;
import java.util.List;
@Service
public class RuleService {
private final RuleRepository ruleRepository;
public RuleService(RuleRepository ruleRepository) {
this.ruleRepository = ruleRepository;
}
public List<Rule> getList() {
return ruleRepository.findAll();
}
}

View File

@ -1,6 +1,6 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
layout:decorate="~{default}">
<head>
<title>Простая обработка формы на Spring MVC</title>
@ -10,16 +10,19 @@
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th scope="col">Правила</th>
<th width="10%"></th>
<th scope="col" colspan="8">Правила</th>
</tr>
</thead>
<tbody>
<tr>
<td>Если задач много, а коммитов мало, то увеличить колличество авторов</td>
</tr>
<tr>
<td>Если авторов много, задач мало, оценнить эффективность авторов</td>
<tr th:each="rule: ${rules}">
<td><span class="badge badge-info">Если</span></td>
<td><span class="badge badge-success" th:text="${rule.firstAntecedent.name}"></span></td>
<td><span class="badge badge-success" th:text="${rule.firstAntecedentValue.antecedentValue}"></span></td>
<td><span class="badge badge-info">и</span></td>
<td><span class="badge badge-success" th:text="${rule.secondAntecedent.name}"></span></td>
<td><span class="badge badge-success" th:text="${rule.secondAntecedentValue.antecedentValue}"></span></td>
<td><span class="badge badge-info">то</span></td>
<td><span class="badge badge-warning" th:text="${rule.consequent}"></span></td>
</tr>
</tbody>
</table>