From eaaca3be6cfc2e856c9cdfabebdf481ab6b9e667 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Fri, 9 Dec 2022 20:39:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20String=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20?= =?UTF-8?q?Long=20=D0=B4=D0=BB=D1=8F=20id=20=D1=8E=D0=B7=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot-context/bot-context-main/pom.xml | 2 +- bot-context/bot-context-quarkus/pom.xml | 2 +- .../context/service/PersonSettingService.java | 8 ++++---- .../godfather/quarkus/context/service/Pusher.java | 2 +- .../godfather/quarkus/context/service/Sending.java | 2 +- .../context/service/UnitPointerService.java | 4 ++-- bot-context/bot-context-simple/pom.xml | 2 +- .../context/service/PersonSettingService.java | 8 ++++---- .../godfather/simple/context/service/Pusher.java | 2 +- .../godfather/simple/context/service/Sending.java | 2 +- .../simple/context/service/UnitPointerService.java | 4 ++-- bot-context/pom.xml | 2 +- bot-core/bot-core-main/pom.xml | 2 +- bot-core/bot-core-quarkus/pom.xml | 2 +- .../quarkus/core/GeneralAutoResponder.java | 2 +- .../quarkus/core/action/AnswerSaveAction.java | 2 +- .../core/service/PersonSettingServiceImpl.java | 8 ++++---- .../core/service/StorylineContextMapImpl.java | 14 +++++++------- .../quarkus/core/service/StorylineMailService.java | 12 ++++++------ .../quarkus/core/service/StorylineService.java | 10 +++++----- .../core/service/UnitPointerServiceImpl.java | 4 ++-- .../godfather/quarkus/core/unit/func/Insert.java | 2 +- bot-core/bot-core-simple/pom.xml | 2 +- .../simple/core/GeneralAutoResponder.java | 4 ++-- .../simple/core/action/AnswerSaveAction.java | 2 +- .../simple/core/pusher/UserSanderPusher.java | 6 +++--- .../core/service/PersonSettingServiceImpl.java | 8 ++++---- .../core/service/StorylineContextMapImpl.java | 14 +++++++------- .../simple/core/service/StorylineMailService.java | 10 +++++----- .../simple/core/service/StorylineService.java | 10 +++++----- .../core/service/UnitPointerServiceImpl.java | 4 ++-- .../godfather/simple/core/unit/func/Insert.java | 2 +- bot-core/pom.xml | 2 +- bot-data/bot-data-main/pom.xml | 2 +- bot-data/bot-data-quarkus/pom.xml | 2 +- .../godfather/quarkus/data/StorylineContext.java | 12 ++++++------ .../quarkus/data/preser/AnswerSavePreservable.java | 2 +- .../godfather/quarkus/data/preser/Preservable.java | 6 +++--- .../data/repository/PersonSettingRepository.java | 8 ++++---- .../data/repository/StorylineRepository.java | 6 +++--- .../data/repository/UnitPointerRepository.java | 4 ++-- .../repository/impl/AnswerSaveMapPreservable.java | 10 +++++----- .../impl/PersonSettingLocalRepository.java | 10 +++++----- .../repository/impl/StorylineMapRepository.java | 12 ++++++------ .../repository/impl/UnitPointLocalRepository.java | 6 +++--- bot-data/bot-data-simple/pom.xml | 2 +- .../godfather/simple/data/StorylineContext.java | 12 ++++++------ .../simple/data/preser/AnswerSavePreservable.java | 2 +- .../godfather/simple/data/preser/Preservable.java | 6 +++--- .../data/repository/PersonSettingRepository.java | 8 ++++---- .../data/repository/StorylineRepository.java | 6 +++--- .../data/repository/UnitPointerRepository.java | 4 ++-- .../repository/impl/AnswerSaveMapPreservable.java | 10 +++++----- .../impl/PersonSettingLocalRepository.java | 10 +++++----- .../repository/impl/StorylineMapRepository.java | 12 ++++++------ .../repository/impl/UnitPointLocalRepository.java | 6 +++--- bot-data/pom.xml | 2 +- bot-domain/bot-domain-main/pom.xml | 2 +- .../godfather/main/domain/StorylineHistory.java | 6 +++--- .../godfather/main/domain/UnitPointer.java | 6 +++--- .../godfather/main/domain/content/Message.java | 6 +++--- bot-domain/pom.xml | 2 +- bot-exception/pom.xml | 2 +- pom.xml | 2 +- 64 files changed, 174 insertions(+), 174 deletions(-) diff --git a/bot-context/bot-context-main/pom.xml b/bot-context/bot-context-main/pom.xml index 19fc346..593fd4d 100644 --- a/bot-context/bot-context-main/pom.xml +++ b/bot-context/bot-context-main/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-context - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-context/bot-context-quarkus/pom.xml b/bot-context/bot-context-quarkus/pom.xml index b429ef1..bf17448 100644 --- a/bot-context/bot-context-quarkus/pom.xml +++ b/bot-context/bot-context-quarkus/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-context - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/PersonSettingService.java b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/PersonSettingService.java index d979fc4..7dc1df5 100644 --- a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/PersonSettingService.java +++ b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/PersonSettingService.java @@ -7,12 +7,12 @@ import java.util.Set; public interface PersonSettingService { - Uni> getAllPersonIdDisableMessages(@NotNull Set personIds); + Uni> getAllPersonIdDisableMessages(@NotNull Set personIds); - Uni getStateProcessingByPersonId(@NotNull Long personId); + Uni getStateProcessingByPersonId(@NotNull String personId); - Uni disableMessageProcessing(@NotNull Long personId); + Uni disableMessageProcessing(@NotNull String personId); - Uni enableMessageProcessing(@NotNull Long personId); + Uni enableMessageProcessing(@NotNull String personId); } diff --git a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Pusher.java b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Pusher.java index e219865..13cab48 100644 --- a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Pusher.java +++ b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Pusher.java @@ -12,6 +12,6 @@ import java.util.Map; @FunctionalInterface public interface Pusher { - Uni push(Long personId, Map saveElement); + Uni push(String personId, Map saveElement); } diff --git a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Sending.java b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Sending.java index 8c28e7d..55644d7 100644 --- a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Sending.java +++ b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/Sending.java @@ -18,7 +18,7 @@ public interface Sending { * @param personId Идентификатор пользователя * @param boxAnswer Объект с данными, которые необходимо отправить */ - Uni send(@NotNull Long personId, @NotNull BoxAnswer boxAnswer); + Uni send(@NotNull String personId, @NotNull BoxAnswer boxAnswer); /** * Возвращает тип объекта отправляющего ответ пользователя. В зависимости от типа ответ будет отправлен с помощью diff --git a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/UnitPointerService.java b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/UnitPointerService.java index 9f652b1..461eff3 100644 --- a/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/UnitPointerService.java +++ b/bot-context/bot-context-quarkus/src/main/java/dev/struchkov/godfather/quarkus/context/service/UnitPointerService.java @@ -13,8 +13,8 @@ public interface UnitPointerService { Uni save(@NotNull UnitPointer unitPointer); - Uni getUnitNameByPersonId(@NotNull Long personId); + Uni getUnitNameByPersonId(@NotNull String personId); - Uni removeByPersonId(@NotNull Long personId); + Uni removeByPersonId(@NotNull String personId); } diff --git a/bot-context/bot-context-simple/pom.xml b/bot-context/bot-context-simple/pom.xml index b2457b8..aa998ea 100644 --- a/bot-context/bot-context-simple/pom.xml +++ b/bot-context/bot-context-simple/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-context - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/PersonSettingService.java b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/PersonSettingService.java index 887ce55..9831eff 100644 --- a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/PersonSettingService.java +++ b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/PersonSettingService.java @@ -7,12 +7,12 @@ import java.util.Set; public interface PersonSettingService { - Set getAllPersonIdDisableMessages(@NotNull Set personIds); + Set getAllPersonIdDisableMessages(@NotNull Set personIds); - Optional getStateProcessingByPersonId(@NotNull Long personId); + Optional getStateProcessingByPersonId(@NotNull String personId); - void disableMessageProcessing(@NotNull Long personId); + void disableMessageProcessing(@NotNull String personId); - void enableMessageProcessing(@NotNull Long personId); + void enableMessageProcessing(@NotNull String personId); } diff --git a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Pusher.java b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Pusher.java index 590df81..d934f5a 100644 --- a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Pusher.java +++ b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Pusher.java @@ -10,6 +10,6 @@ import java.util.Map; @FunctionalInterface public interface Pusher { - void push(Long personId, Map saveElement); + void push(String personId, Map saveElement); } diff --git a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Sending.java b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Sending.java index 9113ff1..4871eff 100644 --- a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Sending.java +++ b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/Sending.java @@ -17,7 +17,7 @@ public interface Sending { * @param personId Идентификатор пользователя * @param boxAnswer Объект с данными, которые необходимо отправить */ - void send(@NotNull Long personId, @NotNull BoxAnswer boxAnswer); + void send(@NotNull String personId, @NotNull BoxAnswer boxAnswer); /** * Возвращает тип объекта отправляющего ответ пользователя. В зависимости от типа ответ будет отправлен с помощью diff --git a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/UnitPointerService.java b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/UnitPointerService.java index d21241e..02a55e8 100644 --- a/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/UnitPointerService.java +++ b/bot-context/bot-context-simple/src/main/java/dev/struchkov/godfather/simple/context/service/UnitPointerService.java @@ -14,8 +14,8 @@ public interface UnitPointerService { UnitPointer save(@NotNull UnitPointer unitPointer); - Optional getUnitNameByPersonId(@NotNull Long personId); + Optional getUnitNameByPersonId(@NotNull String personId); - void removeByPersonId(@NotNull Long personId); + void removeByPersonId(@NotNull String personId); } diff --git a/bot-context/pom.xml b/bot-context/pom.xml index 144f5c5..bde8b8b 100644 --- a/bot-context/pom.xml +++ b/bot-context/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.godfather godfather-bot - 0.0.27 + 0.0.29 bot-context diff --git a/bot-core/bot-core-main/pom.xml b/bot-core/bot-core-main/pom.xml index e1fe13b..f8c3f4b 100644 --- a/bot-core/bot-core-main/pom.xml +++ b/bot-core/bot-core-main/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-core - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-core/bot-core-quarkus/pom.xml b/bot-core/bot-core-quarkus/pom.xml index 13d0f4c..dc06424 100644 --- a/bot-core/bot-core-quarkus/pom.xml +++ b/bot-core/bot-core-quarkus/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-core - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/GeneralAutoResponder.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/GeneralAutoResponder.java index 7f98eb8..ad9ba80 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/GeneralAutoResponder.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/GeneralAutoResponder.java @@ -108,7 +108,7 @@ public class GeneralAutoResponder { messages -> { if (checkEmpty(newMessages)) return Uni.createFrom().voidItem(); - final Set personIds = newMessages.stream() + final Set personIds = newMessages.stream() .map(Message::getPersonId) .collect(Collectors.toSet()); return personSettingService.getAllPersonIdDisableMessages(personIds) diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java index 996c7e3..8129ce7 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java @@ -25,7 +25,7 @@ public class AnswerSaveAction implements ActionUnit preservable = answerSave.getPreservable(); - final Long personId = message.getPersonId(); + final String personId = message.getPersonId(); final CheckSave checkSave = answerSave.getCheckSave(); if (checkNotNull(checkSave)) { diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/PersonSettingServiceImpl.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/PersonSettingServiceImpl.java index 3ca3572..1af2fb6 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/PersonSettingServiceImpl.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/PersonSettingServiceImpl.java @@ -17,24 +17,24 @@ public class PersonSettingServiceImpl implements PersonSettingService { } @Override - public Uni> getAllPersonIdDisableMessages(@NotNull Set personIds) { + public Uni> getAllPersonIdDisableMessages(@NotNull Set personIds) { Inspector.isNotNull(personIds); return personSettingRepository.findAllByAllowedProcessing(personIds); } @Override - public Uni getStateProcessingByPersonId(@NotNull Long personId) { + public Uni getStateProcessingByPersonId(@NotNull String personId) { return personSettingRepository.findStateByPersonId(personId); } @Override - public Uni disableMessageProcessing(@NotNull Long personId) { + public Uni disableMessageProcessing(@NotNull String personId) { Inspector.isNotNull(personId); return personSettingRepository.disableMessageProcessing(personId); } @Override - public Uni enableMessageProcessing(@NotNull Long personId) { + public Uni enableMessageProcessing(@NotNull String personId) { Inspector.isNotNull(personId); return personSettingRepository.enableMessageProcessing(personId); } diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineContextMapImpl.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineContextMapImpl.java index 54585f8..3176ce0 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineContextMapImpl.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineContextMapImpl.java @@ -13,15 +13,15 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull; public class StorylineContextMapImpl implements StorylineContext { - private final Map> map = new HashMap<>(); + private final Map> map = new HashMap<>(); - public Uni save(@NotNull Long personId, @NotNull ContextKey key, Object objectForSave) { + public Uni save(@NotNull String personId, @NotNull ContextKey key, Object objectForSave) { isNotNull(personId, key); map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave); return Uni.createFrom().voidItem(); } - public Uni getByKey(@NotNull Long personId, @NotNull ContextKey key) { + public Uni getByKey(@NotNull String personId, @NotNull ContextKey key) { isNotNull(personId, key); if (map.containsKey(personId)) { final Map storage = map.get(personId); @@ -34,23 +34,23 @@ public class StorylineContextMapImpl implements StorylineContext { } @Override - public Uni getByKeyOrThrow(@NotNull Long personId, @NotNull ContextKey key) { + public Uni getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey key) { return getByKey(personId, key) .onItem().ifNull().failWith(notFoundException("Не найдено значение ключа {0}, для пользователя {1}", key.getValue(), personId)); } - public Uni> getAllSaveElement(@NotNull Long personId) { + public Uni> getAllSaveElement(@NotNull String personId) { isNotNull(personId); return Uni.createFrom().item(map.get(personId)); } - public Uni removeAll(@NotNull Long personId) { + public Uni removeAll(@NotNull String personId) { isNotNull(personId); map.remove(personId); return Uni.createFrom().voidItem(); } - public Uni removeByKey(@NotNull Long personId, @NotNull ContextKey key) { + public Uni removeByKey(@NotNull String personId, @NotNull ContextKey key) { isNotNull(personId, key); map.computeIfAbsent(personId, k -> new HashMap<>()).remove(key.getValue()); return Uni.createFrom().voidItem(); diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineMailService.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineMailService.java index 3ff1c2d..ac1111c 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineMailService.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineMailService.java @@ -47,7 +47,7 @@ public class StorylineMailService implements StorylineService { } @Override - public Uni> getUnitNameByPersonId(@NotNull Long personId) { + public Uni> getUnitNameByPersonId(@NotNull String personId) { isNotNull(personId); return unitPointerService.getUnitNameByPersonId(personId) .onItem().transform( @@ -62,7 +62,7 @@ public class StorylineMailService implements StorylineService { } @Override - public Uni>> getNextUnitByPersonId(@NotNull Long personId) { + public Uni>> getNextUnitByPersonId(@NotNull String personId) { return getUnitNameByPersonId(personId) .flatMap( unit -> { @@ -86,10 +86,10 @@ public class StorylineMailService implements StorylineService { } @Override - public Uni save(Long personId, String unitName, Mail mail) { + public Uni save(String personId, String unitName, Mail mail) { isNotNull(personId, unitName, mail); return unitPointerService.save(new UnitPointer(personId, unitName)) - .map(u -> { + .onItem().transformToUni(u -> { final StorylineHistory storylineHistory = new StorylineHistory(); storylineHistory.setPersonId(personId); storylineHistory.setUnitName(unitName); @@ -99,12 +99,12 @@ public class StorylineMailService implements StorylineService { } @Override - public Uni replaceUserToBack(long personId, int countUnitsToBack) { + public Uni replaceUserToBack(String personId, int countUnitsToBack) { return storylineRepository.findByCountLast(personId, countUnitsToBack); } @Override - public Uni replaceUserToBack(long personId, String unitName) { + public Uni replaceUserToBack(String personId, String unitName) { return storylineRepository.findByCountLast(personId, unitName); } diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineService.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineService.java index f8fe243..7d91e84 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineService.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/StorylineService.java @@ -13,15 +13,15 @@ public interface StorylineService { Uni save(@NotNull StorylineHistory storylineHistory); - Uni> getUnitNameByPersonId(@NotNull Long personId); + Uni> getUnitNameByPersonId(@NotNull String personId); - Uni>> getNextUnitByPersonId(@NotNull Long personId); + Uni>> getNextUnitByPersonId(@NotNull String personId); - Uni save(Long personId, String name, M message); + Uni save(String personId, String name, M message); - Uni replaceUserToBack(long personId, int countUnitsToBack); + Uni replaceUserToBack(String personId, int countUnitsToBack); - Uni replaceUserToBack(long personId, String unitName); + Uni replaceUserToBack(String personId, String unitName); Optional> getDefaultUnit(); diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/UnitPointerServiceImpl.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/UnitPointerServiceImpl.java index fae6119..6280b59 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/UnitPointerServiceImpl.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/service/UnitPointerServiceImpl.java @@ -20,12 +20,12 @@ public class UnitPointerServiceImpl implements UnitPointerService { } @Override - public Uni getUnitNameByPersonId(@NotNull Long personId) { + public Uni getUnitNameByPersonId(@NotNull String personId) { return unitPointerRepository.findUnitNameByPersonId(personId); } @Override - public Uni removeByPersonId(@NotNull Long personId) { + public Uni removeByPersonId(@NotNull String personId) { return unitPointerRepository.removeByPersonId(personId); } diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/unit/func/Insert.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/unit/func/Insert.java index 0f7fe1a..4369c55 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/unit/func/Insert.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/unit/func/Insert.java @@ -7,6 +7,6 @@ import java.util.List; @FunctionalInterface public interface Insert { - Uni> insert(Long personId); + Uni> insert(String personId); } diff --git a/bot-core/bot-core-simple/pom.xml b/bot-core/bot-core-simple/pom.xml index 8a6e998..72951d2 100644 --- a/bot-core/bot-core-simple/pom.xml +++ b/bot-core/bot-core-simple/pom.xml @@ -5,7 +5,7 @@ bot-core dev.struchkov.godfather - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java index 824be40..6891cb2 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java @@ -89,10 +89,10 @@ public class GeneralAutoResponder { public void processingNewMessages(List newMessages) { if (newMessages != null && !newMessages.isEmpty()) { - final Set personIds = newMessages.stream() + final Set personIds = newMessages.stream() .map(Message::getPersonId) .collect(Collectors.toSet()); - final Set disableIds = personSettingService.getAllPersonIdDisableMessages(personIds); + final Set disableIds = personSettingService.getAllPersonIdDisableMessages(personIds); final List allowedMessages = newMessages.stream() .filter(message -> !disableIds.contains(message.getPersonId())) .toList(); diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/action/AnswerSaveAction.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/action/AnswerSaveAction.java index c5ffde0..dec3718 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/action/AnswerSaveAction.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/action/AnswerSaveAction.java @@ -24,7 +24,7 @@ public class AnswerSaveAction implements ActionUnit preservable = answerSave.getPreservable(); - final Long personId = message.getPersonId(); + final String personId = message.getPersonId(); final CheckSave checkSave = answerSave.getCheckSave(); if (checkNotNull(checkSave)) { diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/pusher/UserSanderPusher.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/pusher/UserSanderPusher.java index a163cf5..c6fc223 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/pusher/UserSanderPusher.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/pusher/UserSanderPusher.java @@ -9,18 +9,18 @@ import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; public class UserSanderPusher implements Pusher { - private final Long personId; + private final String personId; private final String nameForm; private final Sending sending; - public UserSanderPusher(Long personId, String nameForm, Sending sending) { + public UserSanderPusher(String personId, String nameForm, Sending sending) { this.personId = personId; this.nameForm = nameForm; this.sending = sending; } @Override - public void push(Long personId, Map saveElement) { + public void push(String personId, Map saveElement) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("========= ").append(nameForm).append(" =========\n"); saveElement.forEach((key, value) -> stringBuilder.append(key).append(": ").append(value).append("\n")); diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/PersonSettingServiceImpl.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/PersonSettingServiceImpl.java index 58ec00a..15824b0 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/PersonSettingServiceImpl.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/PersonSettingServiceImpl.java @@ -17,24 +17,24 @@ public class PersonSettingServiceImpl implements PersonSettingService { } @Override - public Set getAllPersonIdDisableMessages(@NotNull Set personIds) { + public Set getAllPersonIdDisableMessages(@NotNull Set personIds) { Inspector.isNotNull(personIds); return personSettingRepository.findAllByAllowedProcessing(personIds); } @Override - public Optional getStateProcessingByPersonId(@NotNull Long personId) { + public Optional getStateProcessingByPersonId(@NotNull String personId) { return personSettingRepository.findStateByPersonId(personId); } @Override - public void disableMessageProcessing(@NotNull Long personId) { + public void disableMessageProcessing(@NotNull String personId) { Inspector.isNotNull(personId); personSettingRepository.disableMessageProcessing(personId); } @Override - public void enableMessageProcessing(@NotNull Long personId) { + public void enableMessageProcessing(@NotNull String personId) { Inspector.isNotNull(personId); personSettingRepository.enableMessageProcessing(personId); } diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineContextMapImpl.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineContextMapImpl.java index cf15366..1e46265 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineContextMapImpl.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineContextMapImpl.java @@ -13,14 +13,14 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull; public class StorylineContextMapImpl implements StorylineContext { - private final Map> map = new HashMap<>(); + private final Map> map = new HashMap<>(); - public void save(@NotNull Long personId, @NotNull ContextKey key, Object objectForSave) { + public void save(@NotNull String personId, @NotNull ContextKey key, Object objectForSave) { isNotNull(personId, key); map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave); } - public Optional getByKey(@NotNull Long personId, @NotNull ContextKey key) { + public Optional getByKey(@NotNull String personId, @NotNull ContextKey key) { isNotNull(personId, key); if (map.containsKey(personId)) { final Map storage = map.get(personId); @@ -33,21 +33,21 @@ public class StorylineContextMapImpl implements StorylineContext { } @Override - public T getByKeyOrThrow(@NotNull Long personId, @NotNull ContextKey key) { + public T getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey key) { return getByKey(personId, key).orElseThrow(notFoundException("Не найдено значение ключа {0}, для пользователя {1}", key.getValue(), personId)); } - public Map getAllSaveElement(@NotNull Long personId) { + public Map getAllSaveElement(@NotNull String personId) { isNotNull(personId); return map.get(personId); } - public void removeAll(@NotNull Long personId) { + public void removeAll(@NotNull String personId) { isNotNull(personId); map.remove(personId); } - public void removeByKey(@NotNull Long personId, @NotNull ContextKey key) { + public void removeByKey(@NotNull String personId, @NotNull ContextKey key) { isNotNull(personId, key); map.computeIfAbsent(personId, k -> new HashMap<>()).remove(key.getValue()); } diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineMailService.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineMailService.java index 98576b5..f0da316 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineMailService.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineMailService.java @@ -44,14 +44,14 @@ public class StorylineMailService implements StorylineService { } @Override - public Optional> getUnitNameByPersonId(@NotNull Long personId) { + public Optional> getUnitNameByPersonId(@NotNull String personId) { isNotNull(personId); return unitPointerService.getUnitNameByPersonId(personId) .flatMap(storyLine::getUnit); } @Override - public Set> getNextUnitByPersonId(@NotNull Long personId) { + public Set> getNextUnitByPersonId(@NotNull String personId) { final Optional>> optMainUnits = getUnitNameByPersonId(personId) .map(Unit::getNextUnits) .filter(mainUnits -> !mainUnits.isEmpty()); @@ -64,7 +64,7 @@ public class StorylineMailService implements StorylineService { } @Override - public void save(Long personId, String unitName, Mail mail) { + public void save(String personId, String unitName, Mail mail) { isNotNull(personId, unitName, mail); unitPointerService.save(new UnitPointer(personId, unitName)); @@ -76,12 +76,12 @@ public class StorylineMailService implements StorylineService { } @Override - public Optional replaceUserToBack(long personId, int countUnitsToBack) { + public Optional replaceUserToBack(String personId, int countUnitsToBack) { return storylineRepository.findByCountLast(personId, countUnitsToBack); } @Override - public Optional replaceUserToBack(long personId, String unitName) { + public Optional replaceUserToBack(String personId, String unitName) { return storylineRepository.findByCountLast(personId, unitName); } diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineService.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineService.java index b1daaf0..c637a17 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineService.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/StorylineService.java @@ -12,15 +12,15 @@ public interface StorylineService { void save(@NotNull StorylineHistory storylineHistory); - Optional> getUnitNameByPersonId(@NotNull Long personId); + Optional> getUnitNameByPersonId(@NotNull String personId); - Set> getNextUnitByPersonId(@NotNull Long personId); + Set> getNextUnitByPersonId(@NotNull String personId); - void save(Long personId, String name, M message); + void save(String personId, String name, M message); - Optional replaceUserToBack(long personId, int countUnitsToBack); + Optional replaceUserToBack(String personId, int countUnitsToBack); - Optional replaceUserToBack(long personId, String unitName); + Optional replaceUserToBack(String personId, String unitName); Optional> getDefaultUnit(); diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/UnitPointerServiceImpl.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/UnitPointerServiceImpl.java index 448d9a1..a5f28b9 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/UnitPointerServiceImpl.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/service/UnitPointerServiceImpl.java @@ -21,12 +21,12 @@ public class UnitPointerServiceImpl implements UnitPointerService { } @Override - public Optional getUnitNameByPersonId(@NotNull Long personId) { + public Optional getUnitNameByPersonId(@NotNull String personId) { return unitPointerRepository.findUnitNameByPersonId(personId); } @Override - public void removeByPersonId(@NotNull Long personId) { + public void removeByPersonId(@NotNull String personId) { unitPointerRepository.removeByPersonId(personId); } diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/unit/func/Insert.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/unit/func/Insert.java index 86f491a..e3cc6c3 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/unit/func/Insert.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/unit/func/Insert.java @@ -5,6 +5,6 @@ import java.util.List; @FunctionalInterface public interface Insert { - List insert(Long personId); + List insert(String personId); } diff --git a/bot-core/pom.xml b/bot-core/pom.xml index d0b0665..6d802b6 100644 --- a/bot-core/pom.xml +++ b/bot-core/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.godfather godfather-bot - 0.0.27 + 0.0.29 bot-core diff --git a/bot-data/bot-data-main/pom.xml b/bot-data/bot-data-main/pom.xml index d6cc961..57ddedc 100644 --- a/bot-data/bot-data-main/pom.xml +++ b/bot-data/bot-data-main/pom.xml @@ -5,7 +5,7 @@ bot-data dev.struchkov.godfather - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-data/bot-data-quarkus/pom.xml b/bot-data/bot-data-quarkus/pom.xml index 48b923a..f704481 100644 --- a/bot-data/bot-data-quarkus/pom.xml +++ b/bot-data/bot-data-quarkus/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-data - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/StorylineContext.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/StorylineContext.java index 3828bf9..65bc983 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/StorylineContext.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/StorylineContext.java @@ -8,16 +8,16 @@ import java.util.Map; public interface StorylineContext { - Uni save(@NotNull Long telegramId, @NotNull ContextKey key, Object objectForSave); + Uni save(@NotNull String personId, @NotNull ContextKey key, Object objectForSave); - Uni getByKey(@NotNull Long telegramId, @NotNull ContextKey key); + Uni getByKey(@NotNull String personId, @NotNull ContextKey key); - Uni getByKeyOrThrow(@NotNull Long telegramId, @NotNull ContextKey key); + Uni getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey key); - Uni> getAllSaveElement(@NotNull Long telegramId); + Uni> getAllSaveElement(@NotNull String personId); - Uni removeAll(@NotNull Long telegramId); + Uni removeAll(@NotNull String personId); - Uni removeByKey(@NotNull Long telegramId, @NotNull ContextKey key); + Uni removeByKey(@NotNull String personId, @NotNull ContextKey key); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/AnswerSavePreservable.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/AnswerSavePreservable.java index c7d3579..729caa1 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/AnswerSavePreservable.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/AnswerSavePreservable.java @@ -10,6 +10,6 @@ public interface AnswerSavePreservable extends Preservable { * * @param personId Идентификатор пользователя */ - Uni push(Long personId, Pusher pusher); + Uni push(String personId, Pusher pusher); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/Preservable.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/Preservable.java index eb5b6a2..5583a6b 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/Preservable.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/preser/Preservable.java @@ -17,10 +17,10 @@ public interface Preservable { * @param personId Идентификатор пользователя * @param save Объект данных */ - Uni save(Long personId, String key, S save); + Uni save(String personId, String key, S save); - Uni getByKey(Long personId, String key); + Uni getByKey(String personId, String key); - Uni> getAllSaveElement(Long personId); + Uni> getAllSaveElement(String personId); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/PersonSettingRepository.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/PersonSettingRepository.java index 058aa5a..6160bf1 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/PersonSettingRepository.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/PersonSettingRepository.java @@ -6,12 +6,12 @@ import java.util.Set; public interface PersonSettingRepository { - Uni> findAllByAllowedProcessing(Set personIds); + Uni> findAllByAllowedProcessing(Set personIds); - Uni disableMessageProcessing(Long personId); + Uni disableMessageProcessing(String personId); - Uni enableMessageProcessing(Long personId); + Uni enableMessageProcessing(String personId); - Uni findStateByPersonId(Long personId); + Uni findStateByPersonId(String personId); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/StorylineRepository.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/StorylineRepository.java index 29a0196..a0d68f5 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/StorylineRepository.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/StorylineRepository.java @@ -8,10 +8,10 @@ public interface StorylineRepository { Uni save(@NotNull StorylineHistory storylineHistory); - Uni findByCountLast(long personId, int countUnitsToBack); + Uni findByCountLast(String personId, int countUnitsToBack); - Uni findByCountLast(long personId, String unitName); + Uni findByCountLast(String personId, String unitName); - Uni cleanHistoryByPersonId(@NotNull Long personId); + Uni cleanHistoryByPersonId(@NotNull String personId); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/UnitPointerRepository.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/UnitPointerRepository.java index 9776ff5..acecadd 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/UnitPointerRepository.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/UnitPointerRepository.java @@ -11,8 +11,8 @@ public interface UnitPointerRepository { Uni save(@NotNull UnitPointer unitPointer); - Uni findUnitNameByPersonId(@NotNull Long personId); + Uni findUnitNameByPersonId(@NotNull String personId); - Uni removeByPersonId(@NotNull Long personId); + Uni removeByPersonId(@NotNull String personId); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/AnswerSaveMapPreservable.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/AnswerSaveMapPreservable.java index 8590f41..572d421 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/AnswerSaveMapPreservable.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/AnswerSaveMapPreservable.java @@ -12,16 +12,16 @@ import static dev.struchkov.haiti.utils.Checker.checkNotNull; public class AnswerSaveMapPreservable implements AnswerSavePreservable { - private final Map> saveMap = new HashMap<>(); + private final Map> saveMap = new HashMap<>(); @Override - public Uni save(Long personId, String key, S save) { + public Uni save(String personId, String key, S save) { saveMap.computeIfAbsent(personId, k -> new HashMap<>()).put(key, save); return Uni.createFrom().voidItem(); } @Override - public Uni getByKey(Long personId, String key) { + public Uni getByKey(String personId, String key) { if (saveMap.containsKey(personId) && saveMap.get(personId).containsKey(key)) { return Uni.createFrom().item(saveMap.get(personId).get(key)); @@ -30,12 +30,12 @@ public class AnswerSaveMapPreservable implements AnswerSavePreservable { } @Override - public Uni> getAllSaveElement(Long personId) { + public Uni> getAllSaveElement(String personId) { return Uni.createFrom().item(saveMap.get(personId)); } @Override - public Uni push(Long personId, Pusher pusher) { + public Uni push(String personId, Pusher pusher) { if (checkNotNull(pusher)) { return getAllSaveElement(personId).onItem() .transformToUni( diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/PersonSettingLocalRepository.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/PersonSettingLocalRepository.java index 92ac04f..9b0a6a8 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/PersonSettingLocalRepository.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/PersonSettingLocalRepository.java @@ -10,10 +10,10 @@ import java.util.stream.Collectors; public class PersonSettingLocalRepository implements PersonSettingRepository { - private final Map map = new HashMap<>(); + private final Map map = new HashMap<>(); @Override - public Uni> findAllByAllowedProcessing(Set personIds) { + public Uni> findAllByAllowedProcessing(Set personIds) { return Uni.createFrom().item( personIds.stream() .filter(map::get) @@ -22,19 +22,19 @@ public class PersonSettingLocalRepository implements PersonSettingRepository { } @Override - public Uni disableMessageProcessing(Long personId) { + public Uni disableMessageProcessing(String personId) { map.put(personId, false); return Uni.createFrom().voidItem(); } @Override - public Uni enableMessageProcessing(Long personId) { + public Uni enableMessageProcessing(String personId) { map.put(personId, true); return Uni.createFrom().voidItem(); } @Override - public Uni findStateByPersonId(Long personId) { + public Uni findStateByPersonId(String personId) { return Uni.createFrom().item(map.get(personId)); } diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/StorylineMapRepository.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/StorylineMapRepository.java index dd9de19..1041eab 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/StorylineMapRepository.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/StorylineMapRepository.java @@ -13,19 +13,19 @@ import java.util.Stack; public class StorylineMapRepository implements StorylineRepository { - private final Map> map = new HashMap<>(); - private final Map> historyUnitName = new HashMap<>(); + private final Map> map = new HashMap<>(); + private final Map> historyUnitName = new HashMap<>(); @Override public Uni save(@NotNull StorylineHistory history) { - final Long personId = history.getPersonId(); + final String personId = history.getPersonId(); map.computeIfAbsent(personId, k -> new Stack<>()).push(history); historyUnitName.computeIfAbsent(personId, k -> new HashSet<>()).add(history.getUnitName()); return Uni.createFrom().voidItem(); } @Override - public Uni findByCountLast(long personId, int countUnitsToBack) { + public Uni findByCountLast(String personId, int countUnitsToBack) { if (map.containsKey(personId)) { final Stack stack = map.get(personId); if (stack.size() < countUnitsToBack) { @@ -42,7 +42,7 @@ public class StorylineMapRepository implements StorylineRepository { } @Override - public Uni findByCountLast(long personId, String unitName) { + public Uni findByCountLast(String personId, String unitName) { if (map.containsKey(personId)) { final Stack stack = map.get(personId); StorylineHistory storylineHistory; @@ -58,7 +58,7 @@ public class StorylineMapRepository implements StorylineRepository { } @Override - public Uni cleanHistoryByPersonId(@NotNull Long personId) { + public Uni cleanHistoryByPersonId(@NotNull String personId) { if (map.containsKey(personId)) { map.get(personId).clear(); } else { diff --git a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/UnitPointLocalRepository.java b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/UnitPointLocalRepository.java index b490903..e32a02e 100644 --- a/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/UnitPointLocalRepository.java +++ b/bot-data/bot-data-quarkus/src/main/java/dev/struchkov/godfather/quarkus/data/repository/impl/UnitPointLocalRepository.java @@ -10,7 +10,7 @@ import java.util.Map; public class UnitPointLocalRepository implements UnitPointerRepository { - public final Map map = new HashMap<>(); + public final Map map = new HashMap<>(); @Override public Uni save(@NotNull UnitPointer unitPointer) { @@ -19,12 +19,12 @@ public class UnitPointLocalRepository implements UnitPointerRepository { } @Override - public Uni findUnitNameByPersonId(@NotNull Long personId) { + public Uni findUnitNameByPersonId(@NotNull String personId) { return Uni.createFrom().item(map.get(personId)); } @Override - public Uni removeByPersonId(@NotNull Long personId) { + public Uni removeByPersonId(@NotNull String personId) { map.remove(personId); return Uni.createFrom().voidItem(); } diff --git a/bot-data/bot-data-simple/pom.xml b/bot-data/bot-data-simple/pom.xml index bdc74ae..39d1ace 100644 --- a/bot-data/bot-data-simple/pom.xml +++ b/bot-data/bot-data-simple/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather bot-data - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/StorylineContext.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/StorylineContext.java index 4db7e29..01536a2 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/StorylineContext.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/StorylineContext.java @@ -8,16 +8,16 @@ import java.util.Optional; public interface StorylineContext { - void save(@NotNull Long telegramId, @NotNull ContextKey key, Object objectForSave); + void save(@NotNull String personId, @NotNull ContextKey key, Object objectForSave); - Optional getByKey(@NotNull Long telegramId, @NotNull ContextKey key); + Optional getByKey(@NotNull String personId, @NotNull ContextKey key); - T getByKeyOrThrow(@NotNull Long telegramId, @NotNull ContextKey key); + T getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey key); - Map getAllSaveElement(@NotNull Long telegramId); + Map getAllSaveElement(@NotNull String personId); - void removeAll(@NotNull Long telegramId); + void removeAll(@NotNull String personId); - void removeByKey(@NotNull Long telegramId, @NotNull ContextKey key); + void removeByKey(@NotNull String personId, @NotNull ContextKey key); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/AnswerSavePreservable.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/AnswerSavePreservable.java index 723f804..8f0df33 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/AnswerSavePreservable.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/AnswerSavePreservable.java @@ -9,6 +9,6 @@ public interface AnswerSavePreservable extends Preservable { * * @param personId Идентификатор пользователя */ - void push(Long personId, Pusher pusher); + void push(String personId, Pusher pusher); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/Preservable.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/Preservable.java index ce4a31a..5f418b8 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/Preservable.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/preser/Preservable.java @@ -16,10 +16,10 @@ public interface Preservable { * @param personId Идентификатор пользователя * @param save Объект данных */ - void save(Long personId, String key, S save); + void save(String personId, String key, S save); - Optional getByKey(Long personId, String key); + Optional getByKey(String personId, String key); - Map getAllSaveElement(Long personId); + Map getAllSaveElement(String personId); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/PersonSettingRepository.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/PersonSettingRepository.java index 20e0645..6277f4c 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/PersonSettingRepository.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/PersonSettingRepository.java @@ -5,12 +5,12 @@ import java.util.Set; public interface PersonSettingRepository { - Set findAllByAllowedProcessing(Set personIds); + Set findAllByAllowedProcessing(Set personIds); - void disableMessageProcessing(Long personId); + void disableMessageProcessing(String personId); - void enableMessageProcessing(Long personId); + void enableMessageProcessing(String personId); - Optional findStateByPersonId(Long personId); + Optional findStateByPersonId(String personId); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/StorylineRepository.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/StorylineRepository.java index 9c2b4e8..6457e09 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/StorylineRepository.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/StorylineRepository.java @@ -9,10 +9,10 @@ public interface StorylineRepository { void save(@NotNull StorylineHistory storylineHistory); - Optional findByCountLast(long personId, int countUnitsToBack); + Optional findByCountLast(String personId, int countUnitsToBack); - Optional findByCountLast(long personId, String unitName); + Optional findByCountLast(String personId, String unitName); - void cleanHistoryByPersonId(@NotNull Long personId); + void cleanHistoryByPersonId(@NotNull String personId); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/UnitPointerRepository.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/UnitPointerRepository.java index 58122ac..ac163b5 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/UnitPointerRepository.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/UnitPointerRepository.java @@ -12,8 +12,8 @@ public interface UnitPointerRepository { UnitPointer save(@NotNull UnitPointer unitPointer); - Optional findUnitNameByPersonId(@NotNull Long personId); + Optional findUnitNameByPersonId(@NotNull String personId); - void removeByPersonId(@NotNull Long personId); + void removeByPersonId(@NotNull String personId); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/AnswerSaveMapPreservable.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/AnswerSaveMapPreservable.java index a09cf96..11cd3d5 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/AnswerSaveMapPreservable.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/AnswerSaveMapPreservable.java @@ -9,15 +9,15 @@ import java.util.Optional; public class AnswerSaveMapPreservable implements AnswerSavePreservable { - private final Map> saveMap = new HashMap<>(); + private final Map> saveMap = new HashMap<>(); @Override - public void save(Long personId, String key, S save) { + public void save(String personId, String key, S save) { saveMap.computeIfAbsent(personId, k -> new HashMap<>()).put(key, save); } @Override - public Optional getByKey(Long personId, String key) { + public Optional getByKey(String personId, String key) { if (saveMap.containsKey(personId) && saveMap.get(personId).containsKey(key)) { return Optional.of(saveMap.get(personId).get(key)); @@ -26,12 +26,12 @@ public class AnswerSaveMapPreservable implements AnswerSavePreservable { } @Override - public Map getAllSaveElement(Long personId) { + public Map getAllSaveElement(String personId) { return saveMap.get(personId); } @Override - public void push(Long personId, Pusher pusher) { + public void push(String personId, Pusher pusher) { Optional.ofNullable(pusher).ifPresent(sPusher -> sPusher.push(personId, getAllSaveElement(personId))); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/PersonSettingLocalRepository.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/PersonSettingLocalRepository.java index 8587803..c459817 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/PersonSettingLocalRepository.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/PersonSettingLocalRepository.java @@ -10,27 +10,27 @@ import java.util.stream.Collectors; public class PersonSettingLocalRepository implements PersonSettingRepository { - private final Map map = new HashMap<>(); + private final Map map = new HashMap<>(); @Override - public Set findAllByAllowedProcessing(Set personIds) { + public Set findAllByAllowedProcessing(Set personIds) { return personIds.stream() .filter(map::get) .collect(Collectors.toSet()); } @Override - public void disableMessageProcessing(Long personId) { + public void disableMessageProcessing(String personId) { map.put(personId, false); } @Override - public void enableMessageProcessing(Long personId) { + public void enableMessageProcessing(String personId) { map.put(personId, true); } @Override - public Optional findStateByPersonId(Long personId) { + public Optional findStateByPersonId(String personId) { return Optional.ofNullable(map.get(personId)); } diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/StorylineMapRepository.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/StorylineMapRepository.java index 7128269..5b2c3a4 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/StorylineMapRepository.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/StorylineMapRepository.java @@ -13,18 +13,18 @@ import java.util.Stack; public class StorylineMapRepository implements StorylineRepository { - private final Map> map = new HashMap<>(); - private final Map> historyUnitName = new HashMap<>(); + private final Map> map = new HashMap<>(); + private final Map> historyUnitName = new HashMap<>(); @Override public void save(@NotNull StorylineHistory history) { - final Long personId = history.getPersonId(); + final String personId = history.getPersonId(); map.computeIfAbsent(personId, k -> new Stack<>()).push(history); historyUnitName.computeIfAbsent(personId, k -> new HashSet<>()).add(history.getUnitName()); } @Override - public Optional findByCountLast(long personId, int countUnitsToBack) { + public Optional findByCountLast(String personId, int countUnitsToBack) { if (map.containsKey(personId)) { final Stack stack = map.get(personId); if (stack.size() < countUnitsToBack) { @@ -41,7 +41,7 @@ public class StorylineMapRepository implements StorylineRepository { } @Override - public Optional findByCountLast(long personId, String unitName) { + public Optional findByCountLast(String personId, String unitName) { if (map.containsKey(personId)) { final Stack stack = map.get(personId); StorylineHistory storylineHistory; @@ -57,7 +57,7 @@ public class StorylineMapRepository implements StorylineRepository { } @Override - public void cleanHistoryByPersonId(@NotNull Long personId) { + public void cleanHistoryByPersonId(@NotNull String personId) { if (map.containsKey(personId)) { map.get(personId).clear(); } else { diff --git a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/UnitPointLocalRepository.java b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/UnitPointLocalRepository.java index 70f07bc..b5aac4c 100644 --- a/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/UnitPointLocalRepository.java +++ b/bot-data/bot-data-simple/src/main/java/dev/struchkov/godfather/simple/data/repository/impl/UnitPointLocalRepository.java @@ -10,7 +10,7 @@ import java.util.Optional; public class UnitPointLocalRepository implements UnitPointerRepository { - public final Map map = new HashMap<>(); + public final Map map = new HashMap<>(); @Override public UnitPointer save(@NotNull UnitPointer unitPointer) { @@ -19,12 +19,12 @@ public class UnitPointLocalRepository implements UnitPointerRepository { } @Override - public Optional findUnitNameByPersonId(@NotNull Long personId) { + public Optional findUnitNameByPersonId(@NotNull String personId) { return Optional.ofNullable(map.get(personId)); } @Override - public void removeByPersonId(@NotNull Long personId) { + public void removeByPersonId(@NotNull String personId) { map.remove(personId); } diff --git a/bot-data/pom.xml b/bot-data/pom.xml index 7923d6f..383fc27 100644 --- a/bot-data/pom.xml +++ b/bot-data/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather godfather-bot - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-domain/bot-domain-main/pom.xml b/bot-domain/bot-domain-main/pom.xml index fa00651..056d35e 100644 --- a/bot-domain/bot-domain-main/pom.xml +++ b/bot-domain/bot-domain-main/pom.xml @@ -5,7 +5,7 @@ bot-domain dev.struchkov.godfather - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/StorylineHistory.java b/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/StorylineHistory.java index 9c05920..4851a6c 100644 --- a/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/StorylineHistory.java +++ b/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/StorylineHistory.java @@ -5,15 +5,15 @@ import dev.struchkov.godfather.main.domain.content.Message; public class StorylineHistory { - private Long personId; + private String personId; private String unitName; private Message message; - public Long getPersonId() { + public String getPersonId() { return personId; } - public void setPersonId(Long personId) { + public void setPersonId(String personId) { this.personId = personId; } diff --git a/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/UnitPointer.java b/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/UnitPointer.java index 647655e..2458691 100644 --- a/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/UnitPointer.java +++ b/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/UnitPointer.java @@ -4,15 +4,15 @@ import java.util.Objects; public class UnitPointer { - private Long personId; + private String personId; private String unitName; - public UnitPointer(Long personId, String unitName) { + public UnitPointer(String personId, String unitName) { this.personId = personId; this.unitName = unitName; } - public Long getPersonId() { + public String getPersonId() { return personId; } diff --git a/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/content/Message.java b/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/content/Message.java index d85a72a..3cb23db 100644 --- a/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/content/Message.java +++ b/bot-domain/bot-domain-main/src/main/java/dev/struchkov/godfather/main/domain/content/Message.java @@ -25,7 +25,7 @@ public abstract class Message implements DeliverableText { /** * Идентификатор пользователя, отправившего сообщение. */ - private Long personId; + private String personId; /** * Текстовое сообщение. @@ -58,11 +58,11 @@ public abstract class Message implements DeliverableText { this.createDate = createDate; } - public Long getPersonId() { + public String getPersonId() { return personId; } - public void setPersonId(Long personId) { + public void setPersonId(String personId) { this.personId = personId; } diff --git a/bot-domain/pom.xml b/bot-domain/pom.xml index e4d5134..ff1590a 100644 --- a/bot-domain/pom.xml +++ b/bot-domain/pom.xml @@ -5,7 +5,7 @@ godfather-bot dev.struchkov.godfather - 0.0.27 + 0.0.29 4.0.0 diff --git a/bot-exception/pom.xml b/bot-exception/pom.xml index 8dde2cf..faf34df 100644 --- a/bot-exception/pom.xml +++ b/bot-exception/pom.xml @@ -5,7 +5,7 @@ dev.struchkov.godfather godfather-bot - 0.0.27 + 0.0.29 4.0.0 diff --git a/pom.xml b/pom.xml index b07d3c9..15f7cdf 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.godfather godfather-bot - 0.0.27 + 0.0.29 pom