#2 - add new filter
parent
3de5950389
commit
97b3762c78
@ -1,15 +1,17 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.controller;
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.ulstu.extractor.model.Commit;
|
||||
import ru.ulstu.extractor.service.GitRepositoryService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static ru.ulstu.extractor.RepoController.URL;
|
||||
import static ru.ulstu.extractor.controller.RepoController.URL;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(URL)
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
public class LineChange {
|
||||
private boolean added;
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import org.eclipse.jgit.diff.DiffEntry;
|
||||
import org.eclipse.jgit.diff.DiffFormatter;
|
@ -0,0 +1,32 @@
|
||||
package ru.ulstu.extractor.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.extractor.model.Commit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class FilteringService {
|
||||
|
||||
private final GitRepositoryService gitRepositoryService;
|
||||
|
||||
public FilteringService(GitRepositoryService gitRepositoryService) {
|
||||
this.gitRepositoryService = gitRepositoryService;
|
||||
}
|
||||
|
||||
public List<Commit> getCommits(String urlRepo) {
|
||||
return getCommits(urlRepo, null);
|
||||
}
|
||||
|
||||
public List<Commit> getCommits(String urlRepo, String filterCommitMessage) {
|
||||
if (filterCommitMessage != null) {
|
||||
return getCommits(urlRepo)
|
||||
.stream()
|
||||
.filter(commit -> commit.getMessage().contains(filterCommitMessage))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
return getCommits(urlRepo);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||
<html xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
<title>Простая обработка формы на Spring MVC</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<h1>Форма</h1>
|
||||
<form action="#" th:action="@{/sendEmail}" th:object="${emailForm}" method="post">
|
||||
<p style="color:red" th:text="${error}"></p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Тема:</td>
|
||||
<td><input type="text" th:field="*{subject}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Кому:</td>
|
||||
<td><input type="text" th:field="*{to}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Сообщение:</td>
|
||||
<td><textarea th:field="*{message}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><input type="submit" value="Отправить"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
Loading…
Reference in New Issue