Небольшой рефакторинг
This commit is contained in:
parent
0bbdcaae07
commit
d4f6a672ef
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.18</version>
|
||||
<version>0.0.22</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bot-context</artifactId>
|
||||
|
@ -90,7 +90,7 @@ public class Mail extends Message implements Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
public String getEventType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,6 @@ package dev.struchkov.godfather.context.domain.event;
|
||||
|
||||
public interface Event {
|
||||
|
||||
String getType();
|
||||
String getEventType();
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class SimpleButton implements KeyBoardButton {
|
||||
this.callbackData = callbackData;
|
||||
}
|
||||
|
||||
public static SimpleButton simpleButton(@NotNull String label, @NotNull String callbackData) {
|
||||
public static SimpleButton simpleButton(@NotNull String label, String callbackData) {
|
||||
return new SimpleButton(label, callbackData);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@ package dev.struchkov.godfather.context.service;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.event.Event;
|
||||
|
||||
public interface EventProvider<T extends Event> {
|
||||
public interface EventHandler<T extends Event> {
|
||||
|
||||
void sendEvent(T event);
|
||||
void handle(T event);
|
||||
|
||||
String getEventType();
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.18</version>
|
||||
<version>0.0.22</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bot-core</artifactId>
|
||||
|
@ -11,6 +11,8 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static dev.struchkov.haiti.utils.Checker.checkNull;
|
||||
|
||||
public class Storyline<M extends Message> {
|
||||
|
||||
private final Set<MainUnit<M>> startingUnits = new HashSet<>();
|
||||
@ -50,6 +52,9 @@ public class Storyline<M extends Message> {
|
||||
final MainUnit<M> firstUnit = units.get(firstName);
|
||||
final MainUnit<M> secondUnit = units.get(secondName);
|
||||
Inspector.isNotNull(firstUnit, secondUnit);
|
||||
if (checkNull(firstUnit.getNextUnits())) {
|
||||
firstUnit.setNextUnits(new HashSet<>());
|
||||
}
|
||||
firstUnit.getNextUnits().add(secondUnit);
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
package dev.struchkov.godfather.core.service.provider;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.content.Mail;
|
||||
import dev.struchkov.godfather.context.service.EventProvider;
|
||||
import dev.struchkov.godfather.context.service.EventHandler;
|
||||
import dev.struchkov.godfather.core.GeneralAutoResponder;
|
||||
|
||||
public class EventStoryLineProvider implements EventProvider<Mail> {
|
||||
public class StoryLineHandler implements EventHandler<Mail> {
|
||||
|
||||
private final GeneralAutoResponder<Mail> generalAutoResponder;
|
||||
|
||||
public EventStoryLineProvider(GeneralAutoResponder<Mail> generalAutoResponder) {
|
||||
public StoryLineHandler(GeneralAutoResponder<Mail> generalAutoResponder) {
|
||||
this.generalAutoResponder = generalAutoResponder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendEvent(Mail message) {
|
||||
public void handle(Mail message) {
|
||||
generalAutoResponder.processingNewMessage(message);
|
||||
}
|
||||
|
10
pom.xml
10
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.18</version>
|
||||
<version>0.0.22</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
@ -32,13 +32,11 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<godfather.ver>0.0.18</godfather.ver>
|
||||
|
||||
<godfather.context.ver>${godfather.ver}</godfather.context.ver>
|
||||
<godfather.core.ver>${godfather.ver}</godfather.core.ver>
|
||||
<godfather.context.ver>${project.version}</godfather.context.ver>
|
||||
<godfather.core.ver>${project.version}</godfather.core.ver>
|
||||
|
||||
<autoresponder.ver>3.4.0</autoresponder.ver>
|
||||
<haiti.utils>1.2.0</haiti.utils>
|
||||
<haiti.utils>1.3.0</haiti.utils>
|
||||
|
||||
<javax.persistence.api.ver>2.2</javax.persistence.api.ver>
|
||||
<validation.api.ver>2.0.1.Final</validation.api.ver>
|
||||
|
Loading…
Reference in New Issue
Block a user