diff --git a/bot-context/pom.xml b/bot-context/pom.xml
index ca43f67..fa90386 100644
--- a/bot-context/pom.xml
+++ b/bot-context/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.11
+ 0.0.12
bot-context
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/EmptyMessage.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/EmptyMessage.java
index d828343..15bb442 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/EmptyMessage.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/EmptyMessage.java
@@ -10,7 +10,7 @@ import dev.struchkov.godfather.context.exception.AppBotException;
public class EmptyMessage extends Message {
public EmptyMessage() {
- type = ContentType.EMPTY;
+ contentType = ContentType.EMPTY;
}
@Override
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 66f9286..ead06ff 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
@@ -1,6 +1,7 @@
package dev.struchkov.godfather.context.domain.content;
import dev.struchkov.godfather.context.domain.content.attachment.Attachment;
+import dev.struchkov.godfather.context.domain.event.Event;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -18,7 +19,9 @@ import java.util.List;
*/
@Entity
@Table(name = "mail")
-public class Mail extends Message {
+public class Mail extends Message implements Event {
+
+ public static final String TYPE = "MAIL";
/**
* Имя отправителя.
@@ -47,7 +50,7 @@ public class Mail extends Message {
private List forwardMail;
public Mail() {
- type = ContentType.MAIL;
+ contentType = ContentType.MAIL;
}
public String getFirstName() {
@@ -86,4 +89,9 @@ public class Mail extends Message {
this.forwardMail = forwardMail;
}
+ @Override
+ public String getType() {
+ return TYPE;
+ }
+
}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Message.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Message.java
index 2c6487f..011efe6 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Message.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/Message.java
@@ -23,7 +23,7 @@ public abstract class Message extends BasicEntity {
*/
@Column(name = "type")
@Enumerated(value = EnumType.STRING)
- protected ContentType type;
+ protected ContentType contentType;
/**
* Дата создания.
@@ -56,18 +56,18 @@ public abstract class Message extends BasicEntity {
this.text = source.getText();
this.createDate = source.getCreateDate();
this.id = source.getPersonId();
- this.type = source.getType();
+ this.contentType = source.getContentType();
}
public Message() {
}
- public ContentType getType() {
- return type;
+ public ContentType getContentType() {
+ return contentType;
}
- public void setType(ContentType type) {
- this.type = type;
+ public void setContentType(ContentType type) {
+ this.contentType = type;
}
public LocalDateTime getCreateDate() {
@@ -107,12 +107,12 @@ public abstract class Message extends BasicEntity {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message = (Message) o;
- return type == message.type && Objects.equals(createDate, message.createDate) && Objects.equals(addDate, message.addDate) && Objects.equals(personId, message.personId) && Objects.equals(text, message.text);
+ return contentType == message.contentType && Objects.equals(createDate, message.createDate) && Objects.equals(addDate, message.addDate) && Objects.equals(personId, message.personId) && Objects.equals(text, message.text);
}
@Override
public int hashCode() {
- return Objects.hash(type, createDate, addDate, personId, text);
+ return Objects.hash(contentType, createDate, addDate, personId, text);
}
}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/event/Event.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/event/Event.java
new file mode 100644
index 0000000..4d6bcdb
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/event/Event.java
@@ -0,0 +1,7 @@
+package dev.struchkov.godfather.context.domain.event;
+
+public interface Event {
+
+ String getType();
+
+}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/service/EventProvider.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/EventProvider.java
index 26b8a6d..2bdfc8e 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/service/EventProvider.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/EventProvider.java
@@ -1,9 +1,11 @@
package dev.struchkov.godfather.context.service;
-import dev.struchkov.godfather.context.domain.content.Message;
+import dev.struchkov.godfather.context.domain.event.Event;
-public interface EventProvider {
+public interface EventProvider {
- void sendEvent(M message);
+ void sendEvent(T event);
+
+ String getEventType();
}
diff --git a/bot-core/pom.xml b/bot-core/pom.xml
index 6cb70bb..32a4d90 100644
--- a/bot-core/pom.xml
+++ b/bot-core/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.11
+ 0.0.12
bot-core
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/provider/EventStoryLineProvider.java b/bot-core/src/main/java/dev/struchkov/godfather/core/service/provider/EventStoryLineProvider.java
index f2a48ac..78af56f 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/provider/EventStoryLineProvider.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/service/provider/EventStoryLineProvider.java
@@ -17,4 +17,9 @@ public class EventStoryLineProvider implements EventProvider {
generalAutoResponder.processingNewMessage(message);
}
+ @Override
+ public String getEventType() {
+ return Mail.TYPE;
+ }
+
}
diff --git a/pom.xml b/pom.xml
index ebf976c..87be887 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.11
+ 0.0.12
pom
@@ -32,7 +32,7 @@
UTF-8
UTF-8
- 0.0.11
+ 0.0.12
${godfather.ver}
${godfather.ver}