diff options
author | Ivan Martinez <ivanfmartinez@users.noreply.github.com> | 2018-03-25 22:16:09 -0300 |
---|---|---|
committer | Ivan Martinez <ivanfmartinez@users.noreply.github.com> | 2018-04-01 09:55:46 -0300 |
commit | 5a62fe3d56e12f8cc84e7a64d72a4d2e8e09572f (patch) | |
tree | e99c99e910442ca15ae4c2d89f4f28ff36418bbb /src/org/traccar/database | |
parent | 0117dfeef0a7ffbc7a47d9681811177136336730 (diff) | |
download | trackermap-server-5a62fe3d56e12f8cc84e7a64d72a4d2e8e09572f.tar.gz trackermap-server-5a62fe3d56e12f8cc84e7a64d72a4d2e8e09572f.tar.bz2 trackermap-server-5a62fe3d56e12f8cc84e7a64d72a4d2e8e09572f.zip |
generalization for notifications processing
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r-- | src/org/traccar/database/CommandsManager.java | 6 | ||||
-rw-r--r-- | src/org/traccar/database/NotificationManager.java | 11 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/org/traccar/database/CommandsManager.java b/src/org/traccar/database/CommandsManager.java index 9ceb995ef..2e68fae5a 100644 --- a/src/org/traccar/database/CommandsManager.java +++ b/src/org/traccar/database/CommandsManager.java @@ -58,10 +58,10 @@ public class CommandsManager extends ExtendedObjectManager<Command> { BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol()); protocol.sendTextCommand(phone, command); } else if (command.getType().equals(Command.TYPE_CUSTOM)) { - if (Context.getSmppManager() != null) { - Context.getSmppManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); + if (Context.getSmsManager() != null) { + Context.getSmsManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); } else { - throw new RuntimeException("SMPP client is not enabled"); + throw new RuntimeException("SMS is not enabled"); } } else { throw new RuntimeException("Command " + command.getType() + " is not supported"); diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java index 1c59a8666..1295b5b0c 100644 --- a/src/org/traccar/database/NotificationManager.java +++ b/src/org/traccar/database/NotificationManager.java @@ -32,8 +32,7 @@ import org.traccar.model.Event; import org.traccar.model.Notification; import org.traccar.model.Position; import org.traccar.model.Typed; -import org.traccar.notification.NotificationMail; -import org.traccar.notification.NotificationSms; +import org.traccar.notification.NotificatorManager; public class NotificationManager extends ExtendedObjectManager<Notification> { @@ -85,20 +84,20 @@ public class NotificationManager extends ExtendedObjectManager<Notification> { } boolean sentWeb = false; boolean sentMail = false; - boolean sentSms = Context.getSmppManager() == null; + boolean sentSms = Context.getSmsManager() == null; for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getServerTime())) { Notification notification = getById(notificationId); if (getById(notificationId).getType().equals(event.getType())) { if (!sentWeb && notification.getWeb()) { - Context.getConnectionManager().updateEvent(userId, event); + NotificatorManager.getWeb().sendAsync(userId, event, position); sentWeb = true; } if (!sentMail && notification.getMail()) { - NotificationMail.sendMailAsync(userId, event, position); + NotificatorManager.getMail().sendAsync(userId, event, position); sentMail = true; } if (!sentSms && notification.getSms()) { - NotificationSms.sendSmsAsync(userId, event, position); + NotificatorManager.getSms().sendAsync(userId, event, position); sentSms = true; } } |