diff --git a/pom.xml b/pom.xml index 69c1e4f..89e23b0 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,6 @@ 2.8.5 0.5.13-SNAPSHOT 1.2.17 - 20180813 @@ -51,11 +50,6 @@ log4j ${log4j.ver} - - org.json - json - ${json.ver} - junit junit diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java index 0d2dcee..debb99d 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java @@ -20,7 +20,7 @@ public class MailSubscriber implements EventSubscribe, EventDistribu private MailService mailService; private Set admins = new HashSet<>(); - private Map eventDistributionMap = new HashMap<>(); + private Map> eventDistributionMap = new HashMap<>(); public MailSubscriber(EventDistributable eventDistributable, MailService mailService) { this.mailService = mailService; diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/TerminalSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/TerminalSubscriber.java index d0ce956..2ef8efb 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/TerminalSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/TerminalSubscriber.java @@ -1,11 +1,11 @@ package org.sadtech.vkbot.core.distribution.impl; +import com.vk.api.sdk.objects.messages.Message; import org.apache.log4j.Logger; import org.sadtech.vkbot.core.distribution.EventSubscribe; -import org.sadtech.vkbot.core.entity.Mail; import org.sadtech.vkbot.core.service.handlers.MailService; -public class TerminalSubscriber implements EventSubscribe { +public class TerminalSubscriber implements EventSubscribe { public static final Logger log = Logger.getLogger(TerminalSubscriber.class); @@ -25,7 +25,7 @@ public class TerminalSubscriber implements EventSubscribe { } @Override - public void update(Mail object) { + public void update(Message object) { log.info("Сообщение отправленно на добавление в репозиторий команд"); mailService.add(object); } diff --git a/src/main/java/org/sadtech/vkbot/core/keyboard/ButtonKeyBoard.java b/src/main/java/org/sadtech/vkbot/core/keyboard/ButtonKeyBoard.java index d33d139..fa9612f 100644 --- a/src/main/java/org/sadtech/vkbot/core/keyboard/ButtonKeyBoard.java +++ b/src/main/java/org/sadtech/vkbot/core/keyboard/ButtonKeyBoard.java @@ -1,6 +1,6 @@ package org.sadtech.vkbot.core.keyboard; -import org.json.JSONObject; +import com.google.gson.JsonObject; public class ButtonKeyBoard { @@ -20,18 +20,18 @@ public class ButtonKeyBoard { this.color = color; } - public JSONObject getButton() { - JSONObject newButton = new JSONObject(); - newButton.put("color", color.toString().toLowerCase()); - newButton.put("action", generateAction()); + public JsonObject getButton() { + JsonObject newButton = new JsonObject(); + newButton.addProperty("color", color.toString().toLowerCase()); + newButton.add("action", generateAction()); return newButton; } - private JSONObject generateAction() { - JSONObject action = new JSONObject(); - action.put("type", type); - action.put("payload", payload); - action.put("label", label); + private JsonObject generateAction() { + JsonObject action = new JsonObject(); + action.addProperty("type", type); + action.addProperty("payload", payload); + action.addProperty("label", label); return action; } diff --git a/src/main/java/org/sadtech/vkbot/core/keyboard/KeyBoard.java b/src/main/java/org/sadtech/vkbot/core/keyboard/KeyBoard.java index 4037f3d..08cdf86 100644 --- a/src/main/java/org/sadtech/vkbot/core/keyboard/KeyBoard.java +++ b/src/main/java/org/sadtech/vkbot/core/keyboard/KeyBoard.java @@ -1,7 +1,7 @@ package org.sadtech.vkbot.core.keyboard; -import org.json.JSONArray; -import org.json.JSONObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.List; @@ -24,16 +24,16 @@ public class KeyBoard { this.oneTime = oneTime; } - public JSONObject getKeyboard() { - JSONObject keyboard = new JSONObject(); - keyboard.put("one_time", oneTime); + public JsonObject getKeyboard() { + JsonObject keyboard = new JsonObject(); + keyboard.addProperty("one_time", oneTime); - JSONArray menuLine = new JSONArray(); + JsonArray menuLine = new JsonArray(); for (LineKeyBoard lineKeyboard : lineKeyBoards) { - menuLine.put(lineKeyboard.getLine()); + menuLine.add(lineKeyboard.getLine()); } - keyboard.put("buttons", menuLine); + keyboard.add("buttons", menuLine); return keyboard; } diff --git a/src/main/java/org/sadtech/vkbot/core/keyboard/LineKeyBoard.java b/src/main/java/org/sadtech/vkbot/core/keyboard/LineKeyBoard.java index 0f8cdc1..6b28849 100644 --- a/src/main/java/org/sadtech/vkbot/core/keyboard/LineKeyBoard.java +++ b/src/main/java/org/sadtech/vkbot/core/keyboard/LineKeyBoard.java @@ -1,6 +1,6 @@ package org.sadtech.vkbot.core.keyboard; -import org.json.JSONArray; +import com.google.gson.JsonArray; import java.util.ArrayList; import java.util.List; @@ -17,10 +17,10 @@ public class LineKeyBoard { this.buttonKeyBoards = buttonKeyBoards; } - public JSONArray getLine() { - JSONArray line = new JSONArray(); + public JsonArray getLine() { + JsonArray line = new JsonArray(); for (ButtonKeyBoard buttonKeyBoard : buttonKeyBoards) { - line.put(buttonKeyBoard.getButton()); + line.add(buttonKeyBoard.getButton()); } return line; }