Переход на String вместо Long для id юзера

This commit is contained in:
Struchkov Mark 2022-12-09 20:39:24 +03:00
parent eb2e7ba012
commit eaaca3be6c
64 changed files with 174 additions and 174 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-context</artifactId> <artifactId>bot-context</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-context</artifactId> <artifactId>bot-context</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -7,12 +7,12 @@ import java.util.Set;
public interface PersonSettingService { public interface PersonSettingService {
Uni<Set<Long>> getAllPersonIdDisableMessages(@NotNull Set<Long> personIds); Uni<Set<String>> getAllPersonIdDisableMessages(@NotNull Set<String> personIds);
Uni<Boolean> getStateProcessingByPersonId(@NotNull Long personId); Uni<Boolean> getStateProcessingByPersonId(@NotNull String personId);
Uni<Void> disableMessageProcessing(@NotNull Long personId); Uni<Void> disableMessageProcessing(@NotNull String personId);
Uni<Void> enableMessageProcessing(@NotNull Long personId); Uni<Void> enableMessageProcessing(@NotNull String personId);
} }

View File

@ -12,6 +12,6 @@ import java.util.Map;
@FunctionalInterface @FunctionalInterface
public interface Pusher<D> { public interface Pusher<D> {
Uni<Void> push(Long personId, Map<String, D> saveElement); Uni<Void> push(String personId, Map<String, D> saveElement);
} }

View File

@ -18,7 +18,7 @@ public interface Sending {
* @param personId Идентификатор пользователя * @param personId Идентификатор пользователя
* @param boxAnswer Объект с данными, которые необходимо отправить * @param boxAnswer Объект с данными, которые необходимо отправить
*/ */
Uni<Void> send(@NotNull Long personId, @NotNull BoxAnswer boxAnswer); Uni<Void> send(@NotNull String personId, @NotNull BoxAnswer boxAnswer);
/** /**
* Возвращает тип объекта отправляющего ответ пользователя. В зависимости от типа ответ будет отправлен с помощью * Возвращает тип объекта отправляющего ответ пользователя. В зависимости от типа ответ будет отправлен с помощью

View File

@ -13,8 +13,8 @@ public interface UnitPointerService {
Uni<UnitPointer> save(@NotNull UnitPointer unitPointer); Uni<UnitPointer> save(@NotNull UnitPointer unitPointer);
Uni<String> getUnitNameByPersonId(@NotNull Long personId); Uni<String> getUnitNameByPersonId(@NotNull String personId);
Uni<Void> removeByPersonId(@NotNull Long personId); Uni<Void> removeByPersonId(@NotNull String personId);
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-context</artifactId> <artifactId>bot-context</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -7,12 +7,12 @@ import java.util.Set;
public interface PersonSettingService { public interface PersonSettingService {
Set<Long> getAllPersonIdDisableMessages(@NotNull Set<Long> personIds); Set<String> getAllPersonIdDisableMessages(@NotNull Set<String> personIds);
Optional<Boolean> getStateProcessingByPersonId(@NotNull Long personId); Optional<Boolean> getStateProcessingByPersonId(@NotNull String personId);
void disableMessageProcessing(@NotNull Long personId); void disableMessageProcessing(@NotNull String personId);
void enableMessageProcessing(@NotNull Long personId); void enableMessageProcessing(@NotNull String personId);
} }

View File

@ -10,6 +10,6 @@ import java.util.Map;
@FunctionalInterface @FunctionalInterface
public interface Pusher<D> { public interface Pusher<D> {
void push(Long personId, Map<String, D> saveElement); void push(String personId, Map<String, D> saveElement);
} }

View File

@ -17,7 +17,7 @@ public interface Sending {
* @param personId Идентификатор пользователя * @param personId Идентификатор пользователя
* @param boxAnswer Объект с данными, которые необходимо отправить * @param boxAnswer Объект с данными, которые необходимо отправить
*/ */
void send(@NotNull Long personId, @NotNull BoxAnswer boxAnswer); void send(@NotNull String personId, @NotNull BoxAnswer boxAnswer);
/** /**
* Возвращает тип объекта отправляющего ответ пользователя. В зависимости от типа ответ будет отправлен с помощью * Возвращает тип объекта отправляющего ответ пользователя. В зависимости от типа ответ будет отправлен с помощью

View File

@ -14,8 +14,8 @@ public interface UnitPointerService {
UnitPointer save(@NotNull UnitPointer unitPointer); UnitPointer save(@NotNull UnitPointer unitPointer);
Optional<String> getUnitNameByPersonId(@NotNull Long personId); Optional<String> getUnitNameByPersonId(@NotNull String personId);
void removeByPersonId(@NotNull Long personId); void removeByPersonId(@NotNull String personId);
} }

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>godfather-bot</artifactId> <artifactId>godfather-bot</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<artifactId>bot-context</artifactId> <artifactId>bot-context</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-core</artifactId> <artifactId>bot-core</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-core</artifactId> <artifactId>bot-core</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -108,7 +108,7 @@ public class GeneralAutoResponder<M extends Message> {
messages -> { messages -> {
if (checkEmpty(newMessages)) return Uni.createFrom().voidItem(); if (checkEmpty(newMessages)) return Uni.createFrom().voidItem();
final Set<Long> personIds = newMessages.stream() final Set<String> personIds = newMessages.stream()
.map(Message::getPersonId) .map(Message::getPersonId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
return personSettingService.getAllPersonIdDisableMessages(personIds) return personSettingService.getAllPersonIdDisableMessages(personIds)

View File

@ -25,7 +25,7 @@ public class AnswerSaveAction<M extends Message, D> implements ActionUnit<Answer
final M message = unitRequest.getMessage(); final M message = unitRequest.getMessage();
final AnswerSavePreservable<D> preservable = answerSave.getPreservable(); final AnswerSavePreservable<D> preservable = answerSave.getPreservable();
final Long personId = message.getPersonId(); final String personId = message.getPersonId();
final CheckSave<M> checkSave = answerSave.getCheckSave(); final CheckSave<M> checkSave = answerSave.getCheckSave();
if (checkNotNull(checkSave)) { if (checkNotNull(checkSave)) {

View File

@ -17,24 +17,24 @@ public class PersonSettingServiceImpl implements PersonSettingService {
} }
@Override @Override
public Uni<Set<Long>> getAllPersonIdDisableMessages(@NotNull Set<Long> personIds) { public Uni<Set<String>> getAllPersonIdDisableMessages(@NotNull Set<String> personIds) {
Inspector.isNotNull(personIds); Inspector.isNotNull(personIds);
return personSettingRepository.findAllByAllowedProcessing(personIds); return personSettingRepository.findAllByAllowedProcessing(personIds);
} }
@Override @Override
public Uni<Boolean> getStateProcessingByPersonId(@NotNull Long personId) { public Uni<Boolean> getStateProcessingByPersonId(@NotNull String personId) {
return personSettingRepository.findStateByPersonId(personId); return personSettingRepository.findStateByPersonId(personId);
} }
@Override @Override
public Uni<Void> disableMessageProcessing(@NotNull Long personId) { public Uni<Void> disableMessageProcessing(@NotNull String personId) {
Inspector.isNotNull(personId); Inspector.isNotNull(personId);
return personSettingRepository.disableMessageProcessing(personId); return personSettingRepository.disableMessageProcessing(personId);
} }
@Override @Override
public Uni<Void> enableMessageProcessing(@NotNull Long personId) { public Uni<Void> enableMessageProcessing(@NotNull String personId) {
Inspector.isNotNull(personId); Inspector.isNotNull(personId);
return personSettingRepository.enableMessageProcessing(personId); return personSettingRepository.enableMessageProcessing(personId);
} }

View File

@ -13,15 +13,15 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull;
public class StorylineContextMapImpl implements StorylineContext { public class StorylineContextMapImpl implements StorylineContext {
private final Map<Long, Map<String, Object>> map = new HashMap<>(); private final Map<String, Map<String, Object>> map = new HashMap<>();
public Uni<Void> save(@NotNull Long personId, @NotNull ContextKey<?> key, Object objectForSave) { public Uni<Void> save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave) {
isNotNull(personId, key); isNotNull(personId, key);
map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave); map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave);
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
public <T> Uni<T> getByKey(@NotNull Long personId, @NotNull ContextKey<T> key) { public <T> Uni<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key) {
isNotNull(personId, key); isNotNull(personId, key);
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
final Map<String, Object> storage = map.get(personId); final Map<String, Object> storage = map.get(personId);
@ -34,23 +34,23 @@ public class StorylineContextMapImpl implements StorylineContext {
} }
@Override @Override
public <T> Uni<T> getByKeyOrThrow(@NotNull Long personId, @NotNull ContextKey<T> key) { public <T> Uni<T> getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey<T> key) {
return getByKey(personId, key) return getByKey(personId, key)
.onItem().ifNull().failWith(notFoundException("Не найдено значение ключа {0}, для пользователя {1}", key.getValue(), personId)); .onItem().ifNull().failWith(notFoundException("Не найдено значение ключа {0}, для пользователя {1}", key.getValue(), personId));
} }
public Uni<Map<String, Object>> getAllSaveElement(@NotNull Long personId) { public Uni<Map<String, Object>> getAllSaveElement(@NotNull String personId) {
isNotNull(personId); isNotNull(personId);
return Uni.createFrom().item(map.get(personId)); return Uni.createFrom().item(map.get(personId));
} }
public Uni<Void> removeAll(@NotNull Long personId) { public Uni<Void> removeAll(@NotNull String personId) {
isNotNull(personId); isNotNull(personId);
map.remove(personId); map.remove(personId);
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
public Uni<Void> removeByKey(@NotNull Long personId, @NotNull ContextKey<?> key) { public Uni<Void> removeByKey(@NotNull String personId, @NotNull ContextKey<?> key) {
isNotNull(personId, key); isNotNull(personId, key);
map.computeIfAbsent(personId, k -> new HashMap<>()).remove(key.getValue()); map.computeIfAbsent(personId, k -> new HashMap<>()).remove(key.getValue());
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();

View File

@ -47,7 +47,7 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public Uni<MainUnit<Mail>> getUnitNameByPersonId(@NotNull Long personId) { public Uni<MainUnit<Mail>> getUnitNameByPersonId(@NotNull String personId) {
isNotNull(personId); isNotNull(personId);
return unitPointerService.getUnitNameByPersonId(personId) return unitPointerService.getUnitNameByPersonId(personId)
.onItem().transform( .onItem().transform(
@ -62,7 +62,7 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public Uni<Set<MainUnit<Mail>>> getNextUnitByPersonId(@NotNull Long personId) { public Uni<Set<MainUnit<Mail>>> getNextUnitByPersonId(@NotNull String personId) {
return getUnitNameByPersonId(personId) return getUnitNameByPersonId(personId)
.flatMap( .flatMap(
unit -> { unit -> {
@ -86,10 +86,10 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public Uni<Void> save(Long personId, String unitName, Mail mail) { public Uni<Void> save(String personId, String unitName, Mail mail) {
isNotNull(personId, unitName, mail); isNotNull(personId, unitName, mail);
return unitPointerService.save(new UnitPointer(personId, unitName)) return unitPointerService.save(new UnitPointer(personId, unitName))
.map(u -> { .onItem().transformToUni(u -> {
final StorylineHistory storylineHistory = new StorylineHistory(); final StorylineHistory storylineHistory = new StorylineHistory();
storylineHistory.setPersonId(personId); storylineHistory.setPersonId(personId);
storylineHistory.setUnitName(unitName); storylineHistory.setUnitName(unitName);
@ -99,12 +99,12 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public Uni<StorylineHistory> replaceUserToBack(long personId, int countUnitsToBack) { public Uni<StorylineHistory> replaceUserToBack(String personId, int countUnitsToBack) {
return storylineRepository.findByCountLast(personId, countUnitsToBack); return storylineRepository.findByCountLast(personId, countUnitsToBack);
} }
@Override @Override
public Uni<StorylineHistory> replaceUserToBack(long personId, String unitName) { public Uni<StorylineHistory> replaceUserToBack(String personId, String unitName) {
return storylineRepository.findByCountLast(personId, unitName); return storylineRepository.findByCountLast(personId, unitName);
} }

View File

@ -13,15 +13,15 @@ public interface StorylineService<M extends Message> {
Uni<Void> save(@NotNull StorylineHistory storylineHistory); Uni<Void> save(@NotNull StorylineHistory storylineHistory);
Uni<MainUnit<M>> getUnitNameByPersonId(@NotNull Long personId); Uni<MainUnit<M>> getUnitNameByPersonId(@NotNull String personId);
Uni<Set<MainUnit<M>>> getNextUnitByPersonId(@NotNull Long personId); Uni<Set<MainUnit<M>>> getNextUnitByPersonId(@NotNull String personId);
Uni<Void> save(Long personId, String name, M message); Uni<Void> save(String personId, String name, M message);
Uni<StorylineHistory> replaceUserToBack(long personId, int countUnitsToBack); Uni<StorylineHistory> replaceUserToBack(String personId, int countUnitsToBack);
Uni<StorylineHistory> replaceUserToBack(long personId, String unitName); Uni<StorylineHistory> replaceUserToBack(String personId, String unitName);
Optional<MainUnit<M>> getDefaultUnit(); Optional<MainUnit<M>> getDefaultUnit();

View File

@ -20,12 +20,12 @@ public class UnitPointerServiceImpl implements UnitPointerService {
} }
@Override @Override
public Uni<String> getUnitNameByPersonId(@NotNull Long personId) { public Uni<String> getUnitNameByPersonId(@NotNull String personId) {
return unitPointerRepository.findUnitNameByPersonId(personId); return unitPointerRepository.findUnitNameByPersonId(personId);
} }
@Override @Override
public Uni<Void> removeByPersonId(@NotNull Long personId) { public Uni<Void> removeByPersonId(@NotNull String personId) {
return unitPointerRepository.removeByPersonId(personId); return unitPointerRepository.removeByPersonId(personId);
} }

View File

@ -7,6 +7,6 @@ import java.util.List;
@FunctionalInterface @FunctionalInterface
public interface Insert { public interface Insert {
Uni<List<String>> insert(Long personId); Uni<List<String>> insert(String personId);
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>bot-core</artifactId> <artifactId>bot-core</artifactId>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -89,10 +89,10 @@ public class GeneralAutoResponder<M extends Message> {
public void processingNewMessages(List<M> newMessages) { public void processingNewMessages(List<M> newMessages) {
if (newMessages != null && !newMessages.isEmpty()) { if (newMessages != null && !newMessages.isEmpty()) {
final Set<Long> personIds = newMessages.stream() final Set<String> personIds = newMessages.stream()
.map(Message::getPersonId) .map(Message::getPersonId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
final Set<Long> disableIds = personSettingService.getAllPersonIdDisableMessages(personIds); final Set<String> disableIds = personSettingService.getAllPersonIdDisableMessages(personIds);
final List<M> allowedMessages = newMessages.stream() final List<M> allowedMessages = newMessages.stream()
.filter(message -> !disableIds.contains(message.getPersonId())) .filter(message -> !disableIds.contains(message.getPersonId()))
.toList(); .toList();

View File

@ -24,7 +24,7 @@ public class AnswerSaveAction<M extends Message, D> implements ActionUnit<Answer
final M message = unitRequest.getMessage(); final M message = unitRequest.getMessage();
final AnswerSavePreservable<D> preservable = answerSave.getPreservable(); final AnswerSavePreservable<D> preservable = answerSave.getPreservable();
final Long personId = message.getPersonId(); final String personId = message.getPersonId();
final CheckSave<M> checkSave = answerSave.getCheckSave(); final CheckSave<M> checkSave = answerSave.getCheckSave();
if (checkNotNull(checkSave)) { if (checkNotNull(checkSave)) {

View File

@ -9,18 +9,18 @@ import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
public class UserSanderPusher implements Pusher<String> { public class UserSanderPusher implements Pusher<String> {
private final Long personId; private final String personId;
private final String nameForm; private final String nameForm;
private final Sending sending; private final Sending sending;
public UserSanderPusher(Long personId, String nameForm, Sending sending) { public UserSanderPusher(String personId, String nameForm, Sending sending) {
this.personId = personId; this.personId = personId;
this.nameForm = nameForm; this.nameForm = nameForm;
this.sending = sending; this.sending = sending;
} }
@Override @Override
public void push(Long personId, Map<String, String> saveElement) { public void push(String personId, Map<String, String> saveElement) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("========= ").append(nameForm).append(" =========\n"); stringBuilder.append("========= ").append(nameForm).append(" =========\n");
saveElement.forEach((key, value) -> stringBuilder.append(key).append(": ").append(value).append("\n")); saveElement.forEach((key, value) -> stringBuilder.append(key).append(": ").append(value).append("\n"));

View File

@ -17,24 +17,24 @@ public class PersonSettingServiceImpl implements PersonSettingService {
} }
@Override @Override
public Set<Long> getAllPersonIdDisableMessages(@NotNull Set<Long> personIds) { public Set<String> getAllPersonIdDisableMessages(@NotNull Set<String> personIds) {
Inspector.isNotNull(personIds); Inspector.isNotNull(personIds);
return personSettingRepository.findAllByAllowedProcessing(personIds); return personSettingRepository.findAllByAllowedProcessing(personIds);
} }
@Override @Override
public Optional<Boolean> getStateProcessingByPersonId(@NotNull Long personId) { public Optional<Boolean> getStateProcessingByPersonId(@NotNull String personId) {
return personSettingRepository.findStateByPersonId(personId); return personSettingRepository.findStateByPersonId(personId);
} }
@Override @Override
public void disableMessageProcessing(@NotNull Long personId) { public void disableMessageProcessing(@NotNull String personId) {
Inspector.isNotNull(personId); Inspector.isNotNull(personId);
personSettingRepository.disableMessageProcessing(personId); personSettingRepository.disableMessageProcessing(personId);
} }
@Override @Override
public void enableMessageProcessing(@NotNull Long personId) { public void enableMessageProcessing(@NotNull String personId) {
Inspector.isNotNull(personId); Inspector.isNotNull(personId);
personSettingRepository.enableMessageProcessing(personId); personSettingRepository.enableMessageProcessing(personId);
} }

View File

@ -13,14 +13,14 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull;
public class StorylineContextMapImpl implements StorylineContext { public class StorylineContextMapImpl implements StorylineContext {
private final Map<Long, Map<String, Object>> map = new HashMap<>(); private final Map<String, Map<String, Object>> 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); isNotNull(personId, key);
map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave); map.computeIfAbsent(personId, k -> new HashMap<>()).put(key.getValue(), objectForSave);
} }
public <T> Optional<T> getByKey(@NotNull Long personId, @NotNull ContextKey<T> key) { public <T> Optional<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key) {
isNotNull(personId, key); isNotNull(personId, key);
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
final Map<String, Object> storage = map.get(personId); final Map<String, Object> storage = map.get(personId);
@ -33,21 +33,21 @@ public class StorylineContextMapImpl implements StorylineContext {
} }
@Override @Override
public <T> T getByKeyOrThrow(@NotNull Long personId, @NotNull ContextKey<T> key) { public <T> T getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey<T> key) {
return getByKey(personId, key).orElseThrow(notFoundException("Не найдено значение ключа {0}, для пользователя {1}", key.getValue(), personId)); return getByKey(personId, key).orElseThrow(notFoundException("Не найдено значение ключа {0}, для пользователя {1}", key.getValue(), personId));
} }
public Map<String, Object> getAllSaveElement(@NotNull Long personId) { public Map<String, Object> getAllSaveElement(@NotNull String personId) {
isNotNull(personId); isNotNull(personId);
return map.get(personId); return map.get(personId);
} }
public void removeAll(@NotNull Long personId) { public void removeAll(@NotNull String personId) {
isNotNull(personId); isNotNull(personId);
map.remove(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); isNotNull(personId, key);
map.computeIfAbsent(personId, k -> new HashMap<>()).remove(key.getValue()); map.computeIfAbsent(personId, k -> new HashMap<>()).remove(key.getValue());
} }

View File

@ -44,14 +44,14 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public Optional<MainUnit<Mail>> getUnitNameByPersonId(@NotNull Long personId) { public Optional<MainUnit<Mail>> getUnitNameByPersonId(@NotNull String personId) {
isNotNull(personId); isNotNull(personId);
return unitPointerService.getUnitNameByPersonId(personId) return unitPointerService.getUnitNameByPersonId(personId)
.flatMap(storyLine::getUnit); .flatMap(storyLine::getUnit);
} }
@Override @Override
public Set<MainUnit<Mail>> getNextUnitByPersonId(@NotNull Long personId) { public Set<MainUnit<Mail>> getNextUnitByPersonId(@NotNull String personId) {
final Optional<Set<MainUnit<Mail>>> optMainUnits = getUnitNameByPersonId(personId) final Optional<Set<MainUnit<Mail>>> optMainUnits = getUnitNameByPersonId(personId)
.map(Unit::getNextUnits) .map(Unit::getNextUnits)
.filter(mainUnits -> !mainUnits.isEmpty()); .filter(mainUnits -> !mainUnits.isEmpty());
@ -64,7 +64,7 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public void save(Long personId, String unitName, Mail mail) { public void save(String personId, String unitName, Mail mail) {
isNotNull(personId, unitName, mail); isNotNull(personId, unitName, mail);
unitPointerService.save(new UnitPointer(personId, unitName)); unitPointerService.save(new UnitPointer(personId, unitName));
@ -76,12 +76,12 @@ public class StorylineMailService implements StorylineService<Mail> {
} }
@Override @Override
public Optional<StorylineHistory> replaceUserToBack(long personId, int countUnitsToBack) { public Optional<StorylineHistory> replaceUserToBack(String personId, int countUnitsToBack) {
return storylineRepository.findByCountLast(personId, countUnitsToBack); return storylineRepository.findByCountLast(personId, countUnitsToBack);
} }
@Override @Override
public Optional<StorylineHistory> replaceUserToBack(long personId, String unitName) { public Optional<StorylineHistory> replaceUserToBack(String personId, String unitName) {
return storylineRepository.findByCountLast(personId, unitName); return storylineRepository.findByCountLast(personId, unitName);
} }

View File

@ -12,15 +12,15 @@ public interface StorylineService<M extends Message> {
void save(@NotNull StorylineHistory storylineHistory); void save(@NotNull StorylineHistory storylineHistory);
Optional<MainUnit<M>> getUnitNameByPersonId(@NotNull Long personId); Optional<MainUnit<M>> getUnitNameByPersonId(@NotNull String personId);
Set<MainUnit<M>> getNextUnitByPersonId(@NotNull Long personId); Set<MainUnit<M>> getNextUnitByPersonId(@NotNull String personId);
void save(Long personId, String name, M message); void save(String personId, String name, M message);
Optional<StorylineHistory> replaceUserToBack(long personId, int countUnitsToBack); Optional<StorylineHistory> replaceUserToBack(String personId, int countUnitsToBack);
Optional<StorylineHistory> replaceUserToBack(long personId, String unitName); Optional<StorylineHistory> replaceUserToBack(String personId, String unitName);
Optional<MainUnit<M>> getDefaultUnit(); Optional<MainUnit<M>> getDefaultUnit();

View File

@ -21,12 +21,12 @@ public class UnitPointerServiceImpl implements UnitPointerService {
} }
@Override @Override
public Optional<String> getUnitNameByPersonId(@NotNull Long personId) { public Optional<String> getUnitNameByPersonId(@NotNull String personId) {
return unitPointerRepository.findUnitNameByPersonId(personId); return unitPointerRepository.findUnitNameByPersonId(personId);
} }
@Override @Override
public void removeByPersonId(@NotNull Long personId) { public void removeByPersonId(@NotNull String personId) {
unitPointerRepository.removeByPersonId(personId); unitPointerRepository.removeByPersonId(personId);
} }

View File

@ -5,6 +5,6 @@ import java.util.List;
@FunctionalInterface @FunctionalInterface
public interface Insert { public interface Insert {
List<String> insert(Long personId); List<String> insert(String personId);
} }

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>godfather-bot</artifactId> <artifactId>godfather-bot</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<artifactId>bot-core</artifactId> <artifactId>bot-core</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>bot-data</artifactId> <artifactId>bot-data</artifactId>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-data</artifactId> <artifactId>bot-data</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -8,16 +8,16 @@ import java.util.Map;
public interface StorylineContext { public interface StorylineContext {
Uni<Void> save(@NotNull Long telegramId, @NotNull ContextKey<?> key, Object objectForSave); Uni<Void> save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave);
<T> Uni<T> getByKey(@NotNull Long telegramId, @NotNull ContextKey<T> key); <T> Uni<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key);
<T> Uni<T> getByKeyOrThrow(@NotNull Long telegramId, @NotNull ContextKey<T> key); <T> Uni<T> getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey<T> key);
Uni<Map<String, Object>> getAllSaveElement(@NotNull Long telegramId); Uni<Map<String, Object>> getAllSaveElement(@NotNull String personId);
Uni<Void> removeAll(@NotNull Long telegramId); Uni<Void> removeAll(@NotNull String personId);
Uni<Void> removeByKey(@NotNull Long telegramId, @NotNull ContextKey<?> key); Uni<Void> removeByKey(@NotNull String personId, @NotNull ContextKey<?> key);
} }

View File

@ -10,6 +10,6 @@ public interface AnswerSavePreservable<T> extends Preservable<T> {
* *
* @param personId Идентификатор пользователя * @param personId Идентификатор пользователя
*/ */
Uni<Void> push(Long personId, Pusher<T> pusher); Uni<Void> push(String personId, Pusher<T> pusher);
} }

View File

@ -17,10 +17,10 @@ public interface Preservable<S> {
* @param personId Идентификатор пользователя * @param personId Идентификатор пользователя
* @param save Объект данных * @param save Объект данных
*/ */
Uni<Void> save(Long personId, String key, S save); Uni<Void> save(String personId, String key, S save);
Uni<S> getByKey(Long personId, String key); Uni<S> getByKey(String personId, String key);
Uni<Map<String, S>> getAllSaveElement(Long personId); Uni<Map<String, S>> getAllSaveElement(String personId);
} }

View File

@ -6,12 +6,12 @@ import java.util.Set;
public interface PersonSettingRepository { public interface PersonSettingRepository {
Uni<Set<Long>> findAllByAllowedProcessing(Set<Long> personIds); Uni<Set<String>> findAllByAllowedProcessing(Set<String> personIds);
Uni<Void> disableMessageProcessing(Long personId); Uni<Void> disableMessageProcessing(String personId);
Uni<Void> enableMessageProcessing(Long personId); Uni<Void> enableMessageProcessing(String personId);
Uni<Boolean> findStateByPersonId(Long personId); Uni<Boolean> findStateByPersonId(String personId);
} }

View File

@ -8,10 +8,10 @@ public interface StorylineRepository {
Uni<Void> save(@NotNull StorylineHistory storylineHistory); Uni<Void> save(@NotNull StorylineHistory storylineHistory);
Uni<StorylineHistory> findByCountLast(long personId, int countUnitsToBack); Uni<StorylineHistory> findByCountLast(String personId, int countUnitsToBack);
Uni<StorylineHistory> findByCountLast(long personId, String unitName); Uni<StorylineHistory> findByCountLast(String personId, String unitName);
Uni<Void> cleanHistoryByPersonId(@NotNull Long personId); Uni<Void> cleanHistoryByPersonId(@NotNull String personId);
} }

View File

@ -11,8 +11,8 @@ public interface UnitPointerRepository {
Uni<UnitPointer> save(@NotNull UnitPointer unitPointer); Uni<UnitPointer> save(@NotNull UnitPointer unitPointer);
Uni<String> findUnitNameByPersonId(@NotNull Long personId); Uni<String> findUnitNameByPersonId(@NotNull String personId);
Uni<Void> removeByPersonId(@NotNull Long personId); Uni<Void> removeByPersonId(@NotNull String personId);
} }

View File

@ -12,16 +12,16 @@ import static dev.struchkov.haiti.utils.Checker.checkNotNull;
public class AnswerSaveMapPreservable<S> implements AnswerSavePreservable<S> { public class AnswerSaveMapPreservable<S> implements AnswerSavePreservable<S> {
private final Map<Long, Map<String, S>> saveMap = new HashMap<>(); private final Map<String, Map<String, S>> saveMap = new HashMap<>();
@Override @Override
public Uni<Void> save(Long personId, String key, S save) { public Uni<Void> save(String personId, String key, S save) {
saveMap.computeIfAbsent(personId, k -> new HashMap<>()).put(key, save); saveMap.computeIfAbsent(personId, k -> new HashMap<>()).put(key, save);
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
@Override @Override
public Uni<S> getByKey(Long personId, String key) { public Uni<S> getByKey(String personId, String key) {
if (saveMap.containsKey(personId) if (saveMap.containsKey(personId)
&& saveMap.get(personId).containsKey(key)) { && saveMap.get(personId).containsKey(key)) {
return Uni.createFrom().item(saveMap.get(personId).get(key)); return Uni.createFrom().item(saveMap.get(personId).get(key));
@ -30,12 +30,12 @@ public class AnswerSaveMapPreservable<S> implements AnswerSavePreservable<S> {
} }
@Override @Override
public Uni<Map<String, S>> getAllSaveElement(Long personId) { public Uni<Map<String, S>> getAllSaveElement(String personId) {
return Uni.createFrom().item(saveMap.get(personId)); return Uni.createFrom().item(saveMap.get(personId));
} }
@Override @Override
public Uni<Void> push(Long personId, Pusher<S> pusher) { public Uni<Void> push(String personId, Pusher<S> pusher) {
if (checkNotNull(pusher)) { if (checkNotNull(pusher)) {
return getAllSaveElement(personId).onItem() return getAllSaveElement(personId).onItem()
.transformToUni( .transformToUni(

View File

@ -10,10 +10,10 @@ import java.util.stream.Collectors;
public class PersonSettingLocalRepository implements PersonSettingRepository { public class PersonSettingLocalRepository implements PersonSettingRepository {
private final Map<Long, Boolean> map = new HashMap<>(); private final Map<String, Boolean> map = new HashMap<>();
@Override @Override
public Uni<Set<Long>> findAllByAllowedProcessing(Set<Long> personIds) { public Uni<Set<String>> findAllByAllowedProcessing(Set<String> personIds) {
return Uni.createFrom().item( return Uni.createFrom().item(
personIds.stream() personIds.stream()
.filter(map::get) .filter(map::get)
@ -22,19 +22,19 @@ public class PersonSettingLocalRepository implements PersonSettingRepository {
} }
@Override @Override
public Uni<Void> disableMessageProcessing(Long personId) { public Uni<Void> disableMessageProcessing(String personId) {
map.put(personId, false); map.put(personId, false);
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
@Override @Override
public Uni<Void> enableMessageProcessing(Long personId) { public Uni<Void> enableMessageProcessing(String personId) {
map.put(personId, true); map.put(personId, true);
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
@Override @Override
public Uni<Boolean> findStateByPersonId(Long personId) { public Uni<Boolean> findStateByPersonId(String personId) {
return Uni.createFrom().item(map.get(personId)); return Uni.createFrom().item(map.get(personId));
} }

View File

@ -13,19 +13,19 @@ import java.util.Stack;
public class StorylineMapRepository implements StorylineRepository { public class StorylineMapRepository implements StorylineRepository {
private final Map<Long, Stack<StorylineHistory>> map = new HashMap<>(); private final Map<String, Stack<StorylineHistory>> map = new HashMap<>();
private final Map<Long, Set<String>> historyUnitName = new HashMap<>(); private final Map<String, Set<String>> historyUnitName = new HashMap<>();
@Override @Override
public Uni<Void> save(@NotNull StorylineHistory history) { public Uni<Void> save(@NotNull StorylineHistory history) {
final Long personId = history.getPersonId(); final String personId = history.getPersonId();
map.computeIfAbsent(personId, k -> new Stack<>()).push(history); map.computeIfAbsent(personId, k -> new Stack<>()).push(history);
historyUnitName.computeIfAbsent(personId, k -> new HashSet<>()).add(history.getUnitName()); historyUnitName.computeIfAbsent(personId, k -> new HashSet<>()).add(history.getUnitName());
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
@Override @Override
public Uni<StorylineHistory> findByCountLast(long personId, int countUnitsToBack) { public Uni<StorylineHistory> findByCountLast(String personId, int countUnitsToBack) {
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
final Stack<StorylineHistory> stack = map.get(personId); final Stack<StorylineHistory> stack = map.get(personId);
if (stack.size() < countUnitsToBack) { if (stack.size() < countUnitsToBack) {
@ -42,7 +42,7 @@ public class StorylineMapRepository implements StorylineRepository {
} }
@Override @Override
public Uni<StorylineHistory> findByCountLast(long personId, String unitName) { public Uni<StorylineHistory> findByCountLast(String personId, String unitName) {
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
final Stack<StorylineHistory> stack = map.get(personId); final Stack<StorylineHistory> stack = map.get(personId);
StorylineHistory storylineHistory; StorylineHistory storylineHistory;
@ -58,7 +58,7 @@ public class StorylineMapRepository implements StorylineRepository {
} }
@Override @Override
public Uni<Void> cleanHistoryByPersonId(@NotNull Long personId) { public Uni<Void> cleanHistoryByPersonId(@NotNull String personId) {
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
map.get(personId).clear(); map.get(personId).clear();
} else { } else {

View File

@ -10,7 +10,7 @@ import java.util.Map;
public class UnitPointLocalRepository implements UnitPointerRepository { public class UnitPointLocalRepository implements UnitPointerRepository {
public final Map<Long, String> map = new HashMap<>(); public final Map<String, String> map = new HashMap<>();
@Override @Override
public Uni<UnitPointer> save(@NotNull UnitPointer unitPointer) { public Uni<UnitPointer> save(@NotNull UnitPointer unitPointer) {
@ -19,12 +19,12 @@ public class UnitPointLocalRepository implements UnitPointerRepository {
} }
@Override @Override
public Uni<String> findUnitNameByPersonId(@NotNull Long personId) { public Uni<String> findUnitNameByPersonId(@NotNull String personId) {
return Uni.createFrom().item(map.get(personId)); return Uni.createFrom().item(map.get(personId));
} }
@Override @Override
public Uni<Void> removeByPersonId(@NotNull Long personId) { public Uni<Void> removeByPersonId(@NotNull String personId) {
map.remove(personId); map.remove(personId);
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>bot-data</artifactId> <artifactId>bot-data</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -8,16 +8,16 @@ import java.util.Optional;
public interface StorylineContext { public interface StorylineContext {
void save(@NotNull Long telegramId, @NotNull ContextKey<?> key, Object objectForSave); void save(@NotNull String personId, @NotNull ContextKey<?> key, Object objectForSave);
<T> Optional<T> getByKey(@NotNull Long telegramId, @NotNull ContextKey<T> key); <T> Optional<T> getByKey(@NotNull String personId, @NotNull ContextKey<T> key);
<T> T getByKeyOrThrow(@NotNull Long telegramId, @NotNull ContextKey<T> key); <T> T getByKeyOrThrow(@NotNull String personId, @NotNull ContextKey<T> key);
Map<String, Object> getAllSaveElement(@NotNull Long telegramId); Map<String, Object> 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);
} }

View File

@ -9,6 +9,6 @@ public interface AnswerSavePreservable<T> extends Preservable<T> {
* *
* @param personId Идентификатор пользователя * @param personId Идентификатор пользователя
*/ */
void push(Long personId, Pusher<T> pusher); void push(String personId, Pusher<T> pusher);
} }

View File

@ -16,10 +16,10 @@ public interface Preservable<S> {
* @param personId Идентификатор пользователя * @param personId Идентификатор пользователя
* @param save Объект данных * @param save Объект данных
*/ */
void save(Long personId, String key, S save); void save(String personId, String key, S save);
Optional<S> getByKey(Long personId, String key); Optional<S> getByKey(String personId, String key);
Map<String, S> getAllSaveElement(Long personId); Map<String, S> getAllSaveElement(String personId);
} }

View File

@ -5,12 +5,12 @@ import java.util.Set;
public interface PersonSettingRepository { public interface PersonSettingRepository {
Set<Long> findAllByAllowedProcessing(Set<Long> personIds); Set<String> findAllByAllowedProcessing(Set<String> personIds);
void disableMessageProcessing(Long personId); void disableMessageProcessing(String personId);
void enableMessageProcessing(Long personId); void enableMessageProcessing(String personId);
Optional<Boolean> findStateByPersonId(Long personId); Optional<Boolean> findStateByPersonId(String personId);
} }

View File

@ -9,10 +9,10 @@ public interface StorylineRepository {
void save(@NotNull StorylineHistory storylineHistory); void save(@NotNull StorylineHistory storylineHistory);
Optional<StorylineHistory> findByCountLast(long personId, int countUnitsToBack); Optional<StorylineHistory> findByCountLast(String personId, int countUnitsToBack);
Optional<StorylineHistory> findByCountLast(long personId, String unitName); Optional<StorylineHistory> findByCountLast(String personId, String unitName);
void cleanHistoryByPersonId(@NotNull Long personId); void cleanHistoryByPersonId(@NotNull String personId);
} }

View File

@ -12,8 +12,8 @@ public interface UnitPointerRepository {
UnitPointer save(@NotNull UnitPointer unitPointer); UnitPointer save(@NotNull UnitPointer unitPointer);
Optional<String> findUnitNameByPersonId(@NotNull Long personId); Optional<String> findUnitNameByPersonId(@NotNull String personId);
void removeByPersonId(@NotNull Long personId); void removeByPersonId(@NotNull String personId);
} }

View File

@ -9,15 +9,15 @@ import java.util.Optional;
public class AnswerSaveMapPreservable<S> implements AnswerSavePreservable<S> { public class AnswerSaveMapPreservable<S> implements AnswerSavePreservable<S> {
private final Map<Long, Map<String, S>> saveMap = new HashMap<>(); private final Map<String, Map<String, S>> saveMap = new HashMap<>();
@Override @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); saveMap.computeIfAbsent(personId, k -> new HashMap<>()).put(key, save);
} }
@Override @Override
public Optional<S> getByKey(Long personId, String key) { public Optional<S> getByKey(String personId, String key) {
if (saveMap.containsKey(personId) if (saveMap.containsKey(personId)
&& saveMap.get(personId).containsKey(key)) { && saveMap.get(personId).containsKey(key)) {
return Optional.of(saveMap.get(personId).get(key)); return Optional.of(saveMap.get(personId).get(key));
@ -26,12 +26,12 @@ public class AnswerSaveMapPreservable<S> implements AnswerSavePreservable<S> {
} }
@Override @Override
public Map<String, S> getAllSaveElement(Long personId) { public Map<String, S> getAllSaveElement(String personId) {
return saveMap.get(personId); return saveMap.get(personId);
} }
@Override @Override
public void push(Long personId, Pusher<S> pusher) { public void push(String personId, Pusher<S> pusher) {
Optional.ofNullable(pusher).ifPresent(sPusher -> sPusher.push(personId, getAllSaveElement(personId))); Optional.ofNullable(pusher).ifPresent(sPusher -> sPusher.push(personId, getAllSaveElement(personId)));
} }

View File

@ -10,27 +10,27 @@ import java.util.stream.Collectors;
public class PersonSettingLocalRepository implements PersonSettingRepository { public class PersonSettingLocalRepository implements PersonSettingRepository {
private final Map<Long, Boolean> map = new HashMap<>(); private final Map<String, Boolean> map = new HashMap<>();
@Override @Override
public Set<Long> findAllByAllowedProcessing(Set<Long> personIds) { public Set<String> findAllByAllowedProcessing(Set<String> personIds) {
return personIds.stream() return personIds.stream()
.filter(map::get) .filter(map::get)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
@Override @Override
public void disableMessageProcessing(Long personId) { public void disableMessageProcessing(String personId) {
map.put(personId, false); map.put(personId, false);
} }
@Override @Override
public void enableMessageProcessing(Long personId) { public void enableMessageProcessing(String personId) {
map.put(personId, true); map.put(personId, true);
} }
@Override @Override
public Optional<Boolean> findStateByPersonId(Long personId) { public Optional<Boolean> findStateByPersonId(String personId) {
return Optional.ofNullable(map.get(personId)); return Optional.ofNullable(map.get(personId));
} }

View File

@ -13,18 +13,18 @@ import java.util.Stack;
public class StorylineMapRepository implements StorylineRepository { public class StorylineMapRepository implements StorylineRepository {
private final Map<Long, Stack<StorylineHistory>> map = new HashMap<>(); private final Map<String, Stack<StorylineHistory>> map = new HashMap<>();
private final Map<Long, Set<String>> historyUnitName = new HashMap<>(); private final Map<String, Set<String>> historyUnitName = new HashMap<>();
@Override @Override
public void save(@NotNull StorylineHistory history) { public void save(@NotNull StorylineHistory history) {
final Long personId = history.getPersonId(); final String personId = history.getPersonId();
map.computeIfAbsent(personId, k -> new Stack<>()).push(history); map.computeIfAbsent(personId, k -> new Stack<>()).push(history);
historyUnitName.computeIfAbsent(personId, k -> new HashSet<>()).add(history.getUnitName()); historyUnitName.computeIfAbsent(personId, k -> new HashSet<>()).add(history.getUnitName());
} }
@Override @Override
public Optional<StorylineHistory> findByCountLast(long personId, int countUnitsToBack) { public Optional<StorylineHistory> findByCountLast(String personId, int countUnitsToBack) {
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
final Stack<StorylineHistory> stack = map.get(personId); final Stack<StorylineHistory> stack = map.get(personId);
if (stack.size() < countUnitsToBack) { if (stack.size() < countUnitsToBack) {
@ -41,7 +41,7 @@ public class StorylineMapRepository implements StorylineRepository {
} }
@Override @Override
public Optional<StorylineHistory> findByCountLast(long personId, String unitName) { public Optional<StorylineHistory> findByCountLast(String personId, String unitName) {
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
final Stack<StorylineHistory> stack = map.get(personId); final Stack<StorylineHistory> stack = map.get(personId);
StorylineHistory storylineHistory; StorylineHistory storylineHistory;
@ -57,7 +57,7 @@ public class StorylineMapRepository implements StorylineRepository {
} }
@Override @Override
public void cleanHistoryByPersonId(@NotNull Long personId) { public void cleanHistoryByPersonId(@NotNull String personId) {
if (map.containsKey(personId)) { if (map.containsKey(personId)) {
map.get(personId).clear(); map.get(personId).clear();
} else { } else {

View File

@ -10,7 +10,7 @@ import java.util.Optional;
public class UnitPointLocalRepository implements UnitPointerRepository { public class UnitPointLocalRepository implements UnitPointerRepository {
public final Map<Long, String> map = new HashMap<>(); public final Map<String, String> map = new HashMap<>();
@Override @Override
public UnitPointer save(@NotNull UnitPointer unitPointer) { public UnitPointer save(@NotNull UnitPointer unitPointer) {
@ -19,12 +19,12 @@ public class UnitPointLocalRepository implements UnitPointerRepository {
} }
@Override @Override
public Optional<String> findUnitNameByPersonId(@NotNull Long personId) { public Optional<String> findUnitNameByPersonId(@NotNull String personId) {
return Optional.ofNullable(map.get(personId)); return Optional.ofNullable(map.get(personId));
} }
@Override @Override
public void removeByPersonId(@NotNull Long personId) { public void removeByPersonId(@NotNull String personId) {
map.remove(personId); map.remove(personId);
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>godfather-bot</artifactId> <artifactId>godfather-bot</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>bot-domain</artifactId> <artifactId>bot-domain</artifactId>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,15 +5,15 @@ import dev.struchkov.godfather.main.domain.content.Message;
public class StorylineHistory { public class StorylineHistory {
private Long personId; private String personId;
private String unitName; private String unitName;
private Message message; private Message message;
public Long getPersonId() { public String getPersonId() {
return personId; return personId;
} }
public void setPersonId(Long personId) { public void setPersonId(String personId) {
this.personId = personId; this.personId = personId;
} }

View File

@ -4,15 +4,15 @@ import java.util.Objects;
public class UnitPointer { public class UnitPointer {
private Long personId; private String personId;
private String unitName; private String unitName;
public UnitPointer(Long personId, String unitName) { public UnitPointer(String personId, String unitName) {
this.personId = personId; this.personId = personId;
this.unitName = unitName; this.unitName = unitName;
} }
public Long getPersonId() { public String getPersonId() {
return personId; return personId;
} }

View File

@ -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; this.createDate = createDate;
} }
public Long getPersonId() { public String getPersonId() {
return personId; return personId;
} }
public void setPersonId(Long personId) { public void setPersonId(String personId) {
this.personId = personId; this.personId = personId;
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>godfather-bot</artifactId> <artifactId>godfather-bot</artifactId>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>godfather-bot</artifactId> <artifactId>godfather-bot</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<groupId>dev.struchkov.godfather</groupId> <groupId>dev.struchkov.godfather</groupId>
<artifactId>godfather-bot</artifactId> <artifactId>godfather-bot</artifactId>
<version>0.0.27</version> <version>0.0.29</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>