diff --git a/pom.xml b/pom.xml
index e00f490..f6c8753 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.sadtech.bot
- bot-core
- 0.6.2-RELEASE
+ org.sadtech.social
+ social-core
+ 0.6.3-SNAPSHOT
jar
@@ -26,7 +26,6 @@
2.8.5
1.7.26
1.4
- 4.12
@@ -35,6 +34,7 @@
gson
${gson.ver}
+
org.slf4j
slf4j-api
@@ -48,9 +48,9 @@
- junit
- junit
- ${junit.ver}
+ org.projectlombok
+ lombok
+ 1.18.8
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/BoardComment.java b/src/main/java/org/sadtech/bot/core/domain/content/BoardComment.java
deleted file mode 100644
index 9ca069b..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/BoardComment.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.sadtech.bot.core.domain.content;
-
-public class BoardComment extends Comment {
-
- public BoardComment() {
- type = ContentType.BOARD_COMMENT;
- }
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/Comment.java b/src/main/java/org/sadtech/bot/core/domain/content/Comment.java
deleted file mode 100644
index ca32e31..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/Comment.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.sadtech.bot.core.domain.content;
-
-import java.util.Objects;
-
-public abstract class Comment extends Message {
-
- private Integer contentId;
-
- public Integer getContentId() {
- return contentId;
- }
-
- public void setContentId(Integer contentId) {
- this.contentId = contentId;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Comment)) return false;
- if (!super.equals(o)) return false;
- Comment that = (Comment) o;
- return Objects.equals(contentId, that.contentId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), contentId);
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/ContentType.java b/src/main/java/org/sadtech/bot/core/domain/content/ContentType.java
deleted file mode 100644
index 89e1d4e..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/ContentType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sadtech.bot.core.domain.content;
-
-public enum ContentType {
-
- MAIL, BOARD_COMMENT, EMPTY
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/EmptyMessage.java b/src/main/java/org/sadtech/bot/core/domain/content/EmptyMessage.java
deleted file mode 100644
index 16498c3..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/EmptyMessage.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.sadtech.bot.core.domain.content;
-
-import org.sadtech.bot.core.exception.AppBotException;
-
-public class EmptyMessage extends Message {
-
- public EmptyMessage() {
- type = ContentType.EMPTY;
- }
-
- @Override
- public String getMessage() {
- return "";
- }
-
- @Override
- public void setMessage(String message) {
- throw new AppBotException(0, "EmptyMessage no setMessage");
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/Mail.java b/src/main/java/org/sadtech/bot/core/domain/content/Mail.java
deleted file mode 100644
index f09e4a3..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/Mail.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.sadtech.bot.core.domain.content;
-
-import org.sadtech.bot.core.domain.content.attachment.Attachment;
-
-import java.util.List;
-import java.util.Objects;
-
-public class Mail extends Message {
-
- private List attachments;
-
- public Mail() {
- type = ContentType.MAIL;
- }
-
- public Mail(Mail source) {
- super(source);
- this.attachments = source.getAttachments();
- }
-
-
- public Mail prototype() {
- return new Mail(this);
- }
-
- public List getAttachments() {
- return attachments;
- }
-
- public void setAttachments(List attachments) {
- this.attachments = attachments;
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Mail)) return false;
- if (!super.equals(o)) return false;
- Mail mail = (Mail) o;
- return Objects.equals(attachments, mail.attachments);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), attachments);
- }
-
- @Override
- public String toString() {
- return "Mail{" +
- "attachments=" + attachments +
- ", type=" + type +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/Message.java b/src/main/java/org/sadtech/bot/core/domain/content/Message.java
deleted file mode 100644
index ecaf204..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/Message.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.sadtech.bot.core.domain.content;
-
-import java.time.LocalDateTime;
-import java.util.Objects;
-
-public abstract class Message {
-
- private Integer id;
- protected ContentType type;
- private LocalDateTime createDate;
- private Integer personId;
- private String message;
-
- public Message() {
-
- }
-
- public Message(Message source) {
- this.personId = source.getPersonId();
- this.message = source.getMessage();
- this.createDate = source.getCreateDate();
- this.id = source.getPersonId();
- this.type = source.getType();
- }
-
- public Integer getPersonId() {
- return personId;
- }
-
- public void setPersonId(Integer personId) {
- this.personId = personId;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public LocalDateTime getCreateDate() {
- return createDate;
- }
-
- public void setCreateDate(LocalDateTime createDate) {
- this.createDate = createDate;
- }
-
- public ContentType getType() {
- return type;
- }
-
- public void setType(ContentType type) {
- this.type = type;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Message)) return false;
- Message message = (Message) o;
- return Objects.equals(id, message.id) &&
- type == message.type &&
- Objects.equals(createDate, message.createDate) &&
- Objects.equals(personId, message.personId) &&
- Objects.equals(this.message, message.message);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type, createDate, personId, message);
- }
-
- @Override
- public String toString() {
- return "Message{" +
- "id=" + id +
- ", type=" + type +
- ", createDate=" + createDate +
- ", personId=" + personId +
- ", message='" + message + '\'' +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/attachment/Attachment.java b/src/main/java/org/sadtech/bot/core/domain/content/attachment/Attachment.java
deleted file mode 100644
index 12698de..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/attachment/Attachment.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.sadtech.bot.core.domain.content.attachment;
-
-public abstract class Attachment {
-
- protected AttachmentType type;
-
- public AttachmentType getType() {
- return type;
- }
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/attachment/AttachmentType.java b/src/main/java/org/sadtech/bot/core/domain/content/attachment/AttachmentType.java
deleted file mode 100644
index 16fb351..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/attachment/AttachmentType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sadtech.bot.core.domain.content.attachment;
-
-public enum AttachmentType {
-
- AUDIO_MESSAGE, GEO
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/attachment/AudioMessage.java b/src/main/java/org/sadtech/bot/core/domain/content/attachment/AudioMessage.java
deleted file mode 100644
index 15f61eb..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/attachment/AudioMessage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.sadtech.bot.core.domain.content.attachment;
-
-import java.net.URL;
-import java.util.Objects;
-
-public class AudioMessage extends Attachment {
-
- private URL linkOdd;
-
- public AudioMessage() {
- type = AttachmentType.AUDIO_MESSAGE;
- }
-
- public URL getLinkOdd() {
- return linkOdd;
- }
-
- public void setLinkOdd(URL linkOdd) {
- this.linkOdd = linkOdd;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof AudioMessage)) return false;
- AudioMessage that = (AudioMessage) o;
- return Objects.equals(linkOdd, that.linkOdd);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(linkOdd);
- }
-
- @Override
- public String toString() {
- return "AudioMessage{" +
- "linkOdd=" + linkOdd +
- ", type=" + type +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/attachment/Geo.java b/src/main/java/org/sadtech/bot/core/domain/content/attachment/Geo.java
deleted file mode 100644
index 520ea14..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/attachment/Geo.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.sadtech.bot.core.domain.content.attachment;
-
-import java.util.Objects;
-
-public class Geo extends Attachment {
-
- private GeoCoordinate geoCoordinate;
- private String country;
- private String city;
-
- private Geo() {
- type = AttachmentType.GEO;
- }
-
- public GeoCoordinate getGeoCoordinate() {
- return geoCoordinate;
- }
-
- public String getCountry() {
- return country;
- }
-
- public String getCity() {
- return city;
- }
-
- public static Builder builder() {
- return new Geo().new Builder();
- }
-
- 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;
- }
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Geo)) return false;
- Geo geo = (Geo) o;
- return Objects.equals(geoCoordinate, geo.geoCoordinate) &&
- Objects.equals(country, geo.country) &&
- Objects.equals(city, geo.city);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(geoCoordinate, country, city);
- }
-
- @Override
- public String toString() {
- return "Geo{" +
- "geoCoordinate=" + geoCoordinate +
- ", country='" + country + '\'' +
- ", city='" + city + '\'' +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/content/attachment/GeoCoordinate.java b/src/main/java/org/sadtech/bot/core/domain/content/attachment/GeoCoordinate.java
deleted file mode 100644
index 69dfa8b..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/content/attachment/GeoCoordinate.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.sadtech.bot.core.domain.content.attachment;
-
-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/src/main/java/org/sadtech/bot/core/domain/keyboard/ButtonColor.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/ButtonColor.java
deleted file mode 100644
index 49263a2..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/ButtonColor.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard;
-
-public enum ButtonColor {
-
- PRIMARY, DEFAULT, NEGATIVE, POSITIVE
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/keyboard/ButtonType.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/ButtonType.java
deleted file mode 100644
index 5a253e4..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/ButtonType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard;
-
-public enum ButtonType {
-
- TEXT, ACCOUNT
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoard.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoard.java
deleted file mode 100644
index 70d0a7b..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoard.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-public class KeyBoard {
-
- private List keyBoardLines = new ArrayList<>();
- private boolean oneTime = true;
-
- private KeyBoard() {
-
- }
-
- public List getKeyBoardLines() {
- return keyBoardLines;
- }
-
- public boolean isOneTime() {
- return oneTime;
- }
-
- public static Builder builder() {
- return new KeyBoard().new Builder();
- }
-
- public class Builder {
-
- private Builder() {
-
- }
-
- public Builder lineKeyBoard(KeyBoardLine keyBoardLine) {
- KeyBoard.this.keyBoardLines.add(keyBoardLine);
- return this;
- }
-
- public Builder oneTime(boolean oneTime) {
- KeyBoard.this.oneTime = oneTime;
- return this;
- }
-
- public KeyBoard build() {
- return KeyBoard.this;
- }
-
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof KeyBoard)) return false;
- KeyBoard keyBoard = (KeyBoard) o;
- return oneTime == keyBoard.oneTime &&
- Objects.equals(keyBoardLines, keyBoard.keyBoardLines);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(keyBoardLines, oneTime);
- }
-
- @Override
- public String toString() {
- return "KeyBoard{" +
- "keyBoardLines=" + keyBoardLines +
- ", oneTime=" + oneTime +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoardButton.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoardButton.java
deleted file mode 100644
index b783a13..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoardButton.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard;
-
-import java.util.Objects;
-
-public abstract class KeyBoardButton {
-
- protected String payload;
- protected ButtonType type = ButtonType.TEXT;
-
- public String getPayload() {
- return payload;
- }
-
- public void setPayload(String payload) {
- this.payload = payload;
- }
-
- public ButtonType getType() {
- return type;
- }
-
- public void setType(ButtonType type) {
- this.type = type;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof KeyBoardButton)) return false;
- KeyBoardButton that = (KeyBoardButton) o;
- return Objects.equals(payload, that.payload) &&
- type == that.type;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(payload, type);
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoardLine.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoardLine.java
deleted file mode 100644
index 75d5639..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/KeyBoardLine.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-public class KeyBoardLine {
-
- private List keyBoardButtons = new ArrayList<>();
-
- private KeyBoardLine() {
-
- }
-
- public List getKeyBoardButtons() {
- return keyBoardButtons;
- }
-
- public static Builder builder() {
- return new KeyBoardLine().new Builder();
- }
-
- public class Builder {
-
- private Builder() {
-
- }
-
- public Builder buttonKeyBoard(KeyBoardButton keyBoardButton) {
- KeyBoardLine.this.keyBoardButtons.add(keyBoardButton);
- return this;
- }
-
- public KeyBoardLine build() {
- return KeyBoardLine.this;
- }
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof KeyBoardLine)) return false;
- KeyBoardLine that = (KeyBoardLine) o;
- return Objects.equals(keyBoardButtons, that.keyBoardButtons);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(keyBoardButtons);
- }
-
- @Override
- public String toString() {
- return "KeyBoardLine{" +
- "keyBoardButtons=" + keyBoardButtons +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/keyboard/button/KeyBoardButtonAccount.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/button/KeyBoardButtonAccount.java
deleted file mode 100644
index 49fce62..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/button/KeyBoardButtonAccount.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard.button;
-
-import org.sadtech.bot.core.domain.keyboard.ButtonType;
-import org.sadtech.bot.core.domain.keyboard.KeyBoardButton;
-
-import java.util.Objects;
-
-public class KeyBoardButtonAccount extends KeyBoardButton {
-
- private Integer amount;
- private Integer accountId;
- private String description;
-
- private KeyBoardButtonAccount() {
- type = ButtonType.ACCOUNT;
- }
-
- public Integer getAmount() {
- return amount;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Integer getAccountId() {
- return accountId;
- }
-
- public static Builder builder() {
- return new KeyBoardButtonAccount().new Builder();
- }
-
- public class Builder {
- private Builder() {
-
- }
-
- public Builder amount(Integer amount) {
- KeyBoardButtonAccount.this.amount = amount;
- return this;
- }
-
- public Builder description(String description) {
- KeyBoardButtonAccount.this.description = description;
- return this;
- }
-
- public Builder accountId(Integer accountId) {
- KeyBoardButtonAccount.this.accountId = accountId;
- return this;
- }
-
-
- public KeyBoardButtonAccount build() {
- return KeyBoardButtonAccount.this;
- }
-
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof KeyBoardButtonAccount)) return false;
- if (!super.equals(o)) return false;
- KeyBoardButtonAccount that = (KeyBoardButtonAccount) o;
- return Objects.equals(amount, that.amount) &&
- Objects.equals(description, that.description);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), amount, description);
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/keyboard/button/KeyBoardButtonText.java b/src/main/java/org/sadtech/bot/core/domain/keyboard/button/KeyBoardButtonText.java
deleted file mode 100644
index ae00f2c..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/keyboard/button/KeyBoardButtonText.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.sadtech.bot.core.domain.keyboard.button;
-
-import org.sadtech.bot.core.domain.keyboard.ButtonColor;
-import org.sadtech.bot.core.domain.keyboard.ButtonType;
-import org.sadtech.bot.core.domain.keyboard.KeyBoardButton;
-
-import java.util.Objects;
-
-public class KeyBoardButtonText extends KeyBoardButton {
-
- private String label;
- private ButtonColor color = ButtonColor.DEFAULT;
-
- public KeyBoardButtonText() {
- type = ButtonType.TEXT;
- }
-
- public ButtonColor getColor() {
- return color;
- }
-
- public String getLabel() {
- return label;
- }
-
- public static Builder builder() {
- return new KeyBoardButtonText().new Builder();
- }
-
- public class Builder {
- private Builder() {
-
- }
-
- public Builder label(String label) {
- KeyBoardButtonText.this.label = label;
- return this;
- }
-
- public Builder color(ButtonColor color) {
- KeyBoardButtonText.this.color = color;
- return this;
- }
-
- public Builder payload(String payload) {
- KeyBoardButtonText.this.payload = payload;
- return this;
- }
-
- public KeyBoardButtonText build() {
- return KeyBoardButtonText.this;
- }
-
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof KeyBoardButtonText)) return false;
- if (!super.equals(o)) return false;
- KeyBoardButtonText that = (KeyBoardButtonText) o;
- return Objects.equals(label, that.label) &&
- color == that.color;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), label, color);
- }
-
- @Override
- public String toString() {
- return "KeyBoardButtonText{" +
- "label='" + label + '\'' +
- ", color=" + color +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/money/Account.java b/src/main/java/org/sadtech/bot/core/domain/money/Account.java
deleted file mode 100644
index bb7c996..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/money/Account.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.sadtech.bot.core.domain.money;
-
-import java.util.Objects;
-
-public class Account {
-
- private Integer id;
- private Integer totalSum;
- private Integer belongsPersonId;
- private Integer extinguishedPersonId;
- private String description;
- private AccountStatus accountStatus;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Integer getTotalSum() {
- return totalSum;
- }
-
- public void setTotalSum(Integer totalSum) {
- this.totalSum = totalSum;
- }
-
- public Integer getBelongsPersonId() {
- return belongsPersonId;
- }
-
- public void setBelongsPersonId(Integer belongsPersonId) {
- this.belongsPersonId = belongsPersonId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public AccountStatus getAccountStatus() {
- return accountStatus;
- }
-
- public void setAccountStatus(AccountStatus accountStatus) {
- this.accountStatus = accountStatus;
- }
-
- public Integer getExtinguishedPersonId() {
- return extinguishedPersonId;
- }
-
- public void setExtinguishedPersonId(Integer extinguishedPersonId) {
- this.extinguishedPersonId = extinguishedPersonId;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof Account)) return false;
- Account account = (Account) o;
- return Objects.equals(id, account.id) &&
- Objects.equals(totalSum, account.totalSum) &&
- Objects.equals(belongsPersonId, account.belongsPersonId) &&
- Objects.equals(extinguishedPersonId, account.extinguishedPersonId) &&
- Objects.equals(description, account.description) &&
- accountStatus == account.accountStatus;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, totalSum, belongsPersonId, extinguishedPersonId, description, accountStatus);
- }
-
- @Override
- public String toString() {
- return "Account{" +
- "id=" + id +
- ", totalSum=" + totalSum +
- ", belongsPersonId=" + belongsPersonId +
- ", extinguishedPersonId=" + extinguishedPersonId +
- ", description='" + description + '\'' +
- ", accountStatus=" + accountStatus +
- '}';
- }
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/money/AccountStatus.java b/src/main/java/org/sadtech/bot/core/domain/money/AccountStatus.java
deleted file mode 100644
index 5ea1cec..0000000
--- a/src/main/java/org/sadtech/bot/core/domain/money/AccountStatus.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sadtech.bot.core.domain.money;
-
-public enum AccountStatus {
-
- EXPOSED, CLOSED, CANCELLED, EXCEPTION
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/exception/TimerSettingExceprion.java b/src/main/java/org/sadtech/bot/core/exception/TimerSettingExceprion.java
deleted file mode 100644
index 0691440..0000000
--- a/src/main/java/org/sadtech/bot/core/exception/TimerSettingExceprion.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.sadtech.bot.core.exception;
-
-public class TimerSettingExceprion extends AppBotException {
-
- public TimerSettingExceprion(String message) {
- super(54, message);
- }
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/repository/AccountRepository.java b/src/main/java/org/sadtech/bot/core/repository/AccountRepository.java
deleted file mode 100644
index 5c89e8a..0000000
--- a/src/main/java/org/sadtech/bot/core/repository/AccountRepository.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.sadtech.bot.core.repository;
-
-import org.sadtech.bot.core.domain.money.Account;
-
-public interface AccountRepository {
-
- Integer add(Account account);
-
- void edit(Integer accountId, Account account);
-
- Account findById(Integer accountId);
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/repository/ContentRepository.java b/src/main/java/org/sadtech/bot/core/repository/ContentRepository.java
deleted file mode 100644
index bc78dfb..0000000
--- a/src/main/java/org/sadtech/bot/core/repository/ContentRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.sadtech.bot.core.repository;
-
-import org.sadtech.bot.core.domain.content.Message;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-public interface ContentRepository {
-
- Integer add(T content);
-
- List findByTime(LocalDateTime timeFrom, LocalDateTime timeTo);
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/repository/EventRepository.java b/src/main/java/org/sadtech/bot/core/repository/EventRepository.java
deleted file mode 100644
index 441c190..0000000
--- a/src/main/java/org/sadtech/bot/core/repository/EventRepository.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.sadtech.bot.core.repository;
-
-import java.util.Queue;
-
-public interface EventRepository {
-
- void add(T dataObject);
-
- void cleanAll();
-
- Queue getEventQueue();
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/service/AccountService.java b/src/main/java/org/sadtech/bot/core/service/AccountService.java
deleted file mode 100644
index 2c0cd62..0000000
--- a/src/main/java/org/sadtech/bot/core/service/AccountService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.sadtech.bot.core.service;
-
-import org.sadtech.bot.core.domain.money.Account;
-
-public interface AccountService {
-
- Integer add(Account account);
-
- Boolean pay(Integer accountId, Integer extinguishedPersonId, Integer sum);
-
- Boolean paymentVerification(Integer accountId);
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/service/BoardCommentService.java b/src/main/java/org/sadtech/bot/core/service/BoardCommentService.java
deleted file mode 100644
index 7383614..0000000
--- a/src/main/java/org/sadtech/bot/core/service/BoardCommentService.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.sadtech.bot.core.service;
-
-import org.sadtech.bot.core.domain.content.BoardComment;
-
-public interface BoardCommentService extends ContentService {
-}
diff --git a/src/main/java/org/sadtech/bot/core/service/ContentService.java b/src/main/java/org/sadtech/bot/core/service/ContentService.java
deleted file mode 100644
index 6fdf9e7..0000000
--- a/src/main/java/org/sadtech/bot/core/service/ContentService.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.sadtech.bot.core.service;
-
-import org.sadtech.bot.core.domain.content.Message;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-public interface ContentService {
-
- void add(T event);
-
- List getByTime(LocalDateTime timeFrom, LocalDateTime timeTo);
-
- List getLastEventByTime(LocalDateTime timeFrom, LocalDateTime timeTo);
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/service/Filter.java b/src/main/java/org/sadtech/bot/core/service/Filter.java
deleted file mode 100644
index 9662f2e..0000000
--- a/src/main/java/org/sadtech/bot/core/service/Filter.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.sadtech.bot.core.service;
-
-import org.sadtech.bot.core.domain.content.Message;
-
-@FunctionalInterface
-public interface Filter {
-
- void processing(T content);
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/service/MailService.java b/src/main/java/org/sadtech/bot/core/service/MailService.java
deleted file mode 100644
index 4a4fbf1..0000000
--- a/src/main/java/org/sadtech/bot/core/service/MailService.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.sadtech.bot.core.service;
-
-import org.sadtech.bot.core.domain.content.Mail;
-
-public interface MailService extends ContentService {
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/service/sender/Sent.java b/src/main/java/org/sadtech/bot/core/service/sender/Sent.java
deleted file mode 100644
index 2f7a266..0000000
--- a/src/main/java/org/sadtech/bot/core/service/sender/Sent.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.sadtech.bot.core.service.sender;
-
-import org.sadtech.bot.core.domain.BoxAnswer;
-
-public interface Sent {
-
- void send(Integer personId, BoxAnswer boxAnswer);
-
- void send(Integer contentId, Integer personId, BoxAnswer boxAnswer);
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/utils/Contents.java b/src/main/java/org/sadtech/bot/core/utils/Contents.java
deleted file mode 100644
index 5f674d0..0000000
--- a/src/main/java/org/sadtech/bot/core/utils/Contents.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.sadtech.bot.core.utils;
-
-import org.sadtech.bot.core.domain.content.EmptyMessage;
-
-public class Contents {
-
- private Contents() {
- throw new IllegalStateException("Utility class");
- }
-
- public static final EmptyMessage EMPTY_CONTENT = new EmptyMessage();
-
-
-}
diff --git a/src/main/java/org/sadtech/bot/core/domain/BoxAnswer.java b/src/main/java/org/sadtech/social/core/domain/BoxAnswer.java
similarity index 52%
rename from src/main/java/org/sadtech/bot/core/domain/BoxAnswer.java
rename to src/main/java/org/sadtech/social/core/domain/BoxAnswer.java
index 1cc6246..de38213 100644
--- a/src/main/java/org/sadtech/bot/core/domain/BoxAnswer.java
+++ b/src/main/java/org/sadtech/social/core/domain/BoxAnswer.java
@@ -1,15 +1,32 @@
-package org.sadtech.bot.core.domain;
+package org.sadtech.social.core.domain;
-import org.sadtech.bot.core.domain.content.attachment.GeoCoordinate;
-import org.sadtech.bot.core.domain.keyboard.KeyBoard;
-
-import java.util.Objects;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import org.sadtech.social.core.domain.content.attachment.GeoCoordinate;
+import org.sadtech.social.core.domain.keyboard.KeyBoard;
+import org.sadtech.social.core.utils.Description;
+/**
+ * Контейнер, которые содержит данные, которые будут отправлены пользователю как ответ на его запрос.
+ *
+ * @author upagge [08/07/2019]
+ */
+@EqualsAndHashCode
+@ToString
+@Getter
public class BoxAnswer {
+ @Description("Обычное текстовое сообщение")
private String message;
+
+ @Description("Клавиатура - меню")
private KeyBoard keyboard;
+
+ @Description("Географические координаты")
private GeoCoordinate coordinates;
+
+ @Description("Идентификатор стикера")
private Integer stickerId;
private BoxAnswer() {
@@ -25,27 +42,10 @@ public class BoxAnswer {
}
}
-
- public String getMessage() {
- return message;
- }
-
public void setMessage(String message) {
this.message = message;
}
- public KeyBoard getKeyboard() {
- return keyboard;
- }
-
- public GeoCoordinate getCoordinates() {
- return coordinates;
- }
-
- public Integer getStickerId() {
- return stickerId;
- }
-
public BoxAnswer prototype() {
return new BoxAnswer(this);
}
@@ -84,29 +84,4 @@ public class BoxAnswer {
}
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof BoxAnswer)) return false;
- BoxAnswer boxAnswer = (BoxAnswer) o;
- return Objects.equals(message, boxAnswer.message) &&
- Objects.equals(keyboard, boxAnswer.keyboard) &&
- Objects.equals(coordinates, boxAnswer.coordinates) &&
- Objects.equals(stickerId, boxAnswer.stickerId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(message, keyboard, coordinates, stickerId);
- }
-
- @Override
- public String toString() {
- return "BoxAnswer{" +
- "message='" + message + '\'' +
- ", keyboard=" + keyboard +
- ", coordinates=" + coordinates +
- ", stickerId=" + stickerId +
- '}';
- }
}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/BoardComment.java b/src/main/java/org/sadtech/social/core/domain/content/BoardComment.java
new file mode 100644
index 0000000..7a94bbd
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/BoardComment.java
@@ -0,0 +1,14 @@
+package org.sadtech.social.core.domain.content;
+
+/**
+ * Сообщение от пользователя типа "Комментарий к обсуждению группы".
+ *
+ * @author upagge [08/07/2019]
+ */
+public class BoardComment extends Comment {
+
+ public BoardComment() {
+ type = ContentType.BOARD_COMMENT;
+ }
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/Comment.java b/src/main/java/org/sadtech/social/core/domain/content/Comment.java
new file mode 100644
index 0000000..b75b0be
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/Comment.java
@@ -0,0 +1,17 @@
+package org.sadtech.social.core.domain.content;
+
+import lombok.Data;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Абстрактная сущность для сообщений от пользователей с привязкой к какому-то контенту (картинка, видео).
+ *
+ * @author upagge [08/07/2019]
+ */
+@Data
+public abstract class Comment extends Message {
+
+ @Description("Идентификатор контента, к которому ставлено сообщение")
+ private Integer contentId;
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/ContentType.java b/src/main/java/org/sadtech/social/core/domain/content/ContentType.java
new file mode 100644
index 0000000..88635a2
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/ContentType.java
@@ -0,0 +1,12 @@
+package org.sadtech.social.core.domain.content;
+
+/**
+ * Тип сообщения от пользователя {@link Message}.
+ *
+ * @author upagge [08/07/2019]
+ */
+public enum ContentType {
+
+ MAIL, BOARD_COMMENT, EMPTY
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/EmptyMessage.java b/src/main/java/org/sadtech/social/core/domain/content/EmptyMessage.java
new file mode 100644
index 0000000..0dcd3ae
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/EmptyMessage.java
@@ -0,0 +1,27 @@
+package org.sadtech.social.core.domain.content;
+
+import lombok.ToString;
+import org.sadtech.social.core.exception.AppBotException;
+
+/**
+ * Заглушка для сообщения от пользователя.
+ *
+ * @author upagge [08/07/2019]
+ */
+@ToString
+public class EmptyMessage extends Message {
+
+ public EmptyMessage() {
+ type = ContentType.EMPTY;
+ }
+
+ @Override
+ public String getText() {
+ return "";
+ }
+
+ @Override
+ public void setText(String text) {
+ throw new AppBotException(0, "EmptyMessage no setText");
+ }
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/Mail.java b/src/main/java/org/sadtech/social/core/domain/content/Mail.java
new file mode 100644
index 0000000..5eda997
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/Mail.java
@@ -0,0 +1,36 @@
+package org.sadtech.social.core.domain.content;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.sadtech.social.core.domain.content.attachment.Attachment;
+import org.sadtech.social.core.utils.Description;
+
+import java.util.List;
+
+/**
+ * Сообщение от пользователя типа "Личное сообщение".
+ *
+ * @author upagge [08/07/2019]
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class Mail extends Message {
+
+ @Description("Вложения к сообщению")
+ private List attachments;
+
+ public Mail() {
+ type = ContentType.MAIL;
+ }
+
+ public Mail(Mail source) {
+ super(source);
+ this.attachments = source.getAttachments();
+ }
+
+
+ public Mail prototype() {
+ return new Mail(this);
+ }
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/Message.java b/src/main/java/org/sadtech/social/core/domain/content/Message.java
new file mode 100644
index 0000000..0ab18f3
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/Message.java
@@ -0,0 +1,43 @@
+package org.sadtech.social.core.domain.content;
+
+import lombok.Data;
+import org.sadtech.social.core.utils.Description;
+
+import java.time.LocalDateTime;
+
+/**
+ * Аьстрактная сущность - Сообщение от пользователя.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Data
+public abstract class Message {
+
+ @Description("Идентификатор сообщения")
+ private Integer id;
+
+ @Description("Тип сообщения")
+ protected ContentType type;
+
+ @Description("Дата создания")
+ private LocalDateTime createDate;
+
+ @Description("Идентификатор пользователя, отправившего сообщение")
+ private Integer personId;
+
+ @Description("Текстовое сообщение")
+ private String text;
+
+ public Message() {
+
+ }
+
+ public Message(Message source) {
+ this.personId = source.getPersonId();
+ this.text = source.getText();
+ this.createDate = source.getCreateDate();
+ this.id = source.getPersonId();
+ this.type = source.getType();
+ }
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/attachment/Attachment.java b/src/main/java/org/sadtech/social/core/domain/content/attachment/Attachment.java
new file mode 100644
index 0000000..e288600
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/attachment/Attachment.java
@@ -0,0 +1,21 @@
+package org.sadtech.social.core.domain.content.attachment;
+
+import lombok.EqualsAndHashCode;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Абстрактная сущность, для всех вложений к сообщениям от пользователей.
+ *
+ * @author upagge [08/07/2019]
+ */
+@EqualsAndHashCode
+public abstract class Attachment {
+
+ @Description("Тип сущности")
+ protected AttachmentType type;
+
+ public AttachmentType getType() {
+ return type;
+ }
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/attachment/AttachmentType.java b/src/main/java/org/sadtech/social/core/domain/content/attachment/AttachmentType.java
new file mode 100644
index 0000000..d4f31aa
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/attachment/AttachmentType.java
@@ -0,0 +1,13 @@
+package org.sadtech.social.core.domain.content.attachment;
+
+/**
+ * Тип вложения {@link Attachment} к сообщению.
+ *
+ * @author upagge [08/07/2019]
+ */
+public enum AttachmentType {
+
+ AUDIO_MESSAGE,
+ GEO
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/attachment/AudioMessage.java b/src/main/java/org/sadtech/social/core/domain/content/attachment/AudioMessage.java
new file mode 100644
index 0000000..419fe82
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/attachment/AudioMessage.java
@@ -0,0 +1,29 @@
+package org.sadtech.social.core.domain.content.attachment;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.sadtech.social.core.utils.Description;
+
+import java.net.URL;
+
+
+/**
+ * Вложение типа "Аудиосообщение".
+ *
+ * @author upagge [08/07/2019]
+ */
+@Getter
+@EqualsAndHashCode(callSuper = true)
+@ToString
+@Setter
+public class AudioMessage extends Attachment {
+
+ @Description("Ссылка на аудиозапись в формате odd")
+ private URL linkOdd;
+
+ public AudioMessage() {
+ type = AttachmentType.AUDIO_MESSAGE;
+ }
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/content/attachment/Geo.java b/src/main/java/org/sadtech/social/core/domain/content/attachment/Geo.java
new file mode 100644
index 0000000..10af5c5
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/attachment/Geo.java
@@ -0,0 +1,60 @@
+package org.sadtech.social.core.domain.content.attachment;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Вложение типа "Карта".
+ *
+ * @author upagge [08/07/2019]
+ */
+@Getter
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class Geo extends Attachment {
+
+ @Description("Географические координаты")
+ private GeoCoordinate geoCoordinate;
+
+ @Description("Название страны")
+ private String country;
+
+ @Description("Название города")
+ private String city;
+
+ private Geo() {
+ type = AttachmentType.GEO;
+ }
+
+ public static Builder builder() {
+ return new Geo().new Builder();
+ }
+
+ 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/src/main/java/org/sadtech/social/core/domain/content/attachment/GeoCoordinate.java b/src/main/java/org/sadtech/social/core/domain/content/attachment/GeoCoordinate.java
new file mode 100644
index 0000000..afdfada
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/content/attachment/GeoCoordinate.java
@@ -0,0 +1,21 @@
+package org.sadtech.social.core.domain.content.attachment;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Сущность для хранения географических координат.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Data
+@AllArgsConstructor
+public class GeoCoordinate {
+
+ @Description("Широта")
+ private Float latitude;
+ @Description("Долгота")
+ private Float longitude;
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/ButtonColor.java b/src/main/java/org/sadtech/social/core/domain/keyboard/ButtonColor.java
new file mode 100644
index 0000000..80916c9
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/ButtonColor.java
@@ -0,0 +1,15 @@
+package org.sadtech.social.core.domain.keyboard;
+
+/**
+ * Цвета кнопок на клавиатуре {@link KeyBoard}.
+ *
+ * @author upagge [08/07/2019]
+ */
+public enum ButtonColor {
+
+ PRIMARY,
+ DEFAULT,
+ NEGATIVE,
+ POSITIVE
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/ButtonType.java b/src/main/java/org/sadtech/social/core/domain/keyboard/ButtonType.java
new file mode 100644
index 0000000..ef8e844
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/ButtonType.java
@@ -0,0 +1,13 @@
+package org.sadtech.social.core.domain.keyboard;
+
+/**
+ * Тип кнопки на клавиатуре {@link KeyBoard}.
+ *
+ * @author upagge [08/07/2019]
+ */
+public enum ButtonType {
+
+ TEXT,
+ ACCOUNT
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoard.java b/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoard.java
new file mode 100644
index 0000000..372be57
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoard.java
@@ -0,0 +1,31 @@
+package org.sadtech.social.core.domain.keyboard;
+
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Singular;
+import lombok.ToString;
+import org.sadtech.social.core.utils.Description;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Сущность клавиатуры, для создания меню с вариантами выбора.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Builder
+@Getter
+@EqualsAndHashCode
+@ToString
+public class KeyBoard {
+
+ @Description("Строки меню")
+ @Singular(value = "lineKeyBoard")
+ private List keyBoardLines = new ArrayList<>();
+
+ @Description("Скрыть меню после ответа или нет")
+ private boolean oneTime = true;
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoardButton.java b/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoardButton.java
new file mode 100644
index 0000000..d554588
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoardButton.java
@@ -0,0 +1,27 @@
+package org.sadtech.social.core.domain.keyboard;
+
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Абстрактная сущность кнопки для клавиатуры.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Getter
+@EqualsAndHashCode
+@ToString
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
+public abstract class KeyBoardButton {
+
+ @Description("Скрытое сообщение, отправляемое по нажатию")
+ protected String payload;
+
+ @Description("Тип кнопки")
+ protected ButtonType type;
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoardLine.java b/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoardLine.java
new file mode 100644
index 0000000..6a0867f
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/KeyBoardLine.java
@@ -0,0 +1,28 @@
+package org.sadtech.social.core.domain.keyboard;
+
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Singular;
+import lombok.ToString;
+import org.sadtech.social.core.utils.Description;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Строка в меню клавиатуры {@link KeyBoard}.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Builder
+@Getter
+@EqualsAndHashCode
+@ToString
+public class KeyBoardLine {
+
+ @Description("Кнопки в строке")
+ @Singular(value = "buttonKeyBoard")
+ private List keyBoardButtons = new ArrayList<>();
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/button/KeyBoardButtonAccount.java b/src/main/java/org/sadtech/social/core/domain/keyboard/button/KeyBoardButtonAccount.java
new file mode 100644
index 0000000..bb784e2
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/button/KeyBoardButtonAccount.java
@@ -0,0 +1,37 @@
+package org.sadtech.social.core.domain.keyboard.button;
+
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import org.sadtech.social.core.domain.keyboard.ButtonType;
+import org.sadtech.social.core.domain.keyboard.KeyBoardButton;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Кнопка клавиатуры для оплаты счета.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Getter
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class KeyBoardButtonAccount extends KeyBoardButton {
+
+ @Description("Сумма к оплате")
+ private Integer amount;
+
+ @Description("Идентификатор счета")
+ private Integer accountId;
+
+ @Description("Описание")
+ private String description;
+
+ @Builder
+ private KeyBoardButtonAccount(String payload, Integer amount, Integer accountId, String description) {
+ super(payload, ButtonType.ACCOUNT);
+ this.amount = amount;
+ this.accountId = accountId;
+ this.description = description;
+ }
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/keyboard/button/KeyBoardButtonText.java b/src/main/java/org/sadtech/social/core/domain/keyboard/button/KeyBoardButtonText.java
new file mode 100644
index 0000000..21b6bad
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/keyboard/button/KeyBoardButtonText.java
@@ -0,0 +1,29 @@
+package org.sadtech.social.core.domain.keyboard.button;
+
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import org.sadtech.social.core.domain.keyboard.ButtonColor;
+import org.sadtech.social.core.domain.keyboard.ButtonType;
+import org.sadtech.social.core.domain.keyboard.KeyBoardButton;
+import org.sadtech.social.core.utils.Description;
+
+@Getter
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class KeyBoardButtonText extends KeyBoardButton {
+
+ @Description("Надпись на кнопке")
+ private String label;
+
+ @Description("Цвет кнопки")
+ private ButtonColor color;
+
+ @Builder
+ private KeyBoardButtonText(String payload, String label, ButtonColor color) {
+ super(payload, ButtonType.TEXT);
+ this.label = label;
+ this.color = (color != null) ? color : ButtonColor.DEFAULT;
+ }
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/money/Account.java b/src/main/java/org/sadtech/social/core/domain/money/Account.java
new file mode 100644
index 0000000..55847c4
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/money/Account.java
@@ -0,0 +1,44 @@
+package org.sadtech.social.core.domain.money;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import org.sadtech.social.core.utils.Description;
+
+/**
+ * Сущность, которая отвечает за выставленный пользователю счет.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Builder
+@Getter
+@Setter
+@EqualsAndHashCode
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class Account {
+
+ @Description("Идентификатор счета")
+ private Integer id;
+
+ @Description("Сумма к оплате")
+ private Integer totalSum;
+
+ @Description("Идентификатор пользователя, которому выставлен счет")
+ private Integer belongsPersonId;
+
+ @Description("Идентификатор пользователя, который оплатил счет")
+ private Integer extinguishedPersonId;
+
+ @Description("Описание платежа")
+ private String description;
+
+ @Description("Статус оплаты счета")
+ private AccountStatus accountStatus;
+
+}
diff --git a/src/main/java/org/sadtech/social/core/domain/money/AccountStatus.java b/src/main/java/org/sadtech/social/core/domain/money/AccountStatus.java
new file mode 100644
index 0000000..90ba094
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/domain/money/AccountStatus.java
@@ -0,0 +1,15 @@
+package org.sadtech.social.core.domain.money;
+
+/**
+ * Состояние счета.
+ *
+ * @author upagge [08/07/2019]
+ */
+public enum AccountStatus {
+
+ EXPOSED,
+ CLOSED,
+ CANCELLED,
+ EXCEPTION
+
+}
diff --git a/src/main/java/org/sadtech/bot/core/exception/AccessException.java b/src/main/java/org/sadtech/social/core/exception/AccessException.java
similarity index 52%
rename from src/main/java/org/sadtech/bot/core/exception/AccessException.java
rename to src/main/java/org/sadtech/social/core/exception/AccessException.java
index 5c722ad..7bd1fec 100644
--- a/src/main/java/org/sadtech/bot/core/exception/AccessException.java
+++ b/src/main/java/org/sadtech/social/core/exception/AccessException.java
@@ -1,5 +1,10 @@
-package org.sadtech.bot.core.exception;
+package org.sadtech.social.core.exception;
+/**
+ * Ошибка доступа к чему-либо.
+ *
+ * @author upagge [08/07/2019]
+ */
public class AccessException extends AppBotException {
public AccessException(Integer code, String message) {
super(code, message);
diff --git a/src/main/java/org/sadtech/bot/core/exception/AppBotException.java b/src/main/java/org/sadtech/social/core/exception/AppBotException.java
similarity index 81%
rename from src/main/java/org/sadtech/bot/core/exception/AppBotException.java
rename to src/main/java/org/sadtech/social/core/exception/AppBotException.java
index 51e39f1..32ad753 100644
--- a/src/main/java/org/sadtech/bot/core/exception/AppBotException.java
+++ b/src/main/java/org/sadtech/social/core/exception/AppBotException.java
@@ -1,7 +1,12 @@
-package org.sadtech.bot.core.exception;
+package org.sadtech.social.core.exception;
import java.time.LocalDateTime;
+/**
+ * Родитель всех исключений библиотеки.
+ *
+ * @author upagge [08/07/2019]
+ */
public class AppBotException extends RuntimeException {
private static final String TYPE = "ERROR";
diff --git a/src/main/java/org/sadtech/social/core/exception/ConfigAppException.java b/src/main/java/org/sadtech/social/core/exception/ConfigAppException.java
new file mode 100644
index 0000000..509709e
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/exception/ConfigAppException.java
@@ -0,0 +1,12 @@
+package org.sadtech.social.core.exception;
+
+/**
+ * Исключения настройки бота.
+ *
+ * @author upagge [11/07/2019]
+ */
+public class ConfigAppException extends AppBotException {
+ public ConfigAppException(Integer code, String message) {
+ super(code, message);
+ }
+}
diff --git a/src/main/java/org/sadtech/bot/core/exception/MailSendException.java b/src/main/java/org/sadtech/social/core/exception/MailSendException.java
similarity index 54%
rename from src/main/java/org/sadtech/bot/core/exception/MailSendException.java
rename to src/main/java/org/sadtech/social/core/exception/MailSendException.java
index 52db661..e6a2220 100644
--- a/src/main/java/org/sadtech/bot/core/exception/MailSendException.java
+++ b/src/main/java/org/sadtech/social/core/exception/MailSendException.java
@@ -1,5 +1,10 @@
-package org.sadtech.bot.core.exception;
+package org.sadtech.social.core.exception;
+/**
+ * Ошибки при отправке сообщений.
+ *
+ * @author upagge [08/07/2019]
+ */
public class MailSendException extends AppBotException {
public MailSendException() {
diff --git a/src/main/java/org/sadtech/bot/core/exception/NotFoundException.java b/src/main/java/org/sadtech/social/core/exception/NotFoundException.java
similarity index 51%
rename from src/main/java/org/sadtech/bot/core/exception/NotFoundException.java
rename to src/main/java/org/sadtech/social/core/exception/NotFoundException.java
index d3c6351..b7b75a9 100644
--- a/src/main/java/org/sadtech/bot/core/exception/NotFoundException.java
+++ b/src/main/java/org/sadtech/social/core/exception/NotFoundException.java
@@ -1,5 +1,10 @@
-package org.sadtech.bot.core.exception;
+package org.sadtech.social.core.exception;
+/**
+ * Ошибка, когда что-то не найдено.
+ *
+ * @author upagge [08/07/2019]
+ */
public class NotFoundException extends AppBotException {
public NotFoundException(Integer code, String message) {
super(code, message);
diff --git a/src/main/java/org/sadtech/bot/core/exception/PaymentException.java b/src/main/java/org/sadtech/social/core/exception/PaymentException.java
similarity index 57%
rename from src/main/java/org/sadtech/bot/core/exception/PaymentException.java
rename to src/main/java/org/sadtech/social/core/exception/PaymentException.java
index 376a7f2..0bac9bd 100644
--- a/src/main/java/org/sadtech/bot/core/exception/PaymentException.java
+++ b/src/main/java/org/sadtech/social/core/exception/PaymentException.java
@@ -1,5 +1,10 @@
-package org.sadtech.bot.core.exception;
+package org.sadtech.social.core.exception;
+/**
+ * Ошибка оплаты.
+ *
+ * @author upagge [08/07/2019]
+ */
public class PaymentException extends AppBotException {
public PaymentException(Integer code, String message) {
diff --git a/src/main/java/org/sadtech/social/core/exception/TimerSettingException.java b/src/main/java/org/sadtech/social/core/exception/TimerSettingException.java
new file mode 100644
index 0000000..bb43587
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/exception/TimerSettingException.java
@@ -0,0 +1,14 @@
+package org.sadtech.social.core.exception;
+
+/**
+ * Ошибка таймера.
+ *
+ * @author upagge [08/07/2019]
+ */
+public class TimerSettingException extends AppBotException {
+
+ public TimerSettingException(String message) {
+ super(54, message);
+ }
+
+}
diff --git a/src/main/java/org/sadtech/social/core/repository/AccountRepository.java b/src/main/java/org/sadtech/social/core/repository/AccountRepository.java
new file mode 100644
index 0000000..68386ec
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/repository/AccountRepository.java
@@ -0,0 +1,18 @@
+package org.sadtech.social.core.repository;
+
+import org.sadtech.social.core.domain.money.Account;
+
+/**
+ * Репозиторий для взаимодействия с хранилищем счетов {@link Account}.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface AccountRepository {
+
+ Integer add(Account account);
+
+ void edit(Integer accountId, Account account);
+
+ Account findById(Integer accountId);
+
+}
diff --git a/src/main/java/org/sadtech/social/core/repository/ContentRepository.java b/src/main/java/org/sadtech/social/core/repository/ContentRepository.java
new file mode 100644
index 0000000..862fbb5
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/repository/ContentRepository.java
@@ -0,0 +1,32 @@
+package org.sadtech.social.core.repository;
+
+import org.sadtech.social.core.domain.content.Message;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * Интерфейс взаимодействия со всеми наследниками текстовых запросов пользователей.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface ContentRepository {
+
+ /**
+ * Добавить сообщение в хранилище
+ *
+ * @param content Объект сообщени
+ * @return Идентификатор сообщения в хранилище
+ */
+ Integer add(T content);
+
+ /**
+ * Получить все сообщения за определенный временной диапазон
+ *
+ * @param timeFrom Начало временного диапазона
+ * @param timeTo Конец диапазона
+ * @return Список сообщений
+ */
+ List findByTime(LocalDateTime timeFrom, LocalDateTime timeTo);
+
+}
diff --git a/src/main/java/org/sadtech/social/core/repository/EventRepository.java b/src/main/java/org/sadtech/social/core/repository/EventRepository.java
new file mode 100644
index 0000000..1661718
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/repository/EventRepository.java
@@ -0,0 +1,18 @@
+package org.sadtech.social.core.repository;
+
+import java.util.Queue;
+
+/**
+ * Обработка событий социальной сети.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface EventRepository {
+
+ void add(T dataObject);
+
+ void cleanAll();
+
+ Queue getEventQueue();
+
+}
diff --git a/src/main/java/org/sadtech/bot/core/repository/impl/AccountRepositoryMap.java b/src/main/java/org/sadtech/social/core/repository/impl/AccountRepositoryMap.java
similarity index 77%
rename from src/main/java/org/sadtech/bot/core/repository/impl/AccountRepositoryMap.java
rename to src/main/java/org/sadtech/social/core/repository/impl/AccountRepositoryMap.java
index abc2fae..8b2624a 100644
--- a/src/main/java/org/sadtech/bot/core/repository/impl/AccountRepositoryMap.java
+++ b/src/main/java/org/sadtech/social/core/repository/impl/AccountRepositoryMap.java
@@ -1,10 +1,10 @@
-package org.sadtech.bot.core.repository.impl;
+package org.sadtech.social.core.repository.impl;
-import org.sadtech.bot.core.domain.money.Account;
-import org.sadtech.bot.core.exception.AccessException;
-import org.sadtech.bot.core.exception.NotFoundException;
-import org.sadtech.bot.core.exception.PaymentException;
-import org.sadtech.bot.core.repository.AccountRepository;
+import org.sadtech.social.core.domain.money.Account;
+import org.sadtech.social.core.exception.AccessException;
+import org.sadtech.social.core.exception.NotFoundException;
+import org.sadtech.social.core.exception.PaymentException;
+import org.sadtech.social.core.repository.AccountRepository;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/main/java/org/sadtech/bot/core/repository/impl/BoardCommentRepositoryMap.java b/src/main/java/org/sadtech/social/core/repository/impl/BoardCommentRepositoryMap.java
similarity index 86%
rename from src/main/java/org/sadtech/bot/core/repository/impl/BoardCommentRepositoryMap.java
rename to src/main/java/org/sadtech/social/core/repository/impl/BoardCommentRepositoryMap.java
index f3e443c..9935340 100644
--- a/src/main/java/org/sadtech/bot/core/repository/impl/BoardCommentRepositoryMap.java
+++ b/src/main/java/org/sadtech/social/core/repository/impl/BoardCommentRepositoryMap.java
@@ -1,7 +1,7 @@
-package org.sadtech.bot.core.repository.impl;
+package org.sadtech.social.core.repository.impl;
-import org.sadtech.bot.core.domain.content.BoardComment;
-import org.sadtech.bot.core.repository.ContentRepository;
+import org.sadtech.social.core.domain.content.BoardComment;
+import org.sadtech.social.core.repository.ContentRepository;
import java.time.LocalDateTime;
import java.util.ArrayList;
diff --git a/src/main/java/org/sadtech/bot/core/repository/impl/EventRepositoryQueue.java b/src/main/java/org/sadtech/social/core/repository/impl/EventRepositoryQueue.java
similarity index 83%
rename from src/main/java/org/sadtech/bot/core/repository/impl/EventRepositoryQueue.java
rename to src/main/java/org/sadtech/social/core/repository/impl/EventRepositoryQueue.java
index ed9ad45..4c3fc26 100644
--- a/src/main/java/org/sadtech/bot/core/repository/impl/EventRepositoryQueue.java
+++ b/src/main/java/org/sadtech/social/core/repository/impl/EventRepositoryQueue.java
@@ -1,7 +1,7 @@
-package org.sadtech.bot.core.repository.impl;
+package org.sadtech.social.core.repository.impl;
import com.google.gson.JsonObject;
-import org.sadtech.bot.core.repository.EventRepository;
+import org.sadtech.social.core.repository.EventRepository;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
diff --git a/src/main/java/org/sadtech/bot/core/repository/impl/MailRepositoryList.java b/src/main/java/org/sadtech/social/core/repository/impl/MailRepositoryList.java
similarity index 84%
rename from src/main/java/org/sadtech/bot/core/repository/impl/MailRepositoryList.java
rename to src/main/java/org/sadtech/social/core/repository/impl/MailRepositoryList.java
index 480aa83..41cec39 100644
--- a/src/main/java/org/sadtech/bot/core/repository/impl/MailRepositoryList.java
+++ b/src/main/java/org/sadtech/social/core/repository/impl/MailRepositoryList.java
@@ -1,7 +1,7 @@
-package org.sadtech.bot.core.repository.impl;
+package org.sadtech.social.core.repository.impl;
-import org.sadtech.bot.core.domain.content.Mail;
-import org.sadtech.bot.core.repository.ContentRepository;
+import org.sadtech.social.core.domain.content.Mail;
+import org.sadtech.social.core.repository.ContentRepository;
import java.time.LocalDateTime;
import java.util.ArrayList;
diff --git a/src/main/java/org/sadtech/social/core/service/AccountService.java b/src/main/java/org/sadtech/social/core/service/AccountService.java
new file mode 100644
index 0000000..f6594de
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/service/AccountService.java
@@ -0,0 +1,32 @@
+package org.sadtech.social.core.service;
+
+import org.sadtech.social.core.domain.money.Account;
+
+/**
+ * Интерфейс сервиса по работе с оплатой.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface AccountService {
+
+ Integer add(Account account);
+
+ /**
+ * Метод для оплаты счета
+ *
+ * @param accountId Идентификатор счета
+ * @param extinguishedPersonId Идентификатор пользователя, который внес оплату
+ * @param sum Сумма оплаты
+ * @return true - в случае успешной оплаты
+ */
+ Boolean pay(Integer accountId, Integer extinguishedPersonId, Integer sum);
+
+ /**
+ * Проверка оплаты счета
+ *
+ * @param accountId Идентификатор счета
+ * @return true - если счет оплачен
+ */
+ Boolean paymentVerification(Integer accountId);
+
+}
diff --git a/src/main/java/org/sadtech/social/core/service/BoardCommentService.java b/src/main/java/org/sadtech/social/core/service/BoardCommentService.java
new file mode 100644
index 0000000..ad0800f
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/service/BoardCommentService.java
@@ -0,0 +1,6 @@
+package org.sadtech.social.core.service;
+
+import org.sadtech.social.core.domain.content.BoardComment;
+
+public interface BoardCommentService extends MessageService {
+}
diff --git a/src/main/java/org/sadtech/social/core/service/Filter.java b/src/main/java/org/sadtech/social/core/service/Filter.java
new file mode 100644
index 0000000..427215f
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/service/Filter.java
@@ -0,0 +1,16 @@
+package org.sadtech.social.core.service;
+
+import org.sadtech.social.core.domain.content.Message;
+
+/**
+ * Интерфес для изменения запроса пользователя перед тем, как он попадет в подсистему обработки.
+ * Например можно исправить опечатки, перевести сообщение на другой язык и так далее.
+ *
+ * @author upagge [08/07/2019]
+ */
+@FunctionalInterface
+public interface Filter {
+
+ void processing(T content);
+
+}
diff --git a/src/main/java/org/sadtech/social/core/service/MailService.java b/src/main/java/org/sadtech/social/core/service/MailService.java
new file mode 100644
index 0000000..003b120
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/service/MailService.java
@@ -0,0 +1,12 @@
+package org.sadtech.social.core.service;
+
+import org.sadtech.social.core.domain.content.Mail;
+
+/**
+ * Интерфейс для взаимодействия с личными сообщениями.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface MailService extends MessageService {
+
+}
diff --git a/src/main/java/org/sadtech/social/core/service/MessageService.java b/src/main/java/org/sadtech/social/core/service/MessageService.java
new file mode 100644
index 0000000..36e8c85
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/service/MessageService.java
@@ -0,0 +1,33 @@
+package org.sadtech.social.core.service;
+
+import org.sadtech.social.core.domain.content.Message;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * Интерфейс взаимодйствия с наследниками текстовых запросов пользователей.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface MessageService {
+
+ void add(T event);
+
+ /**
+ * Получить список сообщений за заданный временной интервал
+ * @param timeFrom Начало интервала
+ * @param timeTo Конец интервала
+ * @return Список сообщений
+ */
+ List getByTime(LocalDateTime timeFrom, LocalDateTime timeTo);
+
+ /**
+ * Получить список ПОСЛЕДНИХ сообщений для каждого пользователя за заданных временной интервал
+ * @param timeFrom Начало интервала
+ * @param timeTo Конец интервала
+ * @return Список сообщений
+ */
+ List getLastEventByTime(LocalDateTime timeFrom, LocalDateTime timeTo);
+
+}
diff --git a/src/main/java/org/sadtech/bot/core/service/RawEventService.java b/src/main/java/org/sadtech/social/core/service/RawEventService.java
similarity index 50%
rename from src/main/java/org/sadtech/bot/core/service/RawEventService.java
rename to src/main/java/org/sadtech/social/core/service/RawEventService.java
index 168d2f9..ce7da07 100644
--- a/src/main/java/org/sadtech/bot/core/service/RawEventService.java
+++ b/src/main/java/org/sadtech/social/core/service/RawEventService.java
@@ -1,9 +1,14 @@
-package org.sadtech.bot.core.service;
+package org.sadtech.social.core.service;
import com.google.gson.JsonObject;
import java.util.Queue;
+/**
+ * Интерфейс для взаимодействия с событиями социальной сети.
+ *
+ * @author upagge [08/07/2019]
+ */
public interface RawEventService {
void cleanAll();
diff --git a/src/main/java/org/sadtech/bot/core/service/impl/AccountServiceImpl.java b/src/main/java/org/sadtech/social/core/service/impl/AccountServiceImpl.java
similarity index 82%
rename from src/main/java/org/sadtech/bot/core/service/impl/AccountServiceImpl.java
rename to src/main/java/org/sadtech/social/core/service/impl/AccountServiceImpl.java
index bc9a39a..5617608 100644
--- a/src/main/java/org/sadtech/bot/core/service/impl/AccountServiceImpl.java
+++ b/src/main/java/org/sadtech/social/core/service/impl/AccountServiceImpl.java
@@ -1,10 +1,10 @@
-package org.sadtech.bot.core.service.impl;
+package org.sadtech.social.core.service.impl;
-import org.sadtech.bot.core.domain.money.Account;
-import org.sadtech.bot.core.domain.money.AccountStatus;
-import org.sadtech.bot.core.exception.PaymentException;
-import org.sadtech.bot.core.repository.AccountRepository;
-import org.sadtech.bot.core.service.AccountService;
+import org.sadtech.social.core.domain.money.Account;
+import org.sadtech.social.core.domain.money.AccountStatus;
+import org.sadtech.social.core.exception.PaymentException;
+import org.sadtech.social.core.repository.AccountRepository;
+import org.sadtech.social.core.service.AccountService;
public class AccountServiceImpl implements AccountService {
diff --git a/src/main/java/org/sadtech/bot/core/service/impl/BoardCommentServiceImpl.java b/src/main/java/org/sadtech/social/core/service/impl/BoardCommentServiceImpl.java
similarity index 87%
rename from src/main/java/org/sadtech/bot/core/service/impl/BoardCommentServiceImpl.java
rename to src/main/java/org/sadtech/social/core/service/impl/BoardCommentServiceImpl.java
index d4b7d3d..772653f 100644
--- a/src/main/java/org/sadtech/bot/core/service/impl/BoardCommentServiceImpl.java
+++ b/src/main/java/org/sadtech/social/core/service/impl/BoardCommentServiceImpl.java
@@ -1,8 +1,8 @@
-package org.sadtech.bot.core.service.impl;
+package org.sadtech.social.core.service.impl;
-import org.sadtech.bot.core.domain.content.BoardComment;
-import org.sadtech.bot.core.repository.ContentRepository;
-import org.sadtech.bot.core.service.BoardCommentService;
+import org.sadtech.social.core.domain.content.BoardComment;
+import org.sadtech.social.core.repository.ContentRepository;
+import org.sadtech.social.core.service.BoardCommentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/sadtech/bot/core/service/impl/MailServiceImpl.java b/src/main/java/org/sadtech/social/core/service/impl/MailServiceImpl.java
similarity index 88%
rename from src/main/java/org/sadtech/bot/core/service/impl/MailServiceImpl.java
rename to src/main/java/org/sadtech/social/core/service/impl/MailServiceImpl.java
index 18554b4..0b977c7 100644
--- a/src/main/java/org/sadtech/bot/core/service/impl/MailServiceImpl.java
+++ b/src/main/java/org/sadtech/social/core/service/impl/MailServiceImpl.java
@@ -1,8 +1,8 @@
-package org.sadtech.bot.core.service.impl;
+package org.sadtech.social.core.service.impl;
-import org.sadtech.bot.core.domain.content.Mail;
-import org.sadtech.bot.core.repository.ContentRepository;
-import org.sadtech.bot.core.service.MailService;
+import org.sadtech.social.core.domain.content.Mail;
+import org.sadtech.social.core.repository.ContentRepository;
+import org.sadtech.social.core.service.MailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/sadtech/bot/core/service/impl/RawEventServiceImpl.java b/src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java
similarity index 85%
rename from src/main/java/org/sadtech/bot/core/service/impl/RawEventServiceImpl.java
rename to src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java
index 16b7ad7..f1fc726 100644
--- a/src/main/java/org/sadtech/bot/core/service/impl/RawEventServiceImpl.java
+++ b/src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java
@@ -1,8 +1,8 @@
-package org.sadtech.bot.core.service.impl;
+package org.sadtech.social.core.service.impl;
import com.google.gson.JsonObject;
-import org.sadtech.bot.core.repository.EventRepository;
-import org.sadtech.bot.core.service.RawEventService;
+import org.sadtech.social.core.repository.EventRepository;
+import org.sadtech.social.core.service.RawEventService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/sadtech/bot/core/service/sender/SendBox.java b/src/main/java/org/sadtech/social/core/service/sender/SendBox.java
similarity index 65%
rename from src/main/java/org/sadtech/bot/core/service/sender/SendBox.java
rename to src/main/java/org/sadtech/social/core/service/sender/SendBox.java
index 942de5b..e3b5945 100644
--- a/src/main/java/org/sadtech/bot/core/service/sender/SendBox.java
+++ b/src/main/java/org/sadtech/social/core/service/sender/SendBox.java
@@ -1,13 +1,13 @@
-package org.sadtech.bot.core.service.sender;
+package org.sadtech.social.core.service.sender;
-import org.sadtech.bot.core.domain.BoxAnswer;
-import org.sadtech.bot.core.domain.content.Comment;
-import org.sadtech.bot.core.domain.content.Message;
+import org.sadtech.social.core.domain.BoxAnswer;
+import org.sadtech.social.core.domain.content.Comment;
+import org.sadtech.social.core.domain.content.Message;
public class SendBox {
private SendBox() {
-
+ throw new IllegalStateException("Утилитный класс");
}
public static void sent(Message message, BoxAnswer boxAnswer, Sent sent) {
diff --git a/src/main/java/org/sadtech/social/core/service/sender/Sent.java b/src/main/java/org/sadtech/social/core/service/sender/Sent.java
new file mode 100644
index 0000000..4eee71f
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/service/sender/Sent.java
@@ -0,0 +1,22 @@
+package org.sadtech.social.core.service.sender;
+
+import org.sadtech.social.core.domain.BoxAnswer;
+
+/**
+ * Интерфейс для отправки ответов пользователю.
+ *
+ * @author upagge [08/07/2019]
+ */
+public interface Sent {
+
+ /**
+ * Отрпавляет ответ пользователю
+ *
+ * @param personId Идентификатор пользователя
+ * @param boxAnswer Объект с данными, которые необходимо отправить
+ */
+ void send(Integer personId, BoxAnswer boxAnswer);
+
+ void send(Integer contentId, Integer personId, BoxAnswer boxAnswer);
+
+}
diff --git a/src/main/java/org/sadtech/bot/core/service/sender/email/EmailConfig.java b/src/main/java/org/sadtech/social/core/service/sender/email/EmailConfig.java
similarity index 97%
rename from src/main/java/org/sadtech/bot/core/service/sender/email/EmailConfig.java
rename to src/main/java/org/sadtech/social/core/service/sender/email/EmailConfig.java
index 974fce5..d564b33 100644
--- a/src/main/java/org/sadtech/bot/core/service/sender/email/EmailConfig.java
+++ b/src/main/java/org/sadtech/social/core/service/sender/email/EmailConfig.java
@@ -1,4 +1,4 @@
-package org.sadtech.bot.core.service.sender.email;
+package org.sadtech.social.core.service.sender.email;
import java.util.Properties;
diff --git a/src/main/java/org/sadtech/bot/core/service/sender/email/EmailSent.java b/src/main/java/org/sadtech/social/core/service/sender/email/EmailSent.java
similarity index 78%
rename from src/main/java/org/sadtech/bot/core/service/sender/email/EmailSent.java
rename to src/main/java/org/sadtech/social/core/service/sender/email/EmailSent.java
index eaf026d..72598cf 100644
--- a/src/main/java/org/sadtech/bot/core/service/sender/email/EmailSent.java
+++ b/src/main/java/org/sadtech/social/core/service/sender/email/EmailSent.java
@@ -1,12 +1,17 @@
-package org.sadtech.bot.core.service.sender.email;
+package org.sadtech.social.core.service.sender.email;
-import org.sadtech.bot.core.domain.BoxAnswer;
-import org.sadtech.bot.core.exception.MailSendException;
-import org.sadtech.bot.core.service.sender.Sent;
+import org.sadtech.social.core.domain.BoxAnswer;
+import org.sadtech.social.core.exception.MailSendException;
+import org.sadtech.social.core.service.sender.Sent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.mail.*;
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
diff --git a/src/main/java/org/sadtech/social/core/utils/Description.java b/src/main/java/org/sadtech/social/core/utils/Description.java
new file mode 100644
index 0000000..7a2a706
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/utils/Description.java
@@ -0,0 +1,21 @@
+package org.sadtech.social.core.utils;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Используется для описания полей в классах.
+ *
+ * @author upagge [08/07/2019]
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Description {
+
+ String value();
+
+ String example() default "";
+
+}
diff --git a/src/main/java/org/sadtech/bot/core/utils/InsertWords.java b/src/main/java/org/sadtech/social/core/utils/InsertWords.java
similarity index 50%
rename from src/main/java/org/sadtech/bot/core/utils/InsertWords.java
rename to src/main/java/org/sadtech/social/core/utils/InsertWords.java
index 0dab215..29744e0 100644
--- a/src/main/java/org/sadtech/bot/core/utils/InsertWords.java
+++ b/src/main/java/org/sadtech/social/core/utils/InsertWords.java
@@ -1,15 +1,27 @@
-package org.sadtech.bot.core.utils;
+package org.sadtech.social.core.utils;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+/**
+ * Класс для вставки слов в текстовую строку вместо подстрок - шаблонов маркеров.
+ *
+ * @author upagge [08/07/2019]
+ */
public class InsertWords {
private InsertWords() {
- throw new IllegalStateException();
+ throw new IllegalStateException("Утилитный класс");
}
+ /**
+ * Заменяет шаблон {n} в строке на слово из списка, где n - это порядковое число.
+ *
+ * @param text Текстовая строка
+ * @param words Список слов, которые необходимо поместить вместо шаблона
+ * @return Модифицированная строка
+ */
public static String insert(String text, List words) {
Pattern pattern = Pattern.compile("\\{(\\d+)}");
Matcher m = pattern.matcher(text);
diff --git a/src/main/java/org/sadtech/bot/core/utils/KeyBoards.java b/src/main/java/org/sadtech/social/core/utils/KeyBoards.java
similarity index 52%
rename from src/main/java/org/sadtech/bot/core/utils/KeyBoards.java
rename to src/main/java/org/sadtech/social/core/utils/KeyBoards.java
index d5cb42d..6156ec9 100644
--- a/src/main/java/org/sadtech/bot/core/utils/KeyBoards.java
+++ b/src/main/java/org/sadtech/social/core/utils/KeyBoards.java
@@ -1,19 +1,29 @@
-package org.sadtech.bot.core.utils;
+package org.sadtech.social.core.utils;
-import org.sadtech.bot.core.domain.keyboard.ButtonColor;
-import org.sadtech.bot.core.domain.keyboard.KeyBoard;
-import org.sadtech.bot.core.domain.keyboard.KeyBoardButton;
-import org.sadtech.bot.core.domain.keyboard.KeyBoardLine;
-import org.sadtech.bot.core.domain.keyboard.button.KeyBoardButtonText;
+import org.sadtech.social.core.domain.keyboard.ButtonColor;
+import org.sadtech.social.core.domain.keyboard.KeyBoard;
+import org.sadtech.social.core.domain.keyboard.KeyBoardButton;
+import org.sadtech.social.core.domain.keyboard.KeyBoardLine;
+import org.sadtech.social.core.domain.keyboard.button.KeyBoardButtonText;
import java.util.List;
+/**
+ * Используется для быстрого создания клавиаутр {@link KeyBoard}.
+ *
+ * @author upagge [08/07/2019]
+ */
public class KeyBoards {
private KeyBoards() {
throw new IllegalStateException();
}
+ /**
+ * Возвращает клавиатуру формата 1х2, с кнопками "Да | Нет"
+ *
+ * @return {@link KeyBoard}
+ */
public static KeyBoard keyBoardYesNo() {
KeyBoardButton yesButton = KeyBoardButtonText.builder().color(ButtonColor.POSITIVE).label("Да").payload("{\"button\": \"yes\"}").build();
KeyBoardButton noButton = KeyBoardButtonText.builder().color(ButtonColor.NEGATIVE).label("Нет").payload("{\"button\": \"no\"}").build();
@@ -21,8 +31,14 @@ public class KeyBoards {
return KeyBoard.builder().lineKeyBoard(keyBoardLine).oneTime(true).build();
}
+ /**
+ * Возвращает клавиатуру формата 1хN, где N - это количество элементов в переданном списке
+ *
+ * @param labelButtons Список названий для кнопок
+ * @return {@link KeyBoard}
+ */
public static KeyBoard verticalMenuString(List labelButtons) {
- KeyBoard.Builder keyBoard = KeyBoard.builder().oneTime(true);
+ KeyBoard.KeyBoardBuilder keyBoard = KeyBoard.builder().oneTime(true);
for (String labelButton : labelButtons) {
KeyBoardButton keyBoardButton = KeyBoardButtonText.builder().label(labelButton).payload("{\"button\": \"" + labelButton + "\"}").build();
keyBoard.lineKeyBoard(KeyBoardLine.builder().buttonKeyBoard(keyBoardButton).build());
@@ -30,8 +46,14 @@ public class KeyBoards {
return keyBoard.build();
}
+ /**
+ * Возвращает клавиатуру формата 1хN, где N - это количество элементов в переданном списке
+ *
+ * @param labelButton Список названий для кнопок
+ * @return {@link KeyBoard}
+ */
public static KeyBoard verticalMenuString(String... labelButton) {
- KeyBoard.Builder keyBoard = KeyBoard.builder().oneTime(true);
+ KeyBoard.KeyBoardBuilder keyBoard = KeyBoard.builder().oneTime(true);
for (String label : labelButton) {
KeyBoardButton keyBoardButton = KeyBoardButtonText.builder().label(label).payload("{\"button\": \"" + label + "\"}").build();
keyBoard.lineKeyBoard(KeyBoardLine.builder().buttonKeyBoard(keyBoardButton).build());
@@ -39,10 +61,16 @@ public class KeyBoards {
return keyBoard.build();
}
+ /**
+ * Возвращает клавиатуру формата 2х(N/2), где N - это количество элементов в переданном списке
+ *
+ * @param labelButton Список названий для кнопок
+ * @return {@link KeyBoard}
+ */
public static KeyBoard verticalDuoMenuString(String... labelButton) {
- KeyBoard.Builder keyBoard = KeyBoard.builder().oneTime(true);
+ KeyBoard.KeyBoardBuilder keyBoard = KeyBoard.builder().oneTime(true);
boolean flag = true;
- KeyBoardLine.Builder keyBoardLine = KeyBoardLine.builder();
+ KeyBoardLine.KeyBoardLineBuilder keyBoardLine = KeyBoardLine.builder();
for (String label : labelButton) {
if (flag) {
keyBoardLine.buttonKeyBoard(KeyBoardButtonText.builder().label(label).build());
@@ -57,14 +85,26 @@ public class KeyBoards {
return keyBoard.build();
}
+ /**
+ * Возвращает клавиатуру формата 1xN сформированную из списка кнопок, где N - количество кнопок в списке
+ *
+ * @param keyBoardButtons Список кнопок
+ * @return {@link KeyBoard}
+ */
public static KeyBoard verticalMenuButton(List keyBoardButtons) {
- KeyBoard.Builder keyBoard = KeyBoard.builder().oneTime(true);
+ KeyBoard.KeyBoardBuilder keyBoard = KeyBoard.builder().oneTime(true);
for (KeyBoardButton keyBoardButton : keyBoardButtons) {
keyBoard.lineKeyBoard(KeyBoardLine.builder().buttonKeyBoard(keyBoardButton).build());
}
return keyBoard.build();
}
+ /**
+ * Возвращает клавиатуру из одной кнопки
+ *
+ * @param keyBoardButton Кнопка
+ * @return {@link KeyBoard}
+ */
public static KeyBoard singelton(KeyBoardButton keyBoardButton) {
KeyBoardLine line = KeyBoardLine.builder().buttonKeyBoard(keyBoardButton).build();
return KeyBoard.builder().lineKeyBoard(line).build();
diff --git a/src/main/java/org/sadtech/social/core/utils/MessageUtils.java b/src/main/java/org/sadtech/social/core/utils/MessageUtils.java
new file mode 100644
index 0000000..ae31591
--- /dev/null
+++ b/src/main/java/org/sadtech/social/core/utils/MessageUtils.java
@@ -0,0 +1,20 @@
+package org.sadtech.social.core.utils;
+
+import org.sadtech.social.core.domain.content.EmptyMessage;
+import org.sadtech.social.core.domain.content.Message;
+
+/**
+ * Класс для хранения объекта заглушки для {@link Message}.
+ *
+ * @author upagge [08/07/2019]
+ */
+public class MessageUtils {
+
+ private MessageUtils() {
+ throw new IllegalStateException("Утилитный класс");
+ }
+
+ public static final EmptyMessage EMPTY_MESSAGE = new EmptyMessage();
+
+
+}