Рефакторинг
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-02-18 20:45:30 +03:00
parent ad3e3932df
commit ce43c3cc82
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
81 changed files with 177 additions and 344 deletions

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.data.repository;
package dev.struchkov.godfather.quarkus.context.repository;
import io.smallrye.mutiny.Uni;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.data;
package dev.struchkov.godfather.quarkus.context.repository;
import dev.struchkov.haiti.utils.container.ContextKey;
import io.smallrye.mutiny.Uni;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.data.repository;
package dev.struchkov.godfather.quarkus.context.repository;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import io.smallrye.mutiny.Uni;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.data.repository;
package dev.struchkov.godfather.quarkus.context.repository;
import dev.struchkov.godfather.main.domain.UnitPointer;
import io.smallrye.mutiny.Uni;

View File

@ -1,10 +0,0 @@
package dev.struchkov.godfather.quarkus.context.service;
import dev.struchkov.godfather.main.domain.content.Message;
import io.smallrye.mutiny.Uni;
public interface Accessibility {
Uni<Void> check(Message message);
}

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.data.repository;
package dev.struchkov.godfather.simple.context.repository;
import java.util.Optional;
import java.util.Set;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.data;
package dev.struchkov.godfather.simple.context.repository;
import dev.struchkov.haiti.utils.container.ContextKey;
import org.jetbrains.annotations.NotNull;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.data.repository;
package dev.struchkov.godfather.simple.context.repository;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import org.jetbrains.annotations.NotNull;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.data.repository;
package dev.struchkov.godfather.simple.context.repository;
import dev.struchkov.godfather.main.domain.UnitPointer;
import org.jetbrains.annotations.NotNull;

View File

@ -2,9 +2,9 @@ package dev.struchkov.godfather.quarkus.core;
import dev.struchkov.autoresponder.Responder;
import dev.struchkov.godfather.exception.ConfigAppException;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.quarkus.context.service.ErrorHandler;
import dev.struchkov.godfather.quarkus.context.service.Modifiable;
import dev.struchkov.godfather.quarkus.context.service.PersonSettingService;
@ -15,8 +15,8 @@ import dev.struchkov.godfather.quarkus.core.action.AnswerSaveAction;
import dev.struchkov.godfather.quarkus.core.action.AnswerTextAction;
import dev.struchkov.godfather.quarkus.core.action.cmd.ReplaceCmdAction;
import dev.struchkov.godfather.quarkus.core.service.StorylineService;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import dev.struchkov.haiti.context.exception.NotFoundException;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.quarkus.core;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;

View File

@ -4,7 +4,7 @@ import dev.struchkov.godfather.exception.UnitConfigException;
import dev.struchkov.godfather.main.domain.UnitDefinition;
import dev.struchkov.godfather.main.domain.annotation.Unit;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.haiti.utils.Inspector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,8 +1,8 @@
package dev.struchkov.godfather.quarkus.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import io.smallrye.mutiny.Uni;
/**

View File

@ -2,10 +2,10 @@ package dev.struchkov.godfather.quarkus.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Sending;
import dev.struchkov.godfather.quarkus.core.unit.AnswerCheck;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
import dev.struchkov.godfather.quarkus.domain.unit.AnswerCheck;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import io.smallrye.mutiny.Uni;
import java.util.Objects;

View File

@ -1,13 +1,13 @@
package dev.struchkov.godfather.quarkus.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Pusher;
import dev.struchkov.godfather.quarkus.core.unit.AnswerSave;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.core.unit.func.CheckSave;
import dev.struchkov.godfather.quarkus.core.unit.func.PreservableData;
import dev.struchkov.godfather.quarkus.data.preser.AnswerSavePreservable;
import dev.struchkov.godfather.quarkus.domain.unit.AnswerSave;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.unit.func.CheckSave;
import dev.struchkov.godfather.quarkus.domain.unit.func.PreservableData;
import dev.struchkov.godfather.quarkus.domain.unit.func.Pusher;
import dev.struchkov.godfather.quarkus.domain.unit.func.preser.AnswerSavePreservable;
import io.smallrye.mutiny.Uni;
import static dev.struchkov.haiti.utils.Checker.checkNotNull;

View File

@ -2,11 +2,10 @@ package dev.struchkov.godfather.quarkus.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Sending;
import dev.struchkov.godfather.quarkus.core.unit.AnswerText;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.core.unit.func.ActionBeforeSending;
import dev.struchkov.godfather.quarkus.core.unit.func.CallBackConsumer;
import dev.struchkov.godfather.quarkus.domain.unit.AnswerText;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.unit.func.CallBackConsumer;
import io.smallrye.mutiny.Uni;
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
@ -20,35 +19,16 @@ public class AnswerTextAction implements ActionUnit<AnswerText<Message>, Message
private final Sending sending;
private ActionBeforeSending actionBeforeSending;
public AnswerTextAction(Sending sending) {
this.sending = sending;
}
public void setActionBeforeSending(ActionBeforeSending actionBeforeSending) {
this.actionBeforeSending = actionBeforeSending;
}
@Override
public Uni<UnitRequest<MainUnit, Message>> action(UnitRequest<AnswerText<Message>, Message> unitRequest) {
final Message message = unitRequest.getMessage();
final AnswerText<Message> unit = unitRequest.getUnit();
return unit.getAnswer().processing(message)
.onItem().ifNotNull().call(v -> {
if (checkNotNull(actionBeforeSending)) {
return actionBeforeSending.execute(message.getPersonId());
}
return Uni.createFrom().nullItem();
})
.onItem().ifNotNull().call(v -> {
final ActionBeforeSending unitActionBeforeSending = unit.getActionBeforeSending();
if (checkNotNull(unitActionBeforeSending)) {
return unitActionBeforeSending.execute(message.getPersonId());
}
return Uni.createFrom().nullItem();
})
.onItem().ifNotNull().transformToUni(boxAnswer -> {
boxAnswer.setRecipientIfNull(message.getPersonId());
return sending.send(boxAnswer);

View File

@ -2,9 +2,9 @@ package dev.struchkov.godfather.quarkus.core.action.cmd;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.action.ActionUnit;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.core.unit.cmd.ReplaceCmd;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.unit.cmd.ReplaceCmd;
import io.smallrye.mutiny.Uni;
public class ReplaceCmdAction implements ActionUnit<ReplaceCmd<Message>, Message> {

View File

@ -4,9 +4,9 @@ import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.action.ActionUnit;
import dev.struchkov.godfather.quarkus.core.service.StorylineService;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.core.unit.cmd.RollBackCmd;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.UnitRequest;
import dev.struchkov.godfather.quarkus.domain.unit.cmd.RollBackCmd;
import io.smallrye.mutiny.Uni;
import static dev.struchkov.godfather.exception.RollBackException.rollBackException;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.quarkus.core.service;
import dev.struchkov.godfather.quarkus.context.repository.PersonSettingRepository;
import dev.struchkov.godfather.quarkus.context.service.PersonSettingService;
import dev.struchkov.godfather.quarkus.data.repository.PersonSettingRepository;
import dev.struchkov.haiti.utils.Inspector;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -1,6 +1,6 @@
package dev.struchkov.godfather.quarkus.core.service;
import dev.struchkov.godfather.quarkus.data.StorylineContext;
import dev.struchkov.godfather.quarkus.context.repository.StorylineContext;
import dev.struchkov.haiti.utils.container.ContextKey;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -3,11 +3,11 @@ package dev.struchkov.godfather.quarkus.core.service;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.main.domain.UnitPointer;
import dev.struchkov.godfather.main.domain.content.Mail;
import dev.struchkov.godfather.quarkus.context.repository.StorylineRepository;
import dev.struchkov.godfather.quarkus.context.service.UnitPointerService;
import dev.struchkov.godfather.quarkus.core.Storyline;
import dev.struchkov.godfather.quarkus.core.StorylineFactory;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.data.repository.StorylineRepository;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -2,7 +2,7 @@ package dev.struchkov.godfather.quarkus.core.service;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,8 @@
package dev.struchkov.godfather.quarkus.core.service;
import dev.struchkov.godfather.main.domain.UnitPointer;
import dev.struchkov.godfather.quarkus.context.repository.UnitPointerRepository;
import dev.struchkov.godfather.quarkus.context.service.UnitPointerService;
import dev.struchkov.godfather.quarkus.data.repository.UnitPointerRepository;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -1,10 +0,0 @@
package dev.struchkov.godfather.quarkus.core.unit.func;
import io.smallrye.mutiny.Uni;
@FunctionalInterface
public interface ActionBeforeSending {
Uni<Void> execute(String personId);
}

View File

@ -2,9 +2,9 @@ package dev.struchkov.godfather.simple.core;
import dev.struchkov.autoresponder.Responder;
import dev.struchkov.godfather.exception.ConfigAppException;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.simple.context.service.Accessibility;
import dev.struchkov.godfather.simple.context.service.ErrorHandler;
import dev.struchkov.godfather.simple.context.service.Modifiable;
@ -16,8 +16,8 @@ import dev.struchkov.godfather.simple.core.action.AnswerSaveAction;
import dev.struchkov.godfather.simple.core.action.AnswerTextAction;
import dev.struchkov.godfather.simple.core.action.cmd.ReplaceCmdAction;
import dev.struchkov.godfather.simple.core.service.StorylineService;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
import dev.struchkov.haiti.context.exception.NotFoundException;
import java.util.HashMap;
@ -142,11 +142,9 @@ public class GeneralAutoResponder<M extends Message> {
.or(storyLineService::getDefaultUnit);
if (optAnswer.isPresent()) {
final MainUnit<M> answer = optAnswer.get();
if (checkPermission(answer.getAccessibility(), message)) {
answer(UnitRequest.of(answer, message));
}
}
}
private boolean checkPermission(Optional<Accessibility> accessibility, M message) {
return accessibility.isEmpty() || accessibility.get().check(message);

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.simple.core;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.haiti.utils.Inspector;
import org.jetbrains.annotations.NotNull;

View File

@ -4,7 +4,7 @@ import dev.struchkov.godfather.exception.UnitConfigException;
import dev.struchkov.godfather.main.domain.UnitDefinition;
import dev.struchkov.godfather.main.domain.annotation.Unit;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.haiti.utils.Inspector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,8 +1,8 @@
package dev.struchkov.godfather.simple.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
/**
* Интерфейс для обработки Unit-ов.

View File

@ -2,10 +2,10 @@ package dev.struchkov.godfather.simple.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Sending;
import dev.struchkov.godfather.simple.core.unit.AnswerCheck;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.simple.domain.unit.AnswerCheck;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,13 +1,13 @@
package dev.struchkov.godfather.simple.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Pusher;
import dev.struchkov.godfather.simple.core.unit.AnswerSave;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.core.unit.func.CheckSave;
import dev.struchkov.godfather.simple.core.unit.func.PreservableData;
import dev.struchkov.godfather.simple.data.preser.AnswerSavePreservable;
import dev.struchkov.godfather.simple.domain.unit.AnswerSave;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.unit.func.CheckSave;
import dev.struchkov.godfather.simple.domain.unit.func.PreservableData;
import dev.struchkov.godfather.simple.domain.unit.func.Pusher;
import dev.struchkov.godfather.simple.domain.unit.func.preser.AnswerSavePreservable;
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
@ -48,4 +48,5 @@ public class AnswerSaveAction<M extends Message, D> implements ActionUnit<Answer
}
return UnitRequest.of(answerSave, message);
}
}

View File

@ -2,14 +2,13 @@ package dev.struchkov.godfather.simple.core.action;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Sending;
import dev.struchkov.godfather.simple.core.unit.AnswerText;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.core.unit.func.ActionBeforeSending;
import dev.struchkov.godfather.simple.core.unit.func.CallBackConsumer;
import dev.struchkov.godfather.simple.core.unit.func.ProcessingData;
import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.simple.domain.SentBox;
import dev.struchkov.godfather.simple.domain.unit.AnswerText;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.unit.func.CallBackConsumer;
import dev.struchkov.godfather.simple.domain.unit.func.ProcessingData;
import java.util.Optional;
@ -24,16 +23,10 @@ public class AnswerTextAction implements ActionUnit<AnswerText<Message>, Message
private final Sending sending;
private ActionBeforeSending actionBeforeSending;
public AnswerTextAction(Sending sending) {
this.sending = sending;
}
public void setActionBeforeSending(ActionBeforeSending actionBeforeSending) {
this.actionBeforeSending = actionBeforeSending;
}
@Override
public UnitRequest<MainUnit, Message> action(UnitRequest<AnswerText<Message>, Message> unitRequest) {
final Message message = unitRequest.getMessage();
@ -47,15 +40,6 @@ public class AnswerTextAction implements ActionUnit<AnswerText<Message>, Message
answer.setRecipientIfNull(message.getPersonId());
if (checkNotNull(actionBeforeSending)) {
actionBeforeSending.execute(message.getPersonId());
}
final ActionBeforeSending unitActionBeforeSending = unit.getActionBeforeSending();
if (checkNotNull(unitActionBeforeSending)) {
unitActionBeforeSending.execute(message.getPersonId());
}
final Optional<? extends SentBox> optSentBox = sending.send(answer);
final CallBackConsumer callBack = unit.getCallBack();
if (checkNotNull(callBack) && optAnswer.isPresent()) {

View File

@ -2,9 +2,9 @@ package dev.struchkov.godfather.simple.core.action.cmd;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.action.ActionUnit;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.core.unit.cmd.ReplaceCmd;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.unit.cmd.ReplaceCmd;
public class ReplaceCmdAction implements ActionUnit<ReplaceCmd<Message>, Message> {

View File

@ -4,9 +4,9 @@ import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.action.ActionUnit;
import dev.struchkov.godfather.simple.core.service.StorylineService;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
import dev.struchkov.godfather.simple.core.unit.cmd.RollBackCmd;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.UnitRequest;
import dev.struchkov.godfather.simple.domain.unit.cmd.RollBackCmd;
import static dev.struchkov.godfather.exception.RollBackException.rollBackException;

View File

@ -1,14 +1,13 @@
package dev.struchkov.godfather.simple.core.pusher;
import dev.struchkov.godfather.simple.context.service.Pusher;
import dev.struchkov.godfather.simple.context.service.Sending;
import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.simple.domain.unit.func.Pusher;
import java.util.Map;
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
public class UserSanderPusher implements Pusher<String> {
private final String personId;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.simple.core.service;
import dev.struchkov.godfather.simple.context.repository.PersonSettingRepository;
import dev.struchkov.godfather.simple.context.service.PersonSettingService;
import dev.struchkov.godfather.simple.data.repository.PersonSettingRepository;
import dev.struchkov.haiti.utils.Inspector;
import org.jetbrains.annotations.NotNull;

View File

@ -1,6 +1,6 @@
package dev.struchkov.godfather.simple.core.service;
import dev.struchkov.godfather.simple.data.StorylineContext;
import dev.struchkov.godfather.simple.context.repository.StorylineContext;
import dev.struchkov.haiti.utils.container.ContextKey;
import org.jetbrains.annotations.NotNull;

View File

@ -4,11 +4,11 @@ import dev.struchkov.autoresponder.entity.Unit;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.main.domain.UnitPointer;
import dev.struchkov.godfather.main.domain.content.Mail;
import dev.struchkov.godfather.simple.context.repository.StorylineRepository;
import dev.struchkov.godfather.simple.context.service.UnitPointerService;
import dev.struchkov.godfather.simple.core.Storyline;
import dev.struchkov.godfather.simple.core.StorylineFactory;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.data.repository.StorylineRepository;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import org.jetbrains.annotations.NotNull;
import java.util.List;

View File

@ -2,7 +2,7 @@ package dev.struchkov.godfather.simple.core.service;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import org.jetbrains.annotations.NotNull;
import java.util.Optional;

View File

@ -1,8 +1,8 @@
package dev.struchkov.godfather.simple.core.service;
import dev.struchkov.godfather.main.domain.UnitPointer;
import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository;
import dev.struchkov.godfather.simple.context.service.UnitPointerService;
import dev.struchkov.godfather.simple.data.repository.UnitPointerRepository;
import org.jetbrains.annotations.NotNull;
import java.util.Optional;

View File

@ -1,8 +0,0 @@
package dev.struchkov.godfather.simple.core.unit.func;
@FunctionalInterface
public interface ActionBeforeSending {
void execute(String personId);
}

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.quarkus.data.repository.impl;
import dev.struchkov.godfather.quarkus.context.service.Pusher;
import dev.struchkov.godfather.quarkus.data.preser.AnswerSavePreservable;
import dev.struchkov.godfather.quarkus.domain.unit.func.Pusher;
import dev.struchkov.godfather.quarkus.domain.unit.func.preser.AnswerSavePreservable;
import io.smallrye.mutiny.Uni;
import java.util.HashMap;

View File

@ -1,6 +1,6 @@
package dev.struchkov.godfather.quarkus.data.repository.impl;
import dev.struchkov.godfather.quarkus.data.repository.PersonSettingRepository;
import dev.struchkov.godfather.quarkus.context.repository.PersonSettingRepository;
import io.smallrye.mutiny.Uni;
import java.util.HashMap;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.quarkus.data.repository.impl;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.quarkus.data.repository.StorylineRepository;
import dev.struchkov.godfather.quarkus.context.repository.StorylineRepository;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.quarkus.data.repository.impl;
import dev.struchkov.godfather.main.domain.UnitPointer;
import dev.struchkov.godfather.quarkus.data.repository.UnitPointerRepository;
import dev.struchkov.godfather.quarkus.context.repository.UnitPointerRepository;
import io.smallrye.mutiny.Uni;
import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,8 @@
package dev.struchkov.godfather.simple.data.repository.impl;
import dev.struchkov.godfather.simple.context.service.Pusher;
import dev.struchkov.godfather.simple.data.preser.AnswerSavePreservable;
import dev.struchkov.godfather.simple.domain.unit.func.Pusher;
import dev.struchkov.godfather.simple.domain.unit.func.preser.AnswerSavePreservable;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,6 +1,6 @@
package dev.struchkov.godfather.simple.data.repository.impl;
import dev.struchkov.godfather.simple.data.repository.PersonSettingRepository;
import dev.struchkov.godfather.simple.context.repository.PersonSettingRepository;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.simple.data.repository.impl;
import dev.struchkov.godfather.main.domain.StorylineHistory;
import dev.struchkov.godfather.simple.data.repository.StorylineRepository;
import dev.struchkov.godfather.simple.context.repository.StorylineRepository;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.simple.data.repository.impl;
import dev.struchkov.godfather.main.domain.UnitPointer;
import dev.struchkov.godfather.simple.data.repository.UnitPointerRepository;
import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.main.core.unit;
package dev.struchkov.godfather.main.domain.unit;
import static dev.struchkov.haiti.utils.Exceptions.utilityClass;
@ -11,7 +11,6 @@ public class TypeUnit {
public static final String TEXT = "TEXT";
public static final String SAVE = "SAVE";
public static final String TIMER = "TIMER";
public static final String CHECK = "CHECK";
public static final String BACK_CMD = "BACK_CMD";

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.main.core.unit;
package dev.struchkov.godfather.main.domain.unit;
/**
* Тип активации Unit-а. Определяет порядок обработки Unit.

View File

@ -1,12 +1,11 @@
package dev.struchkov.godfather.quarkus.core.unit;
package dev.struchkov.godfather.quarkus.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
import dev.struchkov.godfather.quarkus.core.unit.func.CheckData;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
import dev.struchkov.godfather.quarkus.domain.unit.func.CheckData;
import java.util.HashSet;
import java.util.Set;
@ -60,7 +59,6 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
new HashSet<>(),
builder.activeType,
builder.notSaveHistory,
builder.accessibility,
TypeUnit.CHECK
);
unitTrue = builder.unitTrue;
@ -108,7 +106,6 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
private Integer priority;
private UnitActiveType activeType;
private Accessibility accessibility;
private boolean notSaveHistory;
private MainUnit unitTrue;
@ -218,11 +215,6 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> accessibility(Accessibility val) {
accessibility = val;
return this;
}
public Builder<M> activeType(UnitActiveType val) {
activeType = val;
return this;

View File

@ -1,14 +1,13 @@
package dev.struchkov.godfather.quarkus.core.unit;
package dev.struchkov.godfather.quarkus.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
import dev.struchkov.godfather.quarkus.context.service.Pusher;
import dev.struchkov.godfather.quarkus.core.unit.func.CheckSave;
import dev.struchkov.godfather.quarkus.core.unit.func.PreservableData;
import dev.struchkov.godfather.quarkus.data.preser.AnswerSavePreservable;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.quarkus.domain.unit.func.CheckSave;
import dev.struchkov.godfather.quarkus.domain.unit.func.PreservableData;
import dev.struchkov.godfather.quarkus.domain.unit.func.Pusher;
import dev.struchkov.godfather.quarkus.domain.unit.func.preser.AnswerSavePreservable;
import java.util.Collection;
import java.util.HashSet;
@ -67,7 +66,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
builder.nextUnits,
(builder.hidden) ? UnitActiveType.AFTER : UnitActiveType.DEFAULT,
builder.notSaveHistory,
builder.accessibility,
TypeUnit.SAVE
);
maintenanceNextUnit(nextUnits);
@ -126,7 +124,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
private Integer matchThreshold;
private Integer priority;
private Accessibility accessibility;
private boolean notSaveHistory;
private AnswerSavePreservable<D> preservable;
@ -260,11 +257,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
return this;
}
public Builder<M, D> accessibility(Accessibility val) {
accessibility = val;
return this;
}
public Builder<M, D> notSaveHistory() {
notSaveHistory = true;
return this;

View File

@ -1,14 +1,12 @@
package dev.struchkov.godfather.quarkus.core.unit;
package dev.struchkov.godfather.quarkus.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
import dev.struchkov.godfather.quarkus.core.unit.func.ActionBeforeSending;
import dev.struchkov.godfather.quarkus.core.unit.func.CallBackConsumer;
import dev.struchkov.godfather.quarkus.core.unit.func.ProcessingData;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
import dev.struchkov.godfather.quarkus.domain.unit.func.CallBackConsumer;
import dev.struchkov.godfather.quarkus.domain.unit.func.ProcessingData;
import io.smallrye.mutiny.Uni;
import java.util.HashSet;
@ -39,8 +37,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
*/
private final CallBackConsumer callBack;
private final ActionBeforeSending actionBeforeSending;
private AnswerText(Builder<M> builder) {
super(
builder.name,
@ -54,12 +50,10 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
builder.nextUnits,
builder.activeType,
builder.notSaveHistory,
builder.accessibility,
TypeUnit.TEXT
);
answer = builder.boxAnswer;
callBack = builder.callBack;
actionBeforeSending = builder.actionBeforeSending;
}
public static <M extends Message> AnswerText<M> of(String message) {
@ -82,10 +76,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return callBack;
}
public ActionBeforeSending getActionBeforeSending() {
return actionBeforeSending;
}
public static final class Builder<M extends Message> {
private String name = UUID.randomUUID().toString();
@ -101,12 +91,10 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
private Integer priority;
private UnitActiveType activeType;
private Accessibility accessibility;
private boolean notSaveHistory;
private ProcessingData<M> boxAnswer;
private CallBackConsumer callBack;
private ActionBeforeSending actionBeforeSending;
private Builder() {
}
@ -149,11 +137,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> actionBeforeSending(ActionBeforeSending action) {
this.actionBeforeSending = action;
return this;
}
public Builder<M> triggerWords(Set<KeyWord> val) {
if (triggerWords == null) {
triggerWords = new HashSet<>();
@ -235,11 +218,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> accessibility(Accessibility val) {
accessibility = val;
return this;
}
public Builder<M> notSaveHistory() {
notSaveHistory = true;
return this;

View File

@ -1,10 +1,9 @@
package dev.struchkov.godfather.simple.core.unit;
package dev.struchkov.godfather.quarkus.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.autoresponder.entity.Unit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Accessibility;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import java.util.Objects;
import java.util.Optional;
@ -39,11 +38,6 @@ public abstract class MainUnit<M extends Message> extends Unit<MainUnit<M>, M> {
*/
protected UnitActiveType activeType;
/**
* Проверка доступа пользователя к юниту.
*/
private final Accessibility accessibility;
private final boolean notSaveHistory;
protected MainUnit(
@ -58,14 +52,12 @@ public abstract class MainUnit<M extends Message> extends Unit<MainUnit<M>, M> {
Set<MainUnit<M>> nextUnits,
UnitActiveType activeType,
boolean notSaveHistory,
Accessibility accessibility,
String type
) {
super(keyWords, phrases, triggerCheck, patterns, matchThreshold, priority, nextUnits);
this.name = name;
this.description = description;
this.activeType = Optional.ofNullable(activeType).orElse(UnitActiveType.DEFAULT);
this.accessibility = accessibility;
this.type = type;
this.notSaveHistory = notSaveHistory;
}
@ -94,10 +86,6 @@ public abstract class MainUnit<M extends Message> extends Unit<MainUnit<M>, M> {
return notSaveHistory;
}
public Optional<Accessibility> getAccessibility() {
return Optional.ofNullable(accessibility);
}
public String getDescription() {
return description;
}

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.core.unit;
package dev.struchkov.godfather.quarkus.domain.unit;
import dev.struchkov.godfather.main.domain.content.Message;

View File

@ -1,10 +1,10 @@
package dev.struchkov.godfather.simple.core.unit.cmd;
package dev.struchkov.godfather.quarkus.domain.unit.cmd;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import dev.struchkov.haiti.utils.Checker;
import java.util.HashSet;
@ -31,7 +31,6 @@ public class ReplaceCmd<M extends Message> extends MainUnit<M> {
new HashSet<>(),
builder.activeType,
true,
null,
TypeUnit.REPLACE_CMD
);
this.thisUnit = builder.thisUnit;

View File

@ -1,11 +1,11 @@
package dev.struchkov.godfather.quarkus.core.unit.cmd;
package dev.struchkov.godfather.quarkus.domain.unit.cmd;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.exception.UnitConfigException;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import java.util.HashSet;
import java.util.Set;
@ -44,7 +44,6 @@ public class RollBackCmd<M extends Message> extends MainUnit<M> {
new HashSet<>(),
builder.activeType,
true,
null,
TypeUnit.BACK_CMD
);
this.countBack = builder.countBack;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.core.unit.func;
package dev.struchkov.godfather.quarkus.domain.unit.func;
import dev.struchkov.godfather.quarkus.domain.SentBox;
import io.smallrye.mutiny.Uni;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.core.unit.func;
package dev.struchkov.godfather.quarkus.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;
import io.smallrye.mutiny.Uni;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.quarkus.core.unit.func;
package dev.struchkov.godfather.quarkus.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.quarkus.domain.unit.MainUnit;
import io.smallrye.mutiny.Uni;
/**

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.core.unit.func;
package dev.struchkov.godfather.quarkus.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;
import io.smallrye.mutiny.Uni;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.core.unit.func;
package dev.struchkov.godfather.quarkus.domain.unit.func;
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
import io.smallrye.mutiny.Uni;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.context.service;
package dev.struchkov.godfather.quarkus.domain.unit.func;
import io.smallrye.mutiny.Uni;

View File

@ -1,6 +1,6 @@
package dev.struchkov.godfather.quarkus.data.preser;
package dev.struchkov.godfather.quarkus.domain.unit.func.preser;
import dev.struchkov.godfather.quarkus.context.service.Pusher;
import dev.struchkov.godfather.quarkus.domain.unit.func.Pusher;
import io.smallrye.mutiny.Uni;
public interface AnswerSavePreservable<T> extends Preservable<T> {

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.data.preser;
package dev.struchkov.godfather.quarkus.domain.unit.func.preser;
import io.smallrye.mutiny.Uni;

View File

@ -1,12 +1,11 @@
package dev.struchkov.godfather.simple.core.unit;
package dev.struchkov.godfather.simple.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Accessibility;
import dev.struchkov.godfather.simple.core.unit.func.CheckData;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.simple.domain.unit.func.CheckData;
import java.util.HashSet;
import java.util.Set;
@ -60,7 +59,6 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
new HashSet<>(),
builder.activeType,
builder.notSaveHistory,
builder.accessibility,
TypeUnit.CHECK
);
unitTrue = builder.unitTrue;
@ -108,7 +106,6 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
private Integer priority;
private UnitActiveType activeType;
private Accessibility accessibility;
private boolean notSaveHistory;
private MainUnit unitTrue;
@ -218,11 +215,6 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> accessibility(Accessibility val) {
accessibility = val;
return this;
}
public Builder<M> activeType(UnitActiveType val) {
activeType = val;
return this;

View File

@ -1,14 +1,13 @@
package dev.struchkov.godfather.simple.core.unit;
package dev.struchkov.godfather.simple.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Accessibility;
import dev.struchkov.godfather.simple.context.service.Pusher;
import dev.struchkov.godfather.simple.core.unit.func.CheckSave;
import dev.struchkov.godfather.simple.core.unit.func.PreservableData;
import dev.struchkov.godfather.simple.data.preser.AnswerSavePreservable;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.simple.domain.unit.func.CheckSave;
import dev.struchkov.godfather.simple.domain.unit.func.PreservableData;
import dev.struchkov.godfather.simple.domain.unit.func.Pusher;
import dev.struchkov.godfather.simple.domain.unit.func.preser.AnswerSavePreservable;
import dev.struchkov.haiti.utils.Checker;
import java.util.Collection;
@ -66,7 +65,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
builder.nextUnits,
(builder.hidden) ? UnitActiveType.AFTER : UnitActiveType.DEFAULT,
builder.notSaveHistory,
builder.accessibility,
TypeUnit.SAVE
);
maintenanceNextUnit(nextUnits);
@ -88,9 +86,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
}
}
public AnswerSavePreservable<D> getPreservable() {
return preservable;
}
public String getKey() {
return key;
@ -112,7 +107,12 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
return checkSave;
}
public AnswerSavePreservable<D> getPreservable() {
return preservable;
}
public static final class Builder<M extends Message, D> {
private String name = UUID.randomUUID().toString();
private String description;
private Set<MainUnit<M>> nextUnits;
@ -125,7 +125,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
private Integer matchThreshold;
private Integer priority;
private Accessibility accessibility;
private boolean notSaveHistory;
private AnswerSavePreservable<D> preservable;
@ -259,11 +258,6 @@ public class AnswerSave<M extends Message, D> extends MainUnit<M> {
return this;
}
public Builder<M, D> accessibility(Accessibility val) {
accessibility = val;
return this;
}
public Builder<M, D> notSaveHistory() {
notSaveHistory = true;
return this;

View File

@ -1,14 +1,12 @@
package dev.struchkov.godfather.simple.core.unit;
package dev.struchkov.godfather.simple.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.context.service.Accessibility;
import dev.struchkov.godfather.simple.core.unit.func.ActionBeforeSending;
import dev.struchkov.godfather.simple.core.unit.func.CallBackConsumer;
import dev.struchkov.godfather.simple.core.unit.func.ProcessingData;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.simple.domain.unit.func.CallBackConsumer;
import dev.struchkov.godfather.simple.domain.unit.func.ProcessingData;
import java.util.HashSet;
import java.util.List;
@ -36,8 +34,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
private final CallBackConsumer callBack;
private final ActionBeforeSending actionBeforeSending;
private AnswerText(Builder<M> builder) {
super(
builder.name,
@ -51,12 +47,10 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
builder.nextUnits,
builder.activeType,
builder.notSaveHistory,
builder.accessibility,
TypeUnit.TEXT
);
answer = builder.boxAnswer;
callBack = builder.callBack;
actionBeforeSending = builder.actionBeforeSending;
}
public static <M extends Message> AnswerText<M> of(String message) {
@ -79,10 +73,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return callBack;
}
public ActionBeforeSending getActionBeforeSending() {
return actionBeforeSending;
}
public static final class Builder<M extends Message> {
private String name = UUID.randomUUID().toString();
@ -98,12 +88,10 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
private Integer priority;
private UnitActiveType activeType;
private Accessibility accessibility;
private boolean notSaveHistory;
private ProcessingData<M> boxAnswer;
private CallBackConsumer callBack;
private ActionBeforeSending actionBeforeSending;
private Builder() {
}
@ -146,11 +134,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> actionBeforeSending(ActionBeforeSending action) {
this.actionBeforeSending = action;
return this;
}
public Builder<M> triggerWords(Set<KeyWord> val) {
if (triggerWords == null) {
triggerWords = new HashSet<>();
@ -232,11 +215,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> accessibility(Accessibility val) {
accessibility = val;
return this;
}
public Builder<M> notSaveHistory() {
notSaveHistory = true;
return this;

View File

@ -1,10 +1,9 @@
package dev.struchkov.godfather.quarkus.core.unit;
package dev.struchkov.godfather.simple.domain.unit;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.autoresponder.entity.Unit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import java.util.Objects;
import java.util.Optional;
@ -39,11 +38,6 @@ public abstract class MainUnit<M extends Message> extends Unit<MainUnit<M>, M> {
*/
protected UnitActiveType activeType;
/**
* Проверка доступа пользователя к юниту.
*/
private final Accessibility accessibility;
private final boolean notSaveHistory;
protected MainUnit(
@ -58,14 +52,12 @@ public abstract class MainUnit<M extends Message> extends Unit<MainUnit<M>, M> {
Set<MainUnit<M>> nextUnits,
UnitActiveType activeType,
boolean notSaveHistory,
Accessibility accessibility,
String type
) {
super(keyWords, phrases, triggerCheck, patterns, matchThreshold, priority, nextUnits);
this.name = name;
this.description = description;
this.activeType = Optional.ofNullable(activeType).orElse(UnitActiveType.DEFAULT);
this.accessibility = accessibility;
this.type = type;
this.notSaveHistory = notSaveHistory;
}
@ -94,10 +86,6 @@ public abstract class MainUnit<M extends Message> extends Unit<MainUnit<M>, M> {
return notSaveHistory;
}
public Optional<Accessibility> getAccessibility() {
return Optional.ofNullable(accessibility);
}
public String getDescription() {
return description;
}

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.quarkus.core.unit;
package dev.struchkov.godfather.simple.domain.unit;
import dev.struchkov.godfather.main.domain.content.Message;

View File

@ -1,10 +1,10 @@
package dev.struchkov.godfather.quarkus.core.unit.cmd;
package dev.struchkov.godfather.simple.domain.unit.cmd;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.haiti.utils.Checker;
import java.util.HashSet;
@ -31,7 +31,6 @@ public class ReplaceCmd<M extends Message> extends MainUnit<M> {
new HashSet<>(),
builder.activeType,
true,
null,
TypeUnit.REPLACE_CMD
);
this.thisUnit = builder.thisUnit;

View File

@ -1,11 +1,11 @@
package dev.struchkov.godfather.simple.core.unit.cmd;
package dev.struchkov.godfather.simple.domain.unit.cmd;
import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.exception.UnitConfigException;
import dev.struchkov.godfather.main.core.unit.TypeUnit;
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.main.domain.unit.TypeUnit;
import dev.struchkov.godfather.main.domain.unit.UnitActiveType;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import java.util.HashSet;
import java.util.Set;
@ -44,15 +44,14 @@ public class RollBackCmd<M extends Message> extends MainUnit<M> {
new HashSet<>(),
builder.activeType,
true,
null,
TypeUnit.BACK_CMD
);
this.countBack = builder.countBack;
this.rollbackUnitName = builder.rollbackUnitName;
}
public static <M extends Message> RollBackCmd.Builder<M> builder() {
return new RollBackCmd.Builder<>();
public static <M extends Message> Builder<M> builder() {
return new Builder<>();
}
public static <M extends Message> RollBackCmd<M> rollBack(int countToBack) {
@ -84,6 +83,7 @@ public class RollBackCmd<M extends Message> extends MainUnit<M> {
}
public static final class Builder<M extends Message> {
private String name = UUID.randomUUID().toString();
private String description;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.core.unit.func;
package dev.struchkov.godfather.simple.domain.unit.func;
import dev.struchkov.godfather.simple.domain.SentBox;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.core.unit.func;
package dev.struchkov.godfather.simple.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;

View File

@ -1,7 +1,7 @@
package dev.struchkov.godfather.simple.core.unit.func;
package dev.struchkov.godfather.simple.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
/**
* TODO: Добавить описание интерфейса.

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.core.unit.func;
package dev.struchkov.godfather.simple.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.core.unit.func;
package dev.struchkov.godfather.simple.domain.unit.func;
import dev.struchkov.godfather.main.domain.content.Message;
import dev.struchkov.haiti.utils.container.Pair;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.core.unit.func;
package dev.struchkov.godfather.simple.domain.unit.func;
import dev.struchkov.godfather.simple.domain.BoxAnswer;

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.context.service;
package dev.struchkov.godfather.simple.domain.unit.func;
import java.util.Map;

View File

@ -1,6 +1,6 @@
package dev.struchkov.godfather.simple.data.preser;
package dev.struchkov.godfather.simple.domain.unit.func.preser;
import dev.struchkov.godfather.simple.context.service.Pusher;
import dev.struchkov.godfather.simple.domain.unit.func.Pusher;
public interface AnswerSavePreservable<T> extends Preservable<T> {

View File

@ -1,4 +1,4 @@
package dev.struchkov.godfather.simple.data.preser;
package dev.struchkov.godfather.simple.domain.unit.func.preser;
import java.util.Map;
import java.util.Optional;