From f5b30b11fa7b6aba9bdf8f95589312acc8f83ea8 Mon Sep 17 00:00:00 2001
From: Struchkov Mark
Date: Fri, 28 Jan 2022 21:55:50 +0300
Subject: [PATCH] =?UTF-8?q?=D0=91=D0=BE=D0=BB=D1=8C=D1=88=D0=BE=D0=B9=20?=
=?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?=
=?UTF-8?q?=D0=B3=202?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../bot/gitlab/context/domain/AppLocale.java | 2 +-
.../context/domain/MergeRequestState.java | 1 -
.../context/domain/PersonInformation.java | 2 -
.../gitlab/context/domain/PipelineStatus.java | 2 -
.../context/domain/entity/AppSetting.java | 2 +-
.../context/domain/entity/Discussion.java | 2 -
.../domain/entity/MergeRequestMini.java | 2 -
.../gitlab/context/domain/entity/Person.java | 2 -
.../context/domain/entity/Pipeline.java | 2 -
.../gitlab/context/domain/entity/Project.java | 2 -
.../context/domain/filter/PipelineFilter.java | 3 +-
.../domain/notify/GoodMorningNotify.java | 24 ++----
.../domain/notify/NewProjectNotify.java | 19 ++---
.../domain/notify/SimpleTextNotify.java | 11 +--
.../domain/notify/comment/CommentNotify.java | 21 ++---
.../notify/pipeline/PipelineNotify.java | 33 ++------
.../domain/notify/task/TaskCloseNotify.java | 2 -
.../domain/notify/task/TaskNewNotify.java | 2 -
.../context/exception/GitlabBotException.java | 15 ----
.../repository/AppSettingRepository.java | 2 -
.../repository/DiscussionRepository.java | 5 +-
.../context/repository/NoteRepository.java | 2 -
.../context/repository/PersonRepository.java | 2 -
.../repository/PipelineRepository.java | 4 +-
.../context/repository/ProjectRepository.java | 2 -
.../context/service/AppSettingService.java | 23 ++++-
.../gitlab/context/service/CleanService.java | 13 ++-
.../context/service/DiscussionService.java | 11 ++-
.../gitlab/context/service/PersonService.java | 2 -
.../context/service/PipelineService.java | 2 +-
.../context/service/ProjectService.java | 2 -
.../core/config/properties/AppProperty.java | 2 +-
.../config/properties/PersonProperty.java | 2 -
.../convert/DiscussionJsonConverter.java | 4 -
.../convert/MergeRequestJsonConverter.java | 2 -
.../core/service/convert/NoteJsonConvert.java | 2 -
.../service/convert/PersonJsonConverter.java | 2 -
.../convert/PipelineJsonConverter.java | 2 -
.../service/convert/ProjectJsonConverter.java | 2 -
.../service/impl/AppSettingServiceImpl.java | 27 +++---
.../core/service/impl/CleanServiceImpl.java | 11 ++-
.../service/impl/DiscussionServiceImpl.java | 43 ++++++----
.../core/service/impl/PersonServiceImpl.java | 2 -
.../service/impl/PipelineServiceImpl.java | 46 ++++------
.../core/service/impl/ProjectServiceImpl.java | 24 +++---
.../impl/filter/PipelineFilterService.java | 2 +-
.../core/service/parser/DiscussionParser.java | 83 ++++++++++---------
.../core/service/parser/PipelineParser.java | 8 +-
.../core/service/parser/ProjectParser.java | 18 ++--
.../bot/gitlab/core/utils/StringUtils.java | 2 +-
.../data/impl/AppSettingRepositoryImpl.java | 2 -
.../data/impl/DiscussionRepositoryImpl.java | 2 -
.../gitlab/data/impl/NoteRepositoryImpl.java | 1 -
.../data/impl/PersonRepositoryImpl.java | 2 -
.../data/impl/PipelineRepositoryImpl.java | 2 -
.../data/impl/ProjectRepositoryImpl.java | 2 -
.../data/jpa/AppSettingJpaRepository.java | 2 -
.../data/jpa/DiscussionJpaRepository.java | 5 +-
.../gitlab/data/jpa/PersonJpaRepository.java | 2 -
.../data/jpa/PipelineJpaRepository.java | 2 -
.../gitlab/data/jpa/ProjectJpaRepository.java | 2 -
.../app/scheduler/SchedulerService.java | 4 +-
.../bot/gitlab/sdk/domain/CommitJson.java | 2 -
.../bot/gitlab/sdk/domain/DiscussionJson.java | 2 -
.../gitlab/sdk/domain/MergeRequestJson.java | 2 -
.../sdk/domain/MergeRequestStateJson.java | 2 -
.../bot/gitlab/sdk/domain/PersonJson.java | 2 -
.../bot/gitlab/sdk/domain/PipelineJson.java | 2 -
.../gitlab/sdk/domain/PipelineStatusJson.java | 2 -
.../bot/gitlab/sdk/domain/ProjectJson.java | 2 -
.../bot/gitlab/sdk/domain/Sheet.java | 25 ------
.../bot/gitlab/sdk/domain/UserJson.java | 2 -
.../LocalDateTimeFromEpochDeserializer.java | 26 ------
.../telegram/config/TelegramBotConfig.java | 2 -
.../service/MessageSendTelegramService.java | 2 +-
.../telegram/service/ReplaceUrlLocalhost.java | 2 +-
.../gitlab/telegram/service/StartNotify.java | 2 -
.../telegram/service/unit/TaskProcessing.java | 14 ++--
.../PullRequestNeedWorkProcessing.java | 2 -
.../PullRequestReviewProcessing.java | 2 -
.../bot/gitlab/telegram/unit/MenuConfig.java | 25 +++---
.../bot/gitlab/telegram/unit/UnitConfig.java | 21 ++---
.../unit/menu/MenuSettingsConfig.java | 7 +-
83 files changed, 259 insertions(+), 420 deletions(-)
delete mode 100644 bot-context/src/main/java/dev/struchkov/bot/gitlab/context/exception/GitlabBotException.java
delete mode 100644 gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/Sheet.java
delete mode 100644 gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/utils/LocalDateTimeFromEpochDeserializer.java
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/AppLocale.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/AppLocale.java
index d6ef2f1..f4821de 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/AppLocale.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/AppLocale.java
@@ -9,7 +9,7 @@ import java.util.Arrays;
import java.util.Locale;
/**
- * // TODO: 16.01.2021 Добавить описание.
+ * Список локализаций приложения.
*
* @author upagge 16.01.2021
*/
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/MergeRequestState.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/MergeRequestState.java
index ddd1c69..65778c3 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/MergeRequestState.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/MergeRequestState.java
@@ -1,7 +1,6 @@
package dev.struchkov.bot.gitlab.context.domain;
/**
- * // TODO: 14.01.2021 Добавить описание.
*
* @author upagge 14.01.2021
*/
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PersonInformation.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PersonInformation.java
index f456fe9..362753e 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PersonInformation.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PersonInformation.java
@@ -4,8 +4,6 @@ import lombok.Getter;
import lombok.Setter;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
@Getter
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PipelineStatus.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PipelineStatus.java
index 5e6f701..39458f5 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PipelineStatus.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/PipelineStatus.java
@@ -1,8 +1,6 @@
package dev.struchkov.bot.gitlab.context.domain;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
public enum PipelineStatus {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/AppSetting.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/AppSetting.java
index 64e6d6a..9a6ba7a 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/AppSetting.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/AppSetting.java
@@ -13,7 +13,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
/**
- * // TODO: 16.01.2021 Добавить описание.
+ * Основные настройки приложения.
*
* @author upagge 16.01.2021
*/
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Discussion.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Discussion.java
index c896ffb..e8f4638 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Discussion.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Discussion.java
@@ -18,8 +18,6 @@ import javax.persistence.Table;
import java.util.List;
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
@Getter
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/MergeRequestMini.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/MergeRequestMini.java
index e5dc7eb..612263d 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/MergeRequestMini.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/MergeRequestMini.java
@@ -12,8 +12,6 @@ import javax.persistence.Id;
import javax.persistence.Table;
/**
- * // TODO: 12.09.2020 Добавить описание.
- *
* @author upagge 12.09.2020
*/
@Getter
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Person.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Person.java
index cb69c93..5b26571 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Person.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Person.java
@@ -10,8 +10,6 @@ import javax.persistence.Id;
import javax.persistence.Table;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Entity
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java
index f354b43..83f9ffe 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java
@@ -17,8 +17,6 @@ import javax.persistence.Table;
import java.time.LocalDateTime;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java
index 6c68bf3..196cc7e 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java
@@ -12,8 +12,6 @@ import javax.persistence.Table;
import java.time.LocalDateTime;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Getter
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/filter/PipelineFilter.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/filter/PipelineFilter.java
index 8eb245a..7840da2 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/filter/PipelineFilter.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/filter/PipelineFilter.java
@@ -1,5 +1,6 @@
package dev.struchkov.bot.gitlab.context.domain.filter;
+import dev.struchkov.bot.gitlab.context.domain.entity.Pipeline;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -10,7 +11,7 @@ import lombok.Setter;
import java.time.LocalDateTime;
/**
- * // TODO: 08.02.2021 Добавить описание.
+ * Объект фильтра для {@link Pipeline}.
*
* @author upagge 08.02.2021
*/
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java
index 3f30bc9..acc9539 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java
@@ -5,7 +5,6 @@ import dev.struchkov.bot.gitlab.context.service.AppSettingService;
import dev.struchkov.bot.gitlab.context.utils.MessageUtils;
import dev.struchkov.bot.gitlab.context.utils.Smile;
import lombok.Builder;
-import lombok.Getter;
import java.util.List;
@@ -14,28 +13,17 @@ import java.util.List;
*
* @author upagge 20.09.2020
*/
-@Getter
//TODO [28.01.2022]: Решить доработать и оставить или удалить.
-public class GoodMorningNotify implements Notify {
+public record GoodMorningNotify(
+ List mergeRequestsReviews,
+ List mergeRequestsNeedWork,
+ String personName, String version
+) implements Notify {
private static final Integer PR_COUNT = 4;
- private final List mergeRequestsReviews;
- private final List mergeRequestsNeedWork;
- private final String personName;
- private final String version;
-
@Builder
- protected GoodMorningNotify(
- List mergeRequestsReviews,
- List mergeRequestsNeedWork,
- String personName,
- String version
- ) {
- this.mergeRequestsReviews = mergeRequestsReviews;
- this.mergeRequestsNeedWork = mergeRequestsNeedWork;
- this.personName = personName;
- this.version = version;
+ public GoodMorningNotify {
}
@Override
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/NewProjectNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/NewProjectNotify.java
index 364cc24..524247c 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/NewProjectNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/NewProjectNotify.java
@@ -8,23 +8,18 @@ import lombok.Builder;
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
-public class NewProjectNotify implements Notify {
- private final String projectName;
- private final String projectUrl;
- private final String projectDescription;
- private final String authorName;
+public record NewProjectNotify(
+ String projectName,
+ String projectUrl,
+ String projectDescription,
+ String authorName
+) implements Notify {
@Builder
- public NewProjectNotify(String projectName, String projectUrl, String projectDescription, String authorName) {
- this.projectName = projectName;
- this.projectUrl = projectUrl;
- this.projectDescription = projectDescription;
- this.authorName = authorName;
+ public NewProjectNotify {
}
@Override
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/SimpleTextNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/SimpleTextNotify.java
index b0398e0..dd81239 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/SimpleTextNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/SimpleTextNotify.java
@@ -2,21 +2,14 @@ package dev.struchkov.bot.gitlab.context.domain.notify;
import dev.struchkov.bot.gitlab.context.service.AppSettingService;
import lombok.Builder;
-import lombok.Getter;
/**
- * // TODO: 20.09.2020 Добавить описание.
- *
* @author upagge 20.09.2020
*/
-@Getter
-public class SimpleTextNotify implements Notify {
-
- private final String message;
+public record SimpleTextNotify(String message) implements Notify {
@Builder
- private SimpleTextNotify(String message) {
- this.message = message;
+ public SimpleTextNotify {
}
@Override
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/comment/CommentNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/comment/CommentNotify.java
index 63f3205..1ec4191 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/comment/CommentNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/comment/CommentNotify.java
@@ -4,26 +4,17 @@ import dev.struchkov.bot.gitlab.context.domain.notify.Notify;
import dev.struchkov.bot.gitlab.context.service.AppSettingService;
import dev.struchkov.bot.gitlab.context.utils.Smile;
import lombok.Builder;
-import lombok.Getter;
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
-@Getter
-public class CommentNotify implements Notify {
-
- private final String authorName;
- private final String message;
- private final String url;
+public record CommentNotify(
+ String url,
+ String authorName,
+ String message
+) implements Notify {
@Builder
- private CommentNotify(
- String url,
- String authorName,
- String message
- ) {
- this.authorName = authorName;
- this.message = message;
- this.url = url;
+ public CommentNotify {
}
@Override
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java
index b7689f9..99f0a63 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java
@@ -10,34 +10,19 @@ import java.text.MessageFormat;
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
-public class PipelineNotify implements Notify {
-
- private final Long pipelineId;
- private final String projectName;
- private final String refName;
- private final String newStatus;
- private final String webUrl;
- private String oldStatus = "n/a";
+public record PipelineNotify(
+ Long pipelineId,
+ String projectName,
+ String refName,
+ String oldStatus,
+ String newStatus,
+ String webUrl
+) implements Notify {
@Builder
- public PipelineNotify(
- Long pipelineId,
- String projectName,
- String refName,
- String oldStatus,
- String newStatus,
- String webUrl
- ) {
- this.pipelineId = pipelineId;
- this.projectName = projectName;
- this.refName = refName;
- this.oldStatus = oldStatus;
- this.newStatus = newStatus;
- this.webUrl = webUrl;
+ public PipelineNotify {
}
@Override
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskCloseNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskCloseNotify.java
index 7b35f34..b4bfb28 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskCloseNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskCloseNotify.java
@@ -7,8 +7,6 @@ import lombok.Builder;
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
/**
- * // TODO: 10.09.2020 Добавить описание.
- *
* @author upagge 10.09.2020
*/
public class TaskCloseNotify extends TaskNotify {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskNewNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskNewNotify.java
index 6819867..2f56056 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskNewNotify.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/task/TaskNewNotify.java
@@ -8,8 +8,6 @@ import lombok.Getter;
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
/**
- * // TODO: 10.09.2020 Добавить описание.
- *
* @author upagge 10.09.2020
*/
@Getter
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/exception/GitlabBotException.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/exception/GitlabBotException.java
deleted file mode 100644
index 4dfae27..0000000
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/exception/GitlabBotException.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package dev.struchkov.bot.gitlab.context.exception;
-
-import dev.struchkov.haiti.context.exception.BasicException;
-
-abstract class GitlabBotException extends BasicException {
-
- public GitlabBotException(String message) {
- super(message);
- }
-
- public GitlabBotException(String message, Throwable throwable) {
- super(message, throwable);
- }
-
-}
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/AppSettingRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/AppSettingRepository.java
index 3613e7a..5fba2ef 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/AppSettingRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/AppSettingRepository.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.AppSetting;
import dev.struchkov.haiti.context.repository.SimpleManagerRepository;
/**
- * // TODO: 16.01.2021 Добавить описание.
- *
* @author upagge 16.01.2021
*/
public interface AppSettingRepository extends SimpleManagerRepository {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/DiscussionRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/DiscussionRepository.java
index 729fedb..4bad62d 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/DiscussionRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/DiscussionRepository.java
@@ -7,12 +7,13 @@ import lombok.NonNull;
import java.util.List;
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
public interface DiscussionRepository extends SimpleManagerRepository {
+ /**
+ * Вернуть все дискусии для MR
+ */
List findAllByMergeRequestId(@NonNull Long mergeRequestId);
}
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/NoteRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/NoteRepository.java
index 809ae10..940b41a 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/NoteRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/NoteRepository.java
@@ -9,8 +9,6 @@ import lombok.NonNull;
import java.util.List;
/**
- * // TODO: 08.09.2020 Добавить описание.
- *
* @author upagge 08.09.2020
*/
public interface NoteRepository extends SimpleManagerRepository {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PersonRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PersonRepository.java
index 2ab4e74..70897ec 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PersonRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PersonRepository.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.Person;
import dev.struchkov.haiti.context.repository.SimpleManagerRepository;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
public interface PersonRepository extends SimpleManagerRepository {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PipelineRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PipelineRepository.java
index 89d4a39..a0b43c6 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PipelineRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/PipelineRepository.java
@@ -1,18 +1,16 @@
package dev.struchkov.bot.gitlab.context.repository;
+import dev.struchkov.bot.gitlab.context.domain.PipelineStatus;
import dev.struchkov.bot.gitlab.context.domain.entity.Pipeline;
import dev.struchkov.haiti.context.page.Pagination;
import dev.struchkov.haiti.context.page.Sheet;
import dev.struchkov.haiti.context.repository.SimpleManagerRepository;
import dev.struchkov.haiti.filter.FilterOperation;
import lombok.NonNull;
-import dev.struchkov.bot.gitlab.context.domain.PipelineStatus;
import java.util.Set;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
public interface PipelineRepository extends SimpleManagerRepository, FilterOperation {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java
index aae8e96..114935b 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.Project;
import dev.struchkov.haiti.context.repository.SimpleManagerRepository;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
public interface ProjectRepository extends SimpleManagerRepository {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/AppSettingService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/AppSettingService.java
index cf3bf90..ca06ffc 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/AppSettingService.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/AppSettingService.java
@@ -4,20 +4,41 @@ import dev.struchkov.bot.gitlab.context.domain.AppLocale;
import lombok.NonNull;
/**
- * // TODO: 16.01.2021 Добавить описание.
+ * Сервис отвечает за пользовательские настройки приложения.
*
* @author upagge 16.01.2021
*/
public interface AppSettingService {
+ /**
+ * Метод позволяет проверить запускается ли приложение впервые.
+ *
+ * @return true - если это первый запуск
+ */
boolean isFirstStart();
+ /**
+ * Метод отмечает, что приложение было запущено.
+ *
+ * @see AppSettingService#isFirstStart()
+ */
void disableFirstStart();
+ /**
+ * Позволяет получить по ключу текст на языке, который установил пользователь
+ *
+ * @param label ключ сообщений
+ * @return Сообщение на языке пользователя
+ */
String getMessage(@NonNull String label);
String getMessage(@NonNull String label, Object... params);
+ /**
+ * Устанавливает язык приложения
+ *
+ * @param appLocale Язык, который необходимо установить
+ */
void setLocale(@NonNull AppLocale appLocale);
}
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/CleanService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/CleanService.java
index 7361eee..98d386c 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/CleanService.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/CleanService.java
@@ -1,14 +1,23 @@
package dev.struchkov.bot.gitlab.context.service;
/**
- * // TODO: 08.02.2021 Добавить описание.
+ * Контракт очистки хранилища.
+ * Так как все что мы получаем от гитлаба сохраняется в БД, иногда нужно удалять устаревшие данные. Например, MR, которые уже были давно вмержены.
*
* @author upagge 08.02.2021
*/
public interface CleanService {
- void cleanMergedPullRequests();
+ /**
+ * Удаляет старые MR.
+ * По умолчанию старыми считаются те, которые закрыты или вмержены
+ */
+ void cleanOldMergedRequests();
+ /**
+ * Удаляет старые пайплайны
+ * По умолчанию удаляет все пайплайны старше суток
+ */
void cleanOldPipelines();
}
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/DiscussionService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/DiscussionService.java
index aa73433..b1dc6bf 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/DiscussionService.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/DiscussionService.java
@@ -7,14 +7,21 @@ import lombok.NonNull;
import java.util.List;
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
public interface DiscussionService extends SimpleManagerService {
+ /**
+ * Метод отправляющий коментарий в дискуссию.
+ *
+ * @param discussionId Идентификатор дискуссии
+ * @param text Текст комментария
+ */
void answer(@NonNull String discussionId, @NonNull String text);
+ /**
+ * Получить все дискусси для MR.
+ */
List getAllByMergeRequestId(@NonNull Long mergeRequestId);
}
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PersonService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PersonService.java
index 1a2c66e..ef59913 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PersonService.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PersonService.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.Person;
import dev.struchkov.haiti.context.service.SimpleManagerService;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
public interface PersonService extends SimpleManagerService {
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PipelineService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PipelineService.java
index 2e8ed23..6410855 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PipelineService.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/PipelineService.java
@@ -12,7 +12,7 @@ import lombok.NonNull;
import java.util.Set;
/**
- * // TODO: 17.01.2021 Добавить описание.
+ * Сервис для работы с пайплайнами
*
* @author upagge 17.01.2021
*/
diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java
index 08ff445..b6ffd59 100644
--- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java
+++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.Project;
import dev.struchkov.haiti.context.service.SimpleManagerService;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
public interface ProjectService extends SimpleManagerService {
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/AppProperty.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/AppProperty.java
index f2b480c..b8f8cb3 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/AppProperty.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/AppProperty.java
@@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
- * // TODO: 11.10.2020 Добавить описание.
+ * Основные настройки приложения.
*
* @author upagge 11.10.2020
*/
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/PersonProperty.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/PersonProperty.java
index caca96d..6a66c86 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/PersonProperty.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/config/properties/PersonProperty.java
@@ -6,8 +6,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/DiscussionJsonConverter.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/DiscussionJsonConverter.java
index e98c558..abba232 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/DiscussionJsonConverter.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/DiscussionJsonConverter.java
@@ -6,11 +6,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
-import java.util.stream.Collectors;
-
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
@Component
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/MergeRequestJsonConverter.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/MergeRequestJsonConverter.java
index c89fcbf..804aac2 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/MergeRequestJsonConverter.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/MergeRequestJsonConverter.java
@@ -10,8 +10,6 @@ import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
@Component
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/NoteJsonConvert.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/NoteJsonConvert.java
index 3f256a3..c09c003 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/NoteJsonConvert.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/NoteJsonConvert.java
@@ -7,8 +7,6 @@ import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
/**
- * // TODO: 12.09.2020 Добавить описание.
- *
* @author upagge 12.09.2020
*/
@Component
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PersonJsonConverter.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PersonJsonConverter.java
index bc88406..0761f85 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PersonJsonConverter.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PersonJsonConverter.java
@@ -6,8 +6,6 @@ import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
@Component
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PipelineJsonConverter.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PipelineJsonConverter.java
index d6d839c..f636080 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PipelineJsonConverter.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/PipelineJsonConverter.java
@@ -21,8 +21,6 @@ import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.SUCCESS;
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.WAITING_FOR_RESOURCE;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
@Component
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java
index 751bf1f..585968b 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java
@@ -6,8 +6,6 @@ import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Component
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/AppSettingServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/AppSettingServiceImpl.java
index 5336e59..fca7932 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/AppSettingServiceImpl.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/AppSettingServiceImpl.java
@@ -15,7 +15,7 @@ import java.util.Locale;
import java.util.function.Supplier;
/**
- * // TODO: 16.01.2021 Добавить описание.
+ * Сервис отвечает за пользовательские настройки приложения.
*
* @author upagge 16.01.2021
*/
@@ -31,26 +31,20 @@ public class AppSettingServiceImpl implements AppSettingService {
@Override
public boolean isFirstStart() {
- return appSettingRepository.findById(KEY)
- .orElseThrow(NOT_FOUND_SETTINGS)
- .isFirstStart();
+ return getAppSetting().isFirstStart();
}
@Override
public void disableFirstStart() {
- final AppSetting appSetting = appSettingRepository.findById(KEY).orElseThrow(NOT_FOUND_SETTINGS);
+ final AppSetting appSetting = getAppSetting();
appSetting.setFirstStart(false);
appSettingRepository.save(appSetting);
}
@Override
public String getMessage(@NonNull String label) {
- final Locale value = appSettingRepository.findById(KEY)
- .orElseThrow(NOT_FOUND_SETTINGS)
- .getAppLocale().getValue();
- return messageSource.getMessage(
- label, null, value
- );
+ final Locale value = getAppSetting().getAppLocale().getValue();
+ return messageSource.getMessage(label, null, value);
}
@Override
@@ -59,17 +53,20 @@ public class AppSettingServiceImpl implements AppSettingService {
return messageSource.getMessage(
label,
paramsArray,
- appSettingRepository.findById(KEY)
- .orElseThrow(NOT_FOUND_SETTINGS)
- .getAppLocale().getValue()
+ getAppSetting().getAppLocale().getValue()
);
}
@Override
public void setLocale(@NonNull AppLocale appLocale) {
- final AppSetting appSetting = appSettingRepository.findById(KEY).orElseThrow(NOT_FOUND_SETTINGS);
+ final AppSetting appSetting = getAppSetting();
appSetting.setAppLocale(appLocale);
appSettingRepository.save(appSetting);
}
+ private AppSetting getAppSetting() {
+ return appSettingRepository.findById(KEY)
+ .orElseThrow(NOT_FOUND_SETTINGS);
+ }
+
}
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java
index 6710448..c9a7fb4 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java
@@ -15,13 +15,12 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Set;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import static dev.struchkov.bot.gitlab.context.domain.MergeRequestState.CLOSED;
import static dev.struchkov.bot.gitlab.context.domain.MergeRequestState.MERGED;
/**
- * // TODO: 08.02.2021 Добавить описание.
+ * Реализация сервиса очистки данных.
*
* @author upagge 08.02.2021
*/
@@ -30,7 +29,7 @@ import static dev.struchkov.bot.gitlab.context.domain.MergeRequestState.MERGED;
public class CleanServiceImpl implements CleanService {
private static final int COUNT = 1000;
- private static final MergeRequestFilter CLEAN_FILTER = MergeRequestFilter.builder()
+ private static final MergeRequestFilter MR_CLEAN_FILTER = MergeRequestFilter.builder()
.states(Set.of(MERGED, CLOSED))
.build();
@@ -38,9 +37,9 @@ public class CleanServiceImpl implements CleanService {
private final PipelineService pipelineService;
@Override
- public void cleanMergedPullRequests() {
+ public void cleanOldMergedRequests() {
int page = 0;
- Sheet mergeRequestSheet = mergeRequestsService.getAll(CLEAN_FILTER, PaginationImpl.of(page, COUNT));
+ Sheet mergeRequestSheet = mergeRequestsService.getAll(MR_CLEAN_FILTER, PaginationImpl.of(page, COUNT));
while (mergeRequestSheet.hasContent()) {
final Set ids = mergeRequestSheet.getContent().stream()
@@ -49,7 +48,7 @@ public class CleanServiceImpl implements CleanService {
mergeRequestsService.deleteAllById(ids);
- mergeRequestSheet = mergeRequestsService.getAll(CLEAN_FILTER, PaginationImpl.of(++page, COUNT));
+ mergeRequestSheet = mergeRequestsService.getAll(MR_CLEAN_FILTER, PaginationImpl.of(++page, COUNT));
}
}
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java
index 7734fe3..32c6d87 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java
@@ -35,8 +35,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import static java.lang.Boolean.FALSE;
+
/**
- * // TODO: 11.02.2021 Добавить описание.
+ * Сервис для работы с дискуссиями.
*
* @author upagge 11.02.2021
*/
@@ -69,7 +71,7 @@ public class DiscussionServiceImpl extends AbstractSimpleManagerService personService.create(note.getAuthor()));
discussion.getNotes().forEach(this::notificationPersonal);
- discussion.getNotes().forEach(note -> notifyNewTask(note, discussion));
+ discussion.getNotes().forEach(note -> notifyNewNote(note, discussion));
final boolean resolved = discussion.getNotes().stream()
.allMatch(note -> note.isResolvable() && note.getResolved());
@@ -77,13 +79,11 @@ public class DiscussionServiceImpl extends AbstractSimpleManagerServiceУведомляет пользователя, если появился новый комментарий
+ */
+ private void notifyNewNote(Note note, Discussion discussion) {
+ if (isNeedNotifyNewNote(note, discussion)) {
notifyService.send(
TaskNewNotify.builder()
.authorName(note.getAuthor().getName())
@@ -94,22 +94,34 @@ public class DiscussionServiceImpl extends AbstractSimpleManagerService noteMap = oldDiscussion
+ final Map idAndNoteMap = oldDiscussion
.getNotes().stream()
.collect(Collectors.toMap(Note::getId, note -> note));
- final boolean inDiscussion = discussion.getNotes().stream()
+
+ // Пользователь участвовал в обсуждении
+ final boolean userParticipatedInDiscussion = discussion.getNotes().stream()
.anyMatch(note -> personInformation.getId().equals(note.getAuthor().getId()));
discussion.setMergeRequest(oldDiscussion.getMergeRequest());
discussion.setResponsible(oldDiscussion.getResponsible());
- discussion.getNotes().forEach(note -> updateNote(note, noteMap, inDiscussion));
+ discussion.getNotes().forEach(note -> updateNote(note, idAndNoteMap, userParticipatedInDiscussion));
+
final boolean resolved = discussion.getNotes().stream()
.allMatch(note -> note.isResolvable() && note.getResolved());
discussion.setResolved(resolved);
+
return discussionRepository.save(discussion);
}
@@ -205,9 +217,12 @@ public class DiscussionServiceImpl extends AbstractSimpleManagerService recipientsLogins = new HashSet<>();
+ final Matcher matcher = PATTERN.matcher(note.getBody());
+ final Set recipientsLogins = new HashSet<>();
while (matcher.find()) {
final String login = matcher.group(0).replace("@", "");
recipientsLogins.add(login);
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PersonServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PersonServiceImpl.java
index 6083ac1..f3383c3 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PersonServiceImpl.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PersonServiceImpl.java
@@ -8,8 +8,6 @@ import lombok.NonNull;
import org.springframework.stereotype.Service;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
@Service
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java
index d58729e..e3e2dfb 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java
@@ -2,6 +2,7 @@ package dev.struchkov.bot.gitlab.core.service.impl;
import dev.struchkov.bot.gitlab.context.domain.PersonInformation;
import dev.struchkov.bot.gitlab.context.domain.PipelineStatus;
+import dev.struchkov.bot.gitlab.context.domain.entity.Person;
import dev.struchkov.bot.gitlab.context.domain.entity.Pipeline;
import dev.struchkov.bot.gitlab.context.domain.filter.PipelineFilter;
import dev.struchkov.bot.gitlab.context.domain.notify.pipeline.PipelineNotify;
@@ -26,13 +27,14 @@ import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.SKIPPED;
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.SUCCESS;
/**
- * // TODO: 17.01.2021 Добавить описание.
+ * Реализация сервиса для работы с пайплайнами.
*
* @author upagge 17.01.2021
*/
@Service
public class PipelineServiceImpl extends AbstractSimpleManagerService implements PipelineService {
+ // Статусы пайплайнов, о которых нужно уведомить
private static final Set notificationStatus = Set.of(FAILED, SUCCESS, CANCELED, SKIPPED);
private final NotifyService notifyService;
@@ -61,12 +63,12 @@ public class PipelineServiceImpl extends AbstractSimpleManagerService getAllByStatuses(@NonNull Set statuses, @NonNull Pagination pagination) {
return pipelineRepository.findAllByStatuses(statuses, pagination);
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java
index f491009..6c972d6 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java
@@ -14,8 +14,6 @@ import lombok.NonNull;
import org.springframework.stereotype.Service;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Service
@@ -44,23 +42,27 @@ public class ProjectServiceImpl extends AbstractSimpleManagerService mergeRequestSheet = mergeRequestsService.getAll(PaginationImpl.of(page, COUNT));
while (mergeRequestSheet.hasContent()) {
-
- final List mergeRequests = mergeRequestSheet.getContent();
- for (MergeRequest mergeRequest : mergeRequests) {
-
- processingMergeRequest(mergeRequest);
-
- }
-
+ mergeRequestSheet.getContent()
+ .forEach(this::processingMergeRequest);
mergeRequestSheet = mergeRequestsService.getAll(PaginationImpl.of(++page, COUNT));
}
}
@@ -72,11 +71,11 @@ public class DiscussionParser {
}
private void createNewDiscussion(List discussionJson, MergeRequest mergeRequest) {
- final Set jsonIds = discussionJson.stream()
+ final Set discussionIds = discussionJson.stream()
.map(DiscussionJson::getId)
- .collect(Collectors.toSet());
+ .collect(Collectors.toUnmodifiableSet());
- final ExistsContainer existsContainer = discussionService.existsById(jsonIds);
+ final ExistsContainer existsContainer = discussionService.existsById(discussionIds);
if (!existsContainer.isAllFound()) {
final List newDiscussions = discussionJson.stream()
.filter(json -> existsContainer.getIdNoFound().contains(json.getId()))
@@ -84,12 +83,7 @@ public class DiscussionParser {
final Discussion discussion = conversionService.convert(json, Discussion.class);
discussion.setMergeRequest(mergeRequest);
discussion.setResponsible(mergeRequest.getAuthor());
- discussion.getNotes().forEach(
- note -> {
- final String url = MessageFormat.format(gitlabProperty.getUrlNote(), mergeRequest.getWebUrl(), note.getId());
- note.setWebUrl(url);
- }
- );
+ discussion.getNotes().forEach(createNoteLink(mergeRequest));
return discussion;
})
.filter(discussion -> discussion.getNotes() != null && !discussion.getNotes().isEmpty())
@@ -98,34 +92,25 @@ public class DiscussionParser {
}
}
- private List getDiscussionJson(MergeRequest mergeRequest, int page) {
- return HttpParse.request(MessageFormat.format(gitlabProperty.getUrlDiscussion(), mergeRequest.getProjectId(), mergeRequest.getTwoId(), page))
- .header(ACCEPT)
- .header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
- .executeList(DiscussionJson.class);
- }
-
+ /**
+ * Сканирование старых обсуждений на предмет новых комментарие
+ */
public void scanOldDiscussions() {
int page = 0;
- Sheet discussionSheet = discussionService.getAll(PaginationImpl.of(page, 100));
+ Sheet discussionSheet = discussionService.getAll(PaginationImpl.of(page, COUNT));
while (discussionSheet.hasContent()) {
final List discussions = discussionSheet.getContent();
for (Discussion discussion : discussions) {
if (discussion.getMergeRequest() != null) {
- final Optional optNewDiscussion = HttpParse.request(MessageFormat.format(gitlabProperty.getUrlOneDiscussion(), discussion.getMergeRequest().getProjectId(), discussion.getMergeRequest().getTwoId(), discussion.getId()))
+ final Optional optNewDiscussion = HttpParse.request(createLinkOldDiscussion(discussion))
.header(ACCEPT)
- .header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
+ .header(H_PRIVATE_TOKEN, personProperty.getToken())
.execute(DiscussionJson.class)
.map(json -> {
final Discussion newDiscussion = conversionService.convert(json, Discussion.class);
- newDiscussion.getNotes().forEach(
- note -> {
- final String url = MessageFormat.format(gitlabProperty.getUrlNote(), discussion.getMergeRequest().getWebUrl(), note.getId());
- note.setWebUrl(url);
- }
- );
+ newDiscussion.getNotes().forEach(createNoteLink(discussion.getMergeRequest()));
return newDiscussion;
});
optNewDiscussion.ifPresent(discussionService::update);
@@ -134,10 +119,32 @@ public class DiscussionParser {
}
}
- discussionSheet = discussionService.getAll(PaginationImpl.of(++page, 100));
+ discussionSheet = discussionService.getAll(PaginationImpl.of(++page, COUNT));
}
-
+ }
+
+ private String createLinkOldDiscussion(Discussion discussion) {
+ return MessageFormat.format(
+ gitlabProperty.getUrlOneDiscussion(),
+ discussion.getMergeRequest().getProjectId(),
+ discussion.getMergeRequest().getTwoId(),
+ discussion.getId()
+ );
+ }
+
+ private List getDiscussionJson(MergeRequest mergeRequest, int page) {
+ return HttpParse.request(MessageFormat.format(gitlabProperty.getUrlDiscussion(), mergeRequest.getProjectId(), mergeRequest.getTwoId(), page))
+ .header(ACCEPT)
+ .header(H_PRIVATE_TOKEN, personProperty.getToken())
+ .executeList(DiscussionJson.class);
+ }
+
+ private Consumer createNoteLink(MergeRequest mergeRequest) {
+ return note -> {
+ final String url = MessageFormat.format(gitlabProperty.getUrlNote(), mergeRequest.getWebUrl(), note.getId());
+ note.setWebUrl(url);
+ };
}
}
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java
index 4ffbc46..3ee6c08 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.CREATED;
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.MANUAL;
@@ -35,11 +34,10 @@ import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.WAITING_FOR
import static dev.struchkov.haiti.utils.network.HttpParse.ACCEPT;
/**
- * // TODO: 17.01.2021 Добавить описание.
+ * Парсер пайплайнов.
*
* @author upagge 17.01.2021
*/
-
@Service
@RequiredArgsConstructor
public class PipelineParser {
@@ -101,7 +99,7 @@ public class PipelineParser {
pipeline.setProject(project);
return pipeline;
})
- .orElseThrow(() -> new ConvertException("Ошибка обновления Pipelines"));
+ .orElseThrow(ConvertException.supplier("Ошибка обновления Pipelines"));
pipelineService.create(newPipeline);
}
@@ -136,7 +134,7 @@ public class PipelineParser {
.header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
.execute(PipelineJson.class)
.map(json -> conversionService.convert(json, Pipeline.class))
- .orElseThrow(() -> new ConvertException("Ошибка обновления Pipelines"));
+ .orElseThrow(ConvertException.supplier("Ошибка обновления Pipelines"));
pipelineService.update(newPipeline);
}
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java
index 7cbdb37..3b70c68 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java
@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
import static dev.struchkov.haiti.utils.network.HttpParse.ACCEPT;
/**
- * // TODO: 14.01.2021 Добавить описание.
+ * Парсер проектов.
*
* @author upagge 14.01.2021
*/
@@ -60,13 +60,13 @@ public class ProjectParser {
while (!projectJsons.isEmpty()) {
- final Set jsonIds = projectJsons.stream()
+ final Set projectIds = projectJsons.stream()
.map(ProjectJson::getId)
- .collect(Collectors.toSet());
+ .collect(Collectors.toUnmodifiableSet());
createNewPersons(projectJsons);
- final ExistsContainer existsContainer = projectService.existsById(jsonIds);
+ final ExistsContainer existsContainer = projectService.existsById(projectIds);
final List newProjects = projectJsons.stream()
.filter(json -> existsContainer.getIdNoFound().contains(json.getId()))
.map(json -> conversionService.convert(json, Project.class))
@@ -81,11 +81,11 @@ public class ProjectParser {
}
private void createNewPersons(List projectJsons) {
- final Set jsonIds = projectJsons.stream()
+ final Set personCreatorId = projectJsons.stream()
.map(ProjectJson::getCreatorId)
.collect(Collectors.toSet());
- final ExistsContainer existsContainer = personService.existsById(jsonIds);
+ final ExistsContainer existsContainer = personService.existsById(personCreatorId);
if (!existsContainer.isAllFound()) {
final Collection notFoundId = existsContainer.getIdNoFound();
@@ -96,11 +96,11 @@ public class ProjectParser {
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
.execute(PersonJson.class)
- .map(json -> conversionService.convert(json, Person.class)).orElseThrow(() -> new ConvertException("Ошибка преобразования нового пользователя"))
+ .map(json -> conversionService.convert(json, Person.class))
+ .orElseThrow(ConvertException.supplier("Ошибка преобразования нового пользователя"))
).toList();
personService.createAll(newPersons);
-
}
}
@@ -119,7 +119,7 @@ public class ProjectParser {
.header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
.execute(ProjectJson.class)
.map(json -> conversionService.convert(json, Project.class))
- .orElseThrow(() -> new ConvertException("Ошибка получения проекта"));
+ .orElseThrow(ConvertException.supplier("Ошибка получения проекта"));
if (!projectService.existsById(project.getId())) {
projectService.create(project);
}
diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/utils/StringUtils.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/utils/StringUtils.java
index d9d6192..60ffe45 100644
--- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/utils/StringUtils.java
+++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/utils/StringUtils.java
@@ -4,7 +4,7 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
- * // TODO: 29.09.2020 Добавить описание.
+ * Утилитарный класс для работы со сторками.
*
* @author upagge 29.09.2020
*/
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/AppSettingRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/AppSettingRepositoryImpl.java
index 6cf933a..230c68a 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/AppSettingRepositoryImpl.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/AppSettingRepositoryImpl.java
@@ -7,8 +7,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
- * // TODO: 16.01.2021 Добавить описание.
- *
* @author upagge 16.01.2021
*/
@Repository
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/DiscussionRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/DiscussionRepositoryImpl.java
index fbf689e..f690e74 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/DiscussionRepositoryImpl.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/DiscussionRepositoryImpl.java
@@ -10,8 +10,6 @@ import org.springframework.stereotype.Repository;
import java.util.List;
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
@Repository
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/NoteRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/NoteRepositoryImpl.java
index 8424d6c..66ce9fb 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/NoteRepositoryImpl.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/NoteRepositoryImpl.java
@@ -13,7 +13,6 @@ import org.springframework.stereotype.Repository;
import java.util.List;
/**
- * // TODO: 08.09.2020 Добавить описание.
*
* @author upagge 08.09.2020
*/
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PersonRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PersonRepositoryImpl.java
index a07aa25..0818e8f 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PersonRepositoryImpl.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PersonRepositoryImpl.java
@@ -7,8 +7,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
@Repository
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PipelineRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PipelineRepositoryImpl.java
index f3b51bb..50eef2c 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PipelineRepositoryImpl.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/PipelineRepositoryImpl.java
@@ -14,8 +14,6 @@ import org.springframework.stereotype.Repository;
import java.util.Set;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
@Repository
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java
index cf0ca27..1665fe6 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java
@@ -7,8 +7,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Repository
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/AppSettingJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/AppSettingJpaRepository.java
index 44049dc..feebcbd 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/AppSettingJpaRepository.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/AppSettingJpaRepository.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.AppSetting;
import org.springframework.data.jpa.repository.JpaRepository;
/**
- * // TODO: 16.01.2021 Добавить описание.
- *
* @author upagge 16.01.2021
*/
public interface AppSettingJpaRepository extends JpaRepository {
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java
index 7c622fa..20f1b16 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java
@@ -6,12 +6,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
public interface DiscussionJpaRepository extends JpaRepository {
+ /**
+ * Находит все обсуждения MR
+ */
List findAllByMergeRequestId(Long mergeRequestId);
}
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PersonJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PersonJpaRepository.java
index a409697..6893688 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PersonJpaRepository.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PersonJpaRepository.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.Person;
import org.springframework.data.jpa.repository.JpaRepository;
/**
- * // TODO: 15.01.2021 Добавить описание.
- *
* @author upagge 15.01.2021
*/
public interface PersonJpaRepository extends JpaRepository {
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PipelineJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PipelineJpaRepository.java
index acdd4af..2adb86b 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PipelineJpaRepository.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/PipelineJpaRepository.java
@@ -9,8 +9,6 @@ import org.springframework.data.jpa.repository.support.JpaRepositoryImplementati
import java.util.Set;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
public interface PipelineJpaRepository extends JpaRepositoryImplementation {
diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java
index f3b6930..75d8989 100644
--- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java
+++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java
@@ -4,8 +4,6 @@ import dev.struchkov.bot.gitlab.context.domain.entity.Project;
import org.springframework.data.jpa.repository.JpaRepository;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
public interface ProjectJpaRepository extends JpaRepository {
diff --git a/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/app/scheduler/SchedulerService.java b/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/app/scheduler/SchedulerService.java
index f529007..45c7f57 100644
--- a/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/app/scheduler/SchedulerService.java
+++ b/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/app/scheduler/SchedulerService.java
@@ -10,8 +10,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Slf4j
@@ -33,7 +31,7 @@ public class SchedulerService {
discussionParser.scanOldDiscussions();
discussionParser.scanNewDiscussion();
cleanService.cleanOldPipelines();
- cleanService.cleanMergedPullRequests();
+ cleanService.cleanOldMergedRequests();
}
}
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/CommitJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/CommitJson.java
index c1c59d3..23a7ebf 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/CommitJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/CommitJson.java
@@ -10,8 +10,6 @@ import lombok.Data;
import java.time.LocalDateTime;
/**
- * // TODO: 19.01.2021 Добавить описание.
- *
* @author upagge 19.01.2021
*/
@Data
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/DiscussionJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/DiscussionJson.java
index 3b3ed5d..871da61 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/DiscussionJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/DiscussionJson.java
@@ -6,8 +6,6 @@ import lombok.Setter;
import java.util.List;
/**
- * // TODO: 11.02.2021 Добавить описание.
- *
* @author upagge 11.02.2021
*/
@Getter
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestJson.java
index def2604..3bb7670 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestJson.java
@@ -11,8 +11,6 @@ import java.time.LocalDateTime;
import java.util.Set;
/**
- * TODO: Добавить описание класса.
- *
* @author upagge [30.01.2020]
*/
@Data
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestStateJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestStateJson.java
index 61a7d66..6e7bd9a 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestStateJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/MergeRequestStateJson.java
@@ -3,8 +3,6 @@ package dev.struchkov.bot.gitlab.sdk.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * TODO: Добавить комментарий енума.
- *
* @author upagge [01.02.2020]
*/
public enum MergeRequestStateJson {
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PersonJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PersonJson.java
index 05fb5ab..f05a4c4 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PersonJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PersonJson.java
@@ -4,8 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
- * TODO: Добавить описание класса.
- *
* @author upagge [31.01.2020]
*/
@Data
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineJson.java
index 86048e9..3ad3809 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineJson.java
@@ -10,8 +10,6 @@ import lombok.Data;
import java.time.LocalDateTime;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
@Data
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineStatusJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineStatusJson.java
index afcae31..f5c073b 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineStatusJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/PipelineStatusJson.java
@@ -3,8 +3,6 @@ package dev.struchkov.bot.gitlab.sdk.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * // TODO: 17.01.2021 Добавить описание.
- *
* @author upagge 17.01.2021
*/
public enum PipelineStatusJson {
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java
index 047c5a3..e714e26 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java
@@ -10,8 +10,6 @@ import lombok.Data;
import java.time.LocalDateTime;
/**
- * // TODO: 14.01.2021 Добавить описание.
- *
* @author upagge 14.01.2021
*/
@Data
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/Sheet.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/Sheet.java
deleted file mode 100644
index a84fb02..0000000
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/Sheet.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package dev.struchkov.bot.gitlab.sdk.domain;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * TODO: Добавить описание класса.
- *
- * @author upagge [30.01.2020]
- */
-@Data
-public abstract class Sheet {
-
- private Integer size;
- private Integer limit;
- private Boolean isLastPage;
- private List values;
- private Integer nextPageStart;
-
- public boolean hasContent() {
- return values != null && !values.isEmpty();
- }
-
-}
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/UserJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/UserJson.java
index cdad1ca..e6f2dd8 100644
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/UserJson.java
+++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/UserJson.java
@@ -3,8 +3,6 @@ package dev.struchkov.bot.gitlab.sdk.domain;
import lombok.Data;
/**
- * TODO: Добавить описание класса.
- *
* @author upagge [31.01.2020]
*/
@Data
diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/utils/LocalDateTimeFromEpochDeserializer.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/utils/LocalDateTimeFromEpochDeserializer.java
deleted file mode 100644
index 6533ab4..0000000
--- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/utils/LocalDateTimeFromEpochDeserializer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package dev.struchkov.bot.gitlab.sdk.utils;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-
-import java.io.IOException;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-
-public class LocalDateTimeFromEpochDeserializer extends JsonDeserializer {
-
- @Override
- public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt) {
- try {
- Long time = jp.readValueAs(Long.class);
- Instant instant = Instant.ofEpochMilli(time);
- return instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
- } catch (IOException e) {
-
- }
- return null;
- }
-
-}
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java
index 67b8cf0..7ee30c2 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java
@@ -24,8 +24,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import java.util.Collections;
/**
- * TODO: Добавить описание класса.
- *
* @author upagge [30.01.2020]
*/
@Configuration
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java
index cbb37c1..4106417 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java
@@ -11,7 +11,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
- * // TODO: 17.09.2020 Добавить описание.
+ * Отправляет сообщение в телеграмм.
*
* @author upagge 17.09.2020
*/
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java
index d0a1c80..26ecd30 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java
@@ -6,7 +6,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
- * // TODO: 18.09.2020 Добавить описание.
+ * Заменяет урл, который назначает гитлаб на любой другой перед отправкой сообщения. Потому что иногда у self-host гитлабов урлы, которые не преобразуются телеграммом в ссылки. В этом случае имеет смысл менять их на ip.
*
* @author upagge 18.09.2020
*/
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java
index 282f4ea..72a1940 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java
@@ -10,8 +10,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
- * // TODO: 19.01.2021 Добавить описание.
- *
* @author upagge 19.01.2021
*/
@Component
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/TaskProcessing.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/TaskProcessing.java
index c8313cc..5429e88 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/TaskProcessing.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/TaskProcessing.java
@@ -1,10 +1,10 @@
-package dev.struchkov.bot.gitlab.telegram.service.unit;
-
-/**
- * // TODO: 17.09.2020 Добавить описание.
- *
- * @author upagge 17.09.2020
- */
+//package dev.struchkov.bot.gitlab.telegram.service.unit;
+//
+///**
+// * // TODO: 17.09.2020 Добавить описание.
+// *
+// * @author upagge 17.09.2020
+// */
//@Component
//@RequiredArgsConstructor
//public class TaskProcessing implements ProcessingData {
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestNeedWorkProcessing.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestNeedWorkProcessing.java
index 4fa0c6d..649e49e 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestNeedWorkProcessing.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestNeedWorkProcessing.java
@@ -7,8 +7,6 @@ import dev.struchkov.godfather.context.service.usercode.ProcessingData;
import lombok.RequiredArgsConstructor;
/**
- * // TODO: 17.09.2020 Добавить описание.
- *
* @author upagge 17.09.2020
*/
//@Component
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestReviewProcessing.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestReviewProcessing.java
index 7085c3f..df90cab 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestReviewProcessing.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/unit/pullrequest/PullRequestReviewProcessing.java
@@ -7,8 +7,6 @@ import dev.struchkov.godfather.context.service.usercode.ProcessingData;
import lombok.RequiredArgsConstructor;
/**
- * // TODO: 17.09.2020 Добавить описание.
- *
* @author upagge 17.09.2020
*/
//@Component
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java
index 00f00e0..e9e16f1 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java
@@ -10,6 +10,7 @@ import dev.struchkov.bot.gitlab.context.service.NoteService;
import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty;
import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser;
import dev.struchkov.godfather.context.domain.BoxAnswer;
+import dev.struchkov.godfather.context.domain.content.Message;
import dev.struchkov.godfather.context.domain.keyboard.KeyBoard;
import dev.struchkov.godfather.context.domain.keyboard.KeyBoardLine;
import dev.struchkov.godfather.context.domain.keyboard.button.KeyBoardButtonText;
@@ -35,12 +36,12 @@ import java.util.stream.Collectors;
public class MenuConfig {
@Bean
- public AnswerText menu(
+ public AnswerText menu(
AppSettingService settingService,
- AnswerText settings,
- AnswerText textAddNewProject,
- AnswerText getTasks,
- AnswerText getAssigneeMergeRequest
+ AnswerText settings,
+ AnswerText textAddNewProject,
+ AnswerText getTasks,
+ AnswerText getAssigneeMergeRequest
) {
return AnswerText.builder()
.boxAnswer(message ->
@@ -83,9 +84,9 @@ public class MenuConfig {
}
@Bean
- public AnswerText textAddNewProject(
+ public AnswerText textAddNewProject(
AppSettingService settingService,
- AnswerText addNewProject
+ AnswerText addNewProject
) {
return AnswerText.builder()
.boxAnswer(BoxAnswer.processing(settingService.getMessage("ui.menu.add_mr.text")))
@@ -95,7 +96,7 @@ public class MenuConfig {
}
@Bean
- public AnswerText addNewProject(
+ public AnswerText addNewProject(
AppSettingService settingService,
ProjectParser projectParser,
GitlabProperty gitlabProperty
@@ -112,9 +113,9 @@ public class MenuConfig {
}
@Bean
- public AnswerText settings(
+ public AnswerText settings(
AppSettingService settingService,
- AnswerText settingsLanguage
+ AnswerText settingsLanguage
) {
return AnswerText.builder()
.boxAnswer(message ->
@@ -128,7 +129,7 @@ public class MenuConfig {
}
@Bean
- public AnswerText getTasks(
+ public AnswerText getTasks(
AppSettingService settingService,
PersonInformation personInformation,
NoteService noteService
@@ -151,7 +152,7 @@ public class MenuConfig {
}
@Bean
- public AnswerText getAssigneeMergeRequest(
+ public AnswerText getAssigneeMergeRequest(
MergeRequestsService mergeRequestsService,
PersonInformation personInformation,
AppSettingService settingService
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/UnitConfig.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/UnitConfig.java
index fe27f57..3ba511b 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/UnitConfig.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/UnitConfig.java
@@ -8,6 +8,7 @@ import dev.struchkov.bot.gitlab.context.service.NoteService;
import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser;
import dev.struchkov.godfather.context.domain.BoxAnswer;
import dev.struchkov.godfather.context.domain.content.Mail;
+import dev.struchkov.godfather.context.domain.content.Message;
import dev.struchkov.godfather.context.domain.content.attachment.Attachment;
import dev.struchkov.godfather.context.domain.content.attachment.AttachmentType;
import dev.struchkov.godfather.context.domain.content.attachment.Link;
@@ -40,7 +41,7 @@ public class UnitConfig {
@Bean
public AnswerCheck checkFirstStart(
AppSettingService settingService,
- AnswerText textCheckLanguage,
+ AnswerText textCheckLanguage,
AnswerCheck checkMenuOrAnswer
) {
return AnswerCheck.builder()
@@ -54,8 +55,8 @@ public class UnitConfig {
@Bean
public AnswerCheck checkMenuOrAnswer(
- AnswerText menu,
- AnswerText answerNote
+ AnswerText menu,
+ AnswerText answerNote
) {
return AnswerCheck.builder()
.check(
@@ -76,7 +77,7 @@ public class UnitConfig {
}
@Bean
- public AnswerText answerNote(
+ public AnswerText answerNote(
NoteService noteService,
DiscussionService discussionService
) {
@@ -105,7 +106,7 @@ public class UnitConfig {
}
@Bean
- public AnswerText textCheckLanguage(
+ public AnswerText textCheckLanguage(
AnswerProcessing checkLanguage
) {
return AnswerText.builder()
@@ -122,7 +123,7 @@ public class UnitConfig {
@Bean
public AnswerProcessing checkLanguage(
AppSettingService settingService,
- AnswerText textParserPrivateProject
+ AnswerText textParserPrivateProject
) {
return AnswerProcessing
.builder()
@@ -140,7 +141,7 @@ public class UnitConfig {
}
@Bean
- public AnswerText textParserPrivateProject(
+ public AnswerText textParserPrivateProject(
AnswerCheck checkParserPrivateProject,
AppSettingService settingService
) {
@@ -162,7 +163,7 @@ public class UnitConfig {
public AnswerCheck checkParserPrivateProject(
AppSettingService appSettingService,
AnswerProcessing parserPrivateProject,
- AnswerText textParseOwnerProject
+ AnswerText textParseOwnerProject
) {
return AnswerCheck.builder()
.check(
@@ -177,7 +178,7 @@ public class UnitConfig {
public AnswerProcessing parserPrivateProject(
ProjectParser projectParser,
AppSettingService settingService,
- AnswerText textParseOwnerProject
+ AnswerText textParseOwnerProject
) {
return AnswerProcessing.builder()
.processingData(message -> {
@@ -189,7 +190,7 @@ public class UnitConfig {
}
@Bean
- public AnswerText textParseOwnerProject(
+ public AnswerText textParseOwnerProject(
AppSettingService settingService,
AnswerCheck checkParseOwnerProject
) {
diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/menu/MenuSettingsConfig.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/menu/MenuSettingsConfig.java
index ad76333..1368293 100644
--- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/menu/MenuSettingsConfig.java
+++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/menu/MenuSettingsConfig.java
@@ -3,6 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.unit.menu;
import dev.struchkov.bot.gitlab.context.domain.AppLocale;
import dev.struchkov.bot.gitlab.context.service.AppSettingService;
import dev.struchkov.godfather.context.domain.BoxAnswer;
+import dev.struchkov.godfather.context.domain.content.Message;
import dev.struchkov.godfather.context.utils.KeyBoards;
import dev.struchkov.godfather.core.domain.unit.AnswerText;
import org.springframework.context.annotation.Bean;
@@ -17,9 +18,9 @@ import org.springframework.context.annotation.Configuration;
public class MenuSettingsConfig {
@Bean
- public AnswerText settingsLanguage(
+ public AnswerText settingsLanguage(
AppSettingService settingService,
- AnswerText setLanguage
+ AnswerText setLanguage
) {
return AnswerText.builder()
.boxAnswer(
@@ -34,7 +35,7 @@ public class MenuSettingsConfig {
}
@Bean
- public AnswerText setLanguage(
+ public AnswerText setLanguage(
AppSettingService settingService
) {
return AnswerText.builder()