diff --git a/bot-context/pom.xml b/bot-context/pom.xml
index 7b312c6..a3e0a1f 100644
--- a/bot-context/pom.xml
+++ b/bot-context/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.8
+ 0.0.9
bot-context
@@ -15,6 +15,10 @@
Доменные сущности, интерфейсы, для библиотеки Godfather
+
+ dev.struchkov
+ autoresponder
+
dev.struchkov.haiti
haiti-utils
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/Clarification.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/Clarification.java
similarity index 77%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/Clarification.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/Clarification.java
index 626d440..9af7946 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/Clarification.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/Clarification.java
@@ -1,6 +1,4 @@
-package dev.struchkov.godfather.core.domain;
-
-import dev.struchkov.godfather.context.domain.BoxAnswer;
+package dev.struchkov.godfather.context.domain;
public class Clarification {
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/StorylineHistory.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/StorylineHistory.java
new file mode 100644
index 0000000..54494df
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/StorylineHistory.java
@@ -0,0 +1,35 @@
+package dev.struchkov.godfather.context.domain;
+
+import dev.struchkov.godfather.context.domain.content.Message;
+
+public class StorylineHistory extends BasicEntity {
+
+ private Long personId;
+ private String unitName;
+ private Message message;
+
+ public Long getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(Long personId) {
+ this.personId = personId;
+ }
+
+ public String getUnitName() {
+ return unitName;
+ }
+
+ public void setUnitName(String unitName) {
+ this.unitName = unitName;
+ }
+
+ public Message getMessage() {
+ return message;
+ }
+
+ public void setMessage(Message message) {
+ this.message = message;
+ }
+
+}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/utils/TypeUnit.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/TypeUnit.java
similarity index 62%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/utils/TypeUnit.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/TypeUnit.java
index 6296c40..96bcbcb 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/utils/TypeUnit.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/TypeUnit.java
@@ -1,4 +1,6 @@
-package dev.struchkov.godfather.core.utils;
+package dev.struchkov.godfather.context.domain;
+
+import static dev.struchkov.haiti.utils.Exceptions.utilityClass;
/**
* Тип Unit-а. Обределяет способ обработки.
@@ -9,14 +11,15 @@ public class TypeUnit {
public static final String TEXT = "TEXT";
public static final String SAVE = "SAVE";
- public static final String PROCESSING = "PROCESSING";
public static final String TIMER = "TIMER";
public static final String CHECK = "CHECK";
public static final String VALIDITY = "VALIDITY";
- public static final String ACCOUNT = "ACCOUNT";
+ public static final String BACK_CMD = "BACK_CMD";
+
+ public static final String TELEPORT_CMD = "TELEPORT_CMD";
private TypeUnit() {
- throw new IllegalStateException("Утилитарный класс");
+ utilityClass();
}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitRequest.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitRequest.java
new file mode 100644
index 0000000..2773e4a
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/UnitRequest.java
@@ -0,0 +1,34 @@
+package dev.struchkov.godfather.context.domain;
+
+import dev.struchkov.godfather.context.domain.content.Message;
+import dev.struchkov.godfather.context.domain.unit.MainUnit;
+
+/**
+ * Сущность инкапсулирует в себе данные, необходимые для обработки сценария.
+ *
+ * @param Тип юнита
+ * @param Тип сообщения
+ */
+public class UnitRequest {
+
+ private final U unit;
+ private final M message;
+
+ private UnitRequest(U unit, M message) {
+ this.unit = unit;
+ this.message = message;
+ }
+
+ public static UnitRequest of(U mainUnit, M message) {
+ return new UnitRequest<>(mainUnit, message);
+ }
+
+ public U getUnit() {
+ return unit;
+ }
+
+ public M getMessage() {
+ return message;
+ }
+
+}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Mail.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Mail.java
index 1eafa1d..66f9286 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Mail.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Mail.java
@@ -7,6 +7,8 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
/**
@@ -33,9 +35,9 @@ public class Mail extends Message {
/**
* Вложения к сообщению.
*/
- @OneToMany(fetch = FetchType.EAGER)
@Column(name = "attachment")
- private List attachments;
+ @OneToMany(fetch = FetchType.LAZY)
+ private List attachments = new ArrayList<>();
/**
* Пересланные сообщения.
@@ -68,8 +70,12 @@ public class Mail extends Message {
return attachments;
}
- public void setAttachments(List attachments) {
- this.attachments = attachments;
+ public void addAttachment(Attachment attachment) {
+ this.attachments.add(attachment);
+ }
+
+ public void addAttachments(Collection attachments) {
+ this.attachments.addAll(attachments);
}
public List getForwardMail() {
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Attachment.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Attachment.java
index 7605b66..453c9cb 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Attachment.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Attachment.java
@@ -2,10 +2,7 @@ package dev.struchkov.godfather.context.domain.content.attachment;
import dev.struchkov.godfather.context.domain.BasicEntity;
-import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
/**
* Абстрактная сущность, для всех вложений к сообщениям от пользователей.
@@ -15,15 +12,6 @@ import javax.persistence.Enumerated;
@Entity
public abstract class Attachment extends BasicEntity {
- /**
- * Тип сущности.
- */
- @Column(name = "type")
- @Enumerated(value = EnumType.STRING)
- protected AttachmentType type;
-
- public AttachmentType getType() {
- return type;
- }
+ public abstract String getType();
}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java
deleted file mode 100644
index 696f5f4..0000000
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package dev.struchkov.godfather.context.domain.content.attachment;
-
-/**
- * Тип вложения {@link Attachment} к сообщению.
- *
- * @author upagge [08/07/2019]
- */
-public enum AttachmentType {
-
- AUDIO_MESSAGE,
- GEO,
- LINK
-
-}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AudioMessage.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AudioMessage.java
deleted file mode 100644
index d833434..0000000
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AudioMessage.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package dev.struchkov.godfather.context.domain.content.attachment;
-
-import java.net.URL;
-
-/**
- * Вложение типа "Аудиосообщение".
- *
- * @author upagge [08/07/2019]
- */
-public class AudioMessage extends Attachment {
-
- /**
- * Ссылка на аудиозапись в формате odd.
- */
- private URL linkOdd;
-
- public AudioMessage() {
- type = AttachmentType.AUDIO_MESSAGE;
- }
-
- public AudioMessage(URL linkOdd) {
- this.linkOdd = linkOdd;
- }
-
-}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Geo.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Geo.java
deleted file mode 100644
index 7f04300..0000000
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Geo.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package dev.struchkov.godfather.context.domain.content.attachment;
-
-/**
- * Вложение типа "Карта".
- *
- * @author upagge [08/07/2019]
- */
-public class Geo extends Attachment {
-
- /**
- * Географические координаты.
- */
- private GeoCoordinate geoCoordinate;
-
- /**
- * Название страны.
- */
- private String country;
-
- /**
- * Название города.
- */
- private String city;
-
- private Geo() {
- type = AttachmentType.GEO;
- }
-
- public static Builder builder() {
- return new Geo().new Builder();
- }
-
- public GeoCoordinate getGeoCoordinate() {
- return geoCoordinate;
- }
-
- public String getCountry() {
- return country;
- }
-
- public String getCity() {
- return city;
- }
-
- public class Builder {
- private Builder() {
- }
-
- public Builder coordinate(Float lat, Float aLong) {
- Geo.this.geoCoordinate = new GeoCoordinate(lat, aLong);
- return this;
- }
-
- public Builder country(String countryName) {
- Geo.this.country = countryName;
- return this;
- }
-
- public Builder city(String cityName) {
- Geo.this.city = cityName;
- return this;
- }
-
- public Geo build() {
- return Geo.this;
- }
- }
-
-}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/GeoCoordinate.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/GeoCoordinate.java
deleted file mode 100644
index d0ac11d..0000000
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/GeoCoordinate.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package dev.struchkov.godfather.context.domain.content.attachment;
-
-/**
- * Сущность для хранения географических координат.
- *
- * @author upagge [08/07/2019]
- */
-public class GeoCoordinate {
-
- /**
- * Широта.
- */
- private Float latitude;
-
- /**
- * Долгота.
- */
- private Float longitude;
-
- public GeoCoordinate(Float latitude, Float longitude) {
- this.latitude = latitude;
- this.longitude = longitude;
- }
-
- public Float getLatitude() {
- return latitude;
- }
-
- public void setLatitude(Float latitude) {
- this.latitude = latitude;
- }
-
- public Float getLongitude() {
- return longitude;
- }
-
- public void setLongitude(Float longitude) {
- this.longitude = longitude;
- }
-
-}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Link.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Link.java
deleted file mode 100644
index 3dd78ff..0000000
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Link.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package dev.struchkov.godfather.context.domain.content.attachment;
-
-public class Link extends Attachment {
-
- private String url;
-
- public Link() {
- this.type = AttachmentType.LINK;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
-}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerCheck.java
similarity index 84%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerCheck.java
index 2ad53b4..dc75f64 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerCheck.java
@@ -1,13 +1,15 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
+import dev.struchkov.autoresponder.entity.KeyWord;
+import dev.struchkov.godfather.context.domain.TypeUnit;
import dev.struchkov.godfather.context.domain.content.Message;
+import dev.struchkov.godfather.context.service.Accessibility;
import dev.struchkov.godfather.context.service.usercode.CheckData;
-import dev.struchkov.godfather.core.service.Accessibility;
-import dev.struchkov.godfather.core.utils.TypeUnit;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static dev.struchkov.godfather.context.exception.UnitConfigException.unitConfigException;
import static dev.struchkov.haiti.utils.Inspector.isAnyNotNull;
@@ -71,7 +73,7 @@ public class AnswerCheck extends MainUnit {
public static final class Builder {
private String name;
- private Set keyWords = new HashSet<>();
+ private Set keyWords = new HashSet<>();
private String phrase;
private Pattern pattern;
private Integer matchThreshold;
@@ -90,13 +92,23 @@ public class AnswerCheck extends MainUnit {
return this;
}
- public Builder keyWords(Set val) {
- keyWords = val;
+ public Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
return this;
}
public Builder keyWord(String val) {
- keyWords.add(val);
+ keyWords.add(KeyWord.of(val));
return this;
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerSave.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerSave.java
similarity index 85%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerSave.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerSave.java
index fac35c3..1c7f9e9 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerSave.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerSave.java
@@ -1,17 +1,19 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
+import dev.struchkov.autoresponder.entity.KeyWord;
+import dev.struchkov.godfather.context.domain.TypeUnit;
import dev.struchkov.godfather.context.domain.content.Message;
-import dev.struchkov.godfather.core.service.Accessibility;
-import dev.struchkov.godfather.core.service.save.CheckSave;
-import dev.struchkov.godfather.core.service.save.Preservable;
-import dev.struchkov.godfather.core.service.save.data.PreservableData;
-import dev.struchkov.godfather.core.service.save.push.Pusher;
-import dev.struchkov.godfather.core.utils.TypeUnit;
+import dev.struchkov.godfather.context.service.Accessibility;
+import dev.struchkov.godfather.context.service.save.CheckSave;
+import dev.struchkov.godfather.context.service.save.Preservable;
+import dev.struchkov.godfather.context.service.save.PreservableData;
+import dev.struchkov.godfather.context.service.save.Pusher;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static dev.struchkov.haiti.utils.Inspector.isNotNull;
@@ -107,7 +109,7 @@ public class AnswerSave extends MainUnit {
public static final class Builder {
private String name;
- private Set keyWords = new HashSet<>();
+ private Set keyWords = new HashSet<>();
private String phrase;
private Pattern pattern;
private Integer matchThreshold;
@@ -129,13 +131,23 @@ public class AnswerSave extends MainUnit {
return this;
}
- public Builder keyWords(Set val) {
- keyWords = val;
+ public Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
return this;
}
public Builder keyWord(String val) {
- keyWords.add(val);
+ keyWords.add(KeyWord.of(val));
return this;
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerText.java
similarity index 86%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerText.java
index beb7dca..a7018df 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerText.java
@@ -1,19 +1,21 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
+import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.context.domain.BoxAnswer;
+import dev.struchkov.godfather.context.domain.TypeUnit;
import dev.struchkov.godfather.context.domain.content.Message;
import dev.struchkov.godfather.context.exception.UnitConfigException;
+import dev.struchkov.godfather.context.service.Accessibility;
import dev.struchkov.godfather.context.service.sender.Sending;
import dev.struchkov.godfather.context.service.usercode.Insert;
import dev.struchkov.godfather.context.service.usercode.MessageFunction;
import dev.struchkov.godfather.context.service.usercode.ProcessingData;
-import dev.struchkov.godfather.core.service.Accessibility;
-import dev.struchkov.godfather.core.utils.TypeUnit;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static dev.struchkov.haiti.utils.Inspector.isNotNull;
@@ -82,7 +84,7 @@ public class AnswerText extends MainUnit {
private ProcessingData boxAnswer;
private Insert insert;
private Sending sending;
- private Set keyWords = new HashSet<>();
+ private Set keyWords = new HashSet<>();
private String phrase;
private Pattern pattern;
private Integer matchThreshold;
@@ -135,8 +137,23 @@ public class AnswerText extends MainUnit {
return this;
}
- public Builder keyWords(Set val) {
- keyWords = val;
+ public Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
+ return this;
+ }
+
+ public Builder keyWord(String val) {
+ keyWords.add(KeyWord.of(val));
return this;
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerTimer.java
similarity index 82%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerTimer.java
index 2742e52..71e01fb 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerTimer.java
@@ -1,12 +1,16 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
+import dev.struchkov.autoresponder.entity.KeyWord;
+import dev.struchkov.godfather.context.domain.TypeUnit;
import dev.struchkov.godfather.context.domain.content.Message;
+import dev.struchkov.godfather.context.domain.keyboard.KeyBoard;
+import dev.struchkov.godfather.context.service.Accessibility;
import dev.struchkov.godfather.context.service.usercode.CheckData;
-import dev.struchkov.godfather.core.service.Accessibility;
-import dev.struchkov.godfather.core.utils.TypeUnit;
+import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static dev.struchkov.godfather.context.exception.UnitConfigException.unitConfigException;
import static dev.struchkov.haiti.utils.Inspector.isNotNull;
@@ -83,7 +87,7 @@ public class AnswerTimer extends MainUnit {
private Integer timeDelaySec;
private Integer timeDeathSec;
private CheckData checkLoop;
- private Set keyWords;
+ private Set keyWords = new HashSet<>();
private String phrase;
private Pattern pattern;
private Integer matchThreshold;
@@ -119,8 +123,23 @@ public class AnswerTimer extends MainUnit {
return this;
}
- public Builder keyWords(Set val) {
- keyWords = val;
+ public Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
+ return this;
+ }
+
+ public Builder keyWord(String val) {
+ keyWords.add(KeyWord.of(val));
return this;
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerValidity.java
similarity index 81%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerValidity.java
index 0b78c8a..eaa86d4 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/AnswerValidity.java
@@ -1,14 +1,16 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
-import dev.struchkov.godfather.core.service.Accessibility;
-import dev.struchkov.godfather.core.service.ClarificationQuestion;
-import dev.struchkov.godfather.core.service.save.LocalPreservable;
-import dev.struchkov.godfather.core.service.save.Preservable;
-import dev.struchkov.godfather.core.utils.TypeUnit;
+import dev.struchkov.autoresponder.entity.KeyWord;
+import dev.struchkov.godfather.context.domain.TypeUnit;
+import dev.struchkov.godfather.context.service.Accessibility;
+import dev.struchkov.godfather.context.service.ClarificationQuestion;
+import dev.struchkov.godfather.context.service.save.LocalPreservable;
+import dev.struchkov.godfather.context.service.save.Preservable;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
/**
* Обработка данных со страницы пользователя.
@@ -85,7 +87,7 @@ public class AnswerValidity extends MainUnit {
private MainUnit unitNo;
private MainUnit unitNull;
private ClarificationQuestion clarificationQuestion;
- private Set keyWords;
+ private Set keyWords = new HashSet<>();
private String phrase;
private Pattern pattern;
private Integer matchThreshold;
@@ -121,13 +123,23 @@ public class AnswerValidity extends MainUnit {
return this;
}
- public Builder keyWords(Set val) {
- keyWords = val;
+ public Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
return this;
}
public Builder keyWord(String val) {
- keyWords.add(val);
+ keyWords.add(KeyWord.of(val));
return this;
}
@@ -162,7 +174,7 @@ public class AnswerValidity extends MainUnit {
}
public Builder clearKeyWords() {
- nextUnits.clear();
+ keyWords.clear();
return this;
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/LazyUnit.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/LazyUnit.java
similarity index 77%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/LazyUnit.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/LazyUnit.java
index 33d46e1..62a255b 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/LazyUnit.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/LazyUnit.java
@@ -1,7 +1,9 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
+import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.godfather.context.domain.UnitDefinition;
-import dev.struchkov.godfather.core.service.Accessibility;
+import dev.struchkov.godfather.context.domain.keyboard.KeyBoard;
+import dev.struchkov.godfather.context.service.Accessibility;
import java.util.Set;
import java.util.regex.Pattern;
@@ -12,7 +14,7 @@ public class LazyUnit extends MainUnit {
private LazyUnit(
String name,
- Set keyWords,
+ Set keyWords,
String phrase,
Pattern pattern,
Integer matchThreshold,
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/MainUnit.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/MainUnit.java
similarity index 93%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/MainUnit.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/MainUnit.java
index 248212a..46a9f5a 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/MainUnit.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/MainUnit.java
@@ -1,7 +1,8 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
+import dev.struchkov.autoresponder.entity.KeyWord;
import dev.struchkov.autoresponder.entity.Unit;
-import dev.struchkov.godfather.core.service.Accessibility;
+import dev.struchkov.godfather.context.service.Accessibility;
import java.util.Objects;
import java.util.Optional;
@@ -43,7 +44,7 @@ public abstract class MainUnit extends Unit {
protected MainUnit(
String name,
- Set keyWords,
+ Set keyWords,
String phrase,
Pattern pattern,
Integer matchThreshold,
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/UnitActiveType.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/UnitActiveType.java
similarity index 78%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/UnitActiveType.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/UnitActiveType.java
index 0297508..569317f 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/UnitActiveType.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/UnitActiveType.java
@@ -1,4 +1,4 @@
-package dev.struchkov.godfather.core.domain.unit;
+package dev.struchkov.godfather.context.domain.unit;
/**
* Тип активации Unit-а. Определяет порядок обработки Unit.
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/cmd/RollBackCmd.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/cmd/RollBackCmd.java
new file mode 100644
index 0000000..d2011b9
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/cmd/RollBackCmd.java
@@ -0,0 +1,133 @@
+package dev.struchkov.godfather.context.domain.unit.cmd;
+
+import dev.struchkov.autoresponder.entity.KeyWord;
+import dev.struchkov.godfather.context.domain.TypeUnit;
+import dev.struchkov.godfather.context.domain.unit.MainUnit;
+import dev.struchkov.godfather.context.domain.unit.UnitActiveType;
+import dev.struchkov.godfather.context.exception.UnitConfigException;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * Юнит, который позволяет откатить пользователя на предыдущие юниты в сценарии с сохранением ранее введенной информации в сообщениях.
+ */
+public class RollBackCmd extends MainUnit {
+
+ /**
+ * Количество юнитов, на которые можно откатиться назад.
+ */
+ private final int countBack;
+
+ private RollBackCmd(Builder builder) {
+ super(
+ builder.name,
+ builder.keyWords,
+ builder.phrase,
+ builder.pattern,
+ builder.matchThreshold,
+ builder.priority,
+ new HashSet<>(),
+ builder.activeType,
+ null,
+ TypeUnit.BACK_CMD
+ );
+ this.countBack = builder.countBack;
+ }
+
+ public int getCountBack() {
+ return countBack;
+ }
+
+ public static RollBackCmd.Builder builder() {
+ return new RollBackCmd.Builder();
+ }
+
+ public static RollBackCmd rollBack(int countToBack) {
+ return RollBackCmd.builder().countBack(countToBack).build();
+ }
+
+ public static RollBackCmd singleRollBack() {
+ return RollBackCmd.builder().countBack(1).build();
+ }
+
+ public static final class Builder {
+ private String name;
+ private Set keyWords = new HashSet<>();
+ private String phrase;
+ private Pattern pattern;
+ private Integer matchThreshold;
+ private Integer priority;
+ private UnitActiveType activeType = UnitActiveType.DEFAULT;
+ private int countBack;
+
+ private Builder() {
+ }
+
+ public RollBackCmd.Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public RollBackCmd.Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public RollBackCmd.Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public RollBackCmd.Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
+ return this;
+ }
+
+ public RollBackCmd.Builder keyWord(String val) {
+ keyWords.add(KeyWord.of(val));
+ return this;
+ }
+
+ public RollBackCmd.Builder phrase(String val) {
+ phrase = val;
+ return this;
+ }
+
+ public RollBackCmd.Builder pattern(Pattern val) {
+ pattern = val;
+ return this;
+ }
+
+ public RollBackCmd.Builder matchThreshold(Integer val) {
+ matchThreshold = val;
+ return this;
+ }
+
+ public RollBackCmd.Builder priority(Integer val) {
+ priority = val;
+ return this;
+ }
+
+ public RollBackCmd.Builder activeType(UnitActiveType val) {
+ activeType = val;
+ return this;
+ }
+
+ public RollBackCmd.Builder countBack(int val) {
+ countBack = val + 1;
+ return this;
+ }
+
+ public RollBackCmd build() {
+ if (countBack < 2) {
+ throw new UnitConfigException("Ошибка конфигурирования юнита {0}: Количество юнитов для отката не должно быть меньше 1.", name);
+ }
+ return new RollBackCmd(this);
+ }
+
+ }
+
+}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/cmd/TeleportCmd.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/cmd/TeleportCmd.java
new file mode 100644
index 0000000..545bf23
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/unit/cmd/TeleportCmd.java
@@ -0,0 +1,121 @@
+package dev.struchkov.godfather.context.domain.unit.cmd;
+
+import dev.struchkov.autoresponder.entity.KeyWord;
+import dev.struchkov.godfather.context.domain.TypeUnit;
+import dev.struchkov.godfather.context.domain.unit.MainUnit;
+import dev.struchkov.godfather.context.domain.unit.UnitActiveType;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * Позволяет перенести пользователя в произвольное место в сценарии.
+ */
+public class TeleportCmd extends MainUnit {
+
+ /**
+ * Название юнита, в которое необходимо осуществить перенос.
+ */
+ private String unitNameToTeleport;
+
+ private TeleportCmd(Builder builder) {
+ super(
+ builder.name,
+ builder.keyWords,
+ builder.phrase,
+ builder.pattern,
+ builder.matchThreshold,
+ builder.priority,
+ new HashSet<>(),
+ builder.activeType,
+ null,
+ TypeUnit.TELEPORT_CMD
+ );
+ this.unitNameToTeleport = builder.unitNameToTeleport;
+ }
+
+ public String getUnitNameToTeleport() {
+ return unitNameToTeleport;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder {
+ private String name;
+ private Set keyWords = new HashSet<>();
+ private String phrase;
+ private Pattern pattern;
+ private Integer matchThreshold;
+ private Integer priority;
+ private UnitActiveType activeType = UnitActiveType.DEFAULT;
+ private String unitNameToTeleport;
+
+ private Builder() {
+ }
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder keyWords(Set val) {
+ keyWords.addAll(val);
+ return this;
+ }
+
+ public Builder keyWord(KeyWord val) {
+ keyWords.add(val);
+ return this;
+ }
+
+ public Builder stringKeyWords(Set val) {
+ keyWords.addAll(val.stream().map(KeyWord::of).collect(Collectors.toSet()));
+ return this;
+ }
+
+ public Builder keyWord(String val) {
+ keyWords.add(KeyWord.of(val));
+ return this;
+ }
+
+ public Builder phrase(String val) {
+ phrase = val;
+ return this;
+ }
+
+ public Builder pattern(Pattern val) {
+ pattern = val;
+ return this;
+ }
+
+ public Builder matchThreshold(Integer val) {
+ matchThreshold = val;
+ return this;
+ }
+
+ public Builder priority(Integer val) {
+ priority = val;
+ return this;
+ }
+
+ public Builder activeType(UnitActiveType val) {
+ activeType = val;
+ return this;
+ }
+
+ public Builder unitNameToTeleport(String val) {
+ unitNameToTeleport = val;
+ return this;
+ }
+
+ public TeleportCmd build() {
+ return new TeleportCmd(this);
+ }
+
+ }
+
+}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/repository/StorylineRepository.java b/bot-context/src/main/java/dev/struchkov/godfather/context/repository/StorylineRepository.java
new file mode 100644
index 0000000..5263336
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/repository/StorylineRepository.java
@@ -0,0 +1,16 @@
+package dev.struchkov.godfather.context.repository;
+
+import dev.struchkov.godfather.context.domain.StorylineHistory;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Optional;
+
+public interface StorylineRepository {
+
+ void save(@NotNull StorylineHistory storylineHistory);
+
+ Optional findByCountLast(long personId, int countUnitsToBack);
+
+ void cleanHistoryByPersonId(@NotNull Long personId);
+
+}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/StorylineMapRepository.java b/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/StorylineMapRepository.java
new file mode 100644
index 0000000..8b09ae5
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/StorylineMapRepository.java
@@ -0,0 +1,47 @@
+package dev.struchkov.godfather.context.repository.impl.local;
+
+import dev.struchkov.godfather.context.domain.StorylineHistory;
+import dev.struchkov.godfather.context.repository.StorylineRepository;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Stack;
+
+public class StorylineMapRepository implements StorylineRepository {
+
+ private final Map> map = new HashMap<>();
+
+ @Override
+ public void save(@NotNull StorylineHistory history) {
+ final Long personId = history.getPersonId();
+ map.computeIfAbsent(personId, k -> new Stack<>()).push(history);
+ }
+
+ @Override
+ public Optional findByCountLast(long personId, int countUnitsToBack) {
+ if (map.containsKey(personId)) {
+ final Stack stack = map.get(personId);
+ if (stack.size() < countUnitsToBack) {
+ countUnitsToBack = stack.size();
+ }
+ StorylineHistory storylineHistory = null;
+ for (int i = 0; i < countUnitsToBack; i++) {
+ storylineHistory = stack.pop();
+ }
+ return Optional.ofNullable(storylineHistory);
+ }
+ return Optional.empty();
+ }
+
+ @Override
+ public void cleanHistoryByPersonId(@NotNull Long personId) {
+ if (map.containsKey(personId)) {
+ map.get(personId).clear();
+ } else {
+ map.put(personId, new Stack<>());
+ }
+ }
+
+}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/UnitPointLocalRepository.java b/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/UnitPointLocalRepository.java
index 88e9b0b..5a5d17a 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/UnitPointLocalRepository.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/repository/impl/local/UnitPointLocalRepository.java
@@ -10,7 +10,7 @@ import java.util.Optional;
public class UnitPointLocalRepository implements UnitPointerRepository {
- public static final Map map = new HashMap<>();
+ public final Map map = new HashMap<>();
@Override
public UnitPointer save(@NotNull UnitPointer unitPointer) {
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/Accessibility.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/Accessibility.java
similarity index 73%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/Accessibility.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/Accessibility.java
index d801e6f..f76fc5c 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/Accessibility.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/Accessibility.java
@@ -1,4 +1,4 @@
-package dev.struchkov.godfather.core.service;
+package dev.struchkov.godfather.context.service;
import dev.struchkov.godfather.context.domain.content.Message;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/ClarificationQuestion.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/ClarificationQuestion.java
similarity index 64%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/ClarificationQuestion.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/ClarificationQuestion.java
index 6ab7122..18bc266 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/ClarificationQuestion.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/ClarificationQuestion.java
@@ -1,7 +1,7 @@
-package dev.struchkov.godfather.core.service;
+package dev.struchkov.godfather.context.service;
+import dev.struchkov.godfather.context.domain.Clarification;
import dev.struchkov.godfather.context.domain.content.Message;
-import dev.struchkov.godfather.core.domain.Clarification;
@FunctionalInterface
public interface ClarificationQuestion {
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/service/StorylineService.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/StorylineService.java
new file mode 100644
index 0000000..5d016ef
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/StorylineService.java
@@ -0,0 +1,35 @@
+package dev.struchkov.godfather.context.service;
+
+import dev.struchkov.godfather.context.domain.StorylineHistory;
+import dev.struchkov.godfather.context.domain.content.Message;
+import dev.struchkov.godfather.context.domain.unit.MainUnit;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Optional;
+import java.util.Set;
+
+public interface StorylineService {
+
+ void save(@NotNull StorylineHistory storylineHistory);
+
+ Optional getUnitNameByPersonId(@NotNull Long personId);
+
+ Set getNextUnitByPersonId(@NotNull Long personId);
+
+ void save(Long personId, String name, T message);
+
+ Optional replaceUserToBack(long personId, int countUnitsToBack);
+
+ Optional getDefaultUnit();
+
+ /**
+ * Ленивая (поздняя) связка юнитов между собой. Осуществляется уже после создания сценария. С помощью данного подхода можно реализовать циклические зависимости юнитов. Либо можно использовать {@link dev.struchkov.godfather.context.domain.unit.cmd.TeleportCmd}
+ *
+ * @param firstName
+ * @param secondName
+ */
+ void lazyLink(String firstName, String secondName);
+
+ Optional getUnitByName(String unitName);
+
+}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/CheckSave.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/CheckSave.java
similarity index 70%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/save/CheckSave.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/save/CheckSave.java
index c074d86..57a4b60 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/CheckSave.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/CheckSave.java
@@ -1,7 +1,7 @@
-package dev.struchkov.godfather.core.service.save;
+package dev.struchkov.godfather.context.service.save;
import dev.struchkov.godfather.context.domain.content.Message;
-import dev.struchkov.godfather.core.domain.unit.MainUnit;
+import dev.struchkov.godfather.context.domain.unit.MainUnit;
/**
* TODO: Добавить описание интерфейса.
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/LocalPreservable.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/LocalPreservable.java
similarity index 87%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/save/LocalPreservable.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/save/LocalPreservable.java
index 23d2b45..99ab0f6 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/LocalPreservable.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/LocalPreservable.java
@@ -1,4 +1,6 @@
-package dev.struchkov.godfather.core.service.save;
+package dev.struchkov.godfather.context.service.save;
+
+import dev.struchkov.godfather.context.service.save.Preservable;
import java.util.HashMap;
import java.util.Map;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/Preservable.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/Preservable.java
similarity index 90%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/save/Preservable.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/save/Preservable.java
index 2df8240..a5ed2d5 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/Preservable.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/Preservable.java
@@ -1,6 +1,6 @@
-package dev.struchkov.godfather.core.service.save;
+package dev.struchkov.godfather.context.service.save;
-import dev.struchkov.godfather.core.service.save.push.Pusher;
+import dev.struchkov.godfather.context.service.save.Pusher;
import java.util.Map;
import java.util.Optional;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/data/PreservableData.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/PreservableData.java
similarity index 75%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/save/data/PreservableData.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/save/PreservableData.java
index 8978dce..6c1ed99 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/data/PreservableData.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/PreservableData.java
@@ -1,4 +1,4 @@
-package dev.struchkov.godfather.core.service.save.data;
+package dev.struchkov.godfather.context.service.save;
import dev.struchkov.godfather.context.domain.content.Message;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/push/Pusher.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/Pusher.java
similarity index 79%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/save/push/Pusher.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/save/Pusher.java
index 2002ef5..c4ff5b2 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/save/push/Pusher.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/save/Pusher.java
@@ -1,4 +1,4 @@
-package dev.struchkov.godfather.core.service.save.push;
+package dev.struchkov.godfather.context.service.save;
import java.util.Map;
diff --git a/bot-core/pom.xml b/bot-core/pom.xml
index 124c8e8..4ced09c 100644
--- a/bot-core/pom.xml
+++ b/bot-core/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.8
+ 0.0.9
bot-core
@@ -19,11 +19,6 @@
dev.struchkov.godfather
bot-context
-
-
- dev.struchkov
- autoresponder
-
\ No newline at end of file
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java b/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java
index 8115559..21ab4a6 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java
@@ -1,27 +1,25 @@
package dev.struchkov.godfather.core;
import dev.struchkov.autoresponder.Responder;
-import dev.struchkov.autoresponder.entity.Unit;
-import dev.struchkov.godfather.context.domain.UnitPointer;
+import dev.struchkov.godfather.context.domain.TypeUnit;
+import dev.struchkov.godfather.context.domain.UnitRequest;
import dev.struchkov.godfather.context.domain.content.Message;
+import dev.struchkov.godfather.context.domain.unit.MainUnit;
+import dev.struchkov.godfather.context.domain.unit.UnitActiveType;
import dev.struchkov.godfather.context.exception.ConfigAppException;
+import dev.struchkov.godfather.context.service.Accessibility;
import dev.struchkov.godfather.context.service.Modifiable;
import dev.struchkov.godfather.context.service.PersonSettingService;
-import dev.struchkov.godfather.context.service.UnitPointerService;
+import dev.struchkov.godfather.context.service.StorylineService;
import dev.struchkov.godfather.context.service.sender.Sending;
-import dev.struchkov.godfather.core.domain.unit.MainUnit;
-import dev.struchkov.godfather.core.domain.unit.UnitActiveType;
-import dev.struchkov.godfather.core.service.Accessibility;
import dev.struchkov.godfather.core.service.ErrorHandler;
import dev.struchkov.godfather.core.service.action.ActionUnit;
import dev.struchkov.godfather.core.service.action.AnswerCheckAction;
-import dev.struchkov.godfather.core.service.action.AnswerProcessingAction;
import dev.struchkov.godfather.core.service.action.AnswerSaveAction;
import dev.struchkov.godfather.core.service.action.AnswerTextAction;
import dev.struchkov.godfather.core.service.action.AnswerTimerAction;
import dev.struchkov.godfather.core.service.action.AnswerValidityAction;
import dev.struchkov.godfather.core.service.timer.TimerService;
-import dev.struchkov.godfather.core.utils.TypeUnit;
import dev.struchkov.haiti.context.exception.NotFoundException;
import java.util.HashMap;
@@ -33,10 +31,10 @@ import java.util.stream.Collectors;
public class GeneralAutoResponder {
- private ErrorHandler errorHandler;
private final PersonSettingService personSettingService;
- private final UnitPointerService unitPointerService;
- private final StoryLine storyLine;
+
+ private ErrorHandler errorHandler;
+ private final StorylineService storyLineService;
protected Map> actionUnitMap = new HashMap<>();
protected List> modifiable;
@@ -44,18 +42,15 @@ public class GeneralAutoResponder {
protected GeneralAutoResponder(
Sending sending,
PersonSettingService personSettingService,
- UnitPointerService unitPointerService,
- List