aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification/NotificationSms.java
diff options
context:
space:
mode:
authorIvan Martinez <ivanfmartinez@users.noreply.github.com>2018-03-25 22:16:09 -0300
committerIvan Martinez <ivanfmartinez@users.noreply.github.com>2018-04-01 18:09:50 -0300
commitbb289a69fa4d292378c5c534e10985be65b2e392 (patch)
tree43ded3eed61aabf70d8212e663aa6c966b55a9dc /src/org/traccar/notification/NotificationSms.java
parent0117dfeef0a7ffbc7a47d9681811177136336730 (diff)
downloadtrackermap-server-bb289a69fa4d292378c5c534e10985be65b2e392.tar.gz
trackermap-server-bb289a69fa4d292378c5c534e10985be65b2e392.tar.bz2
trackermap-server-bb289a69fa4d292378c5c534e10985be65b2e392.zip
generalization for notifications processing
Diffstat (limited to 'src/org/traccar/notification/NotificationSms.java')
-rw-r--r--src/org/traccar/notification/NotificationSms.java27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/org/traccar/notification/NotificationSms.java b/src/org/traccar/notification/NotificationSms.java
index 8c0265af4..34d68e174 100644
--- a/src/org/traccar/notification/NotificationSms.java
+++ b/src/org/traccar/notification/NotificationSms.java
@@ -20,32 +20,27 @@ import org.traccar.Context;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.model.User;
+import org.traccar.sms.SMSException;
-import com.cloudhopper.smpp.type.RecoverablePduException;
-import com.cloudhopper.smpp.type.SmppChannelException;
-import com.cloudhopper.smpp.type.SmppTimeoutException;
-import com.cloudhopper.smpp.type.UnrecoverablePduException;
+public final class NotificationSms extends Notificator {
-public final class NotificationSms {
-
- private NotificationSms() {
- }
-
- public static void sendSmsAsync(long userId, Event event, Position position) {
+ @Override
+ public void sendAsync(long userId, Event event, Position position) {
User user = Context.getPermissionsManager().getUser(userId);
- if (Context.getSmppManager() != null && user.getPhone() != null) {
+ if (Context.getSmsManager() != null && user.getPhone() != null) {
Context.getStatisticsManager().registerSms();
- Context.getSmppManager().sendMessageAsync(user.getPhone(),
+ Context.getSmsManager().sendMessageAsync(user.getPhone(),
NotificationFormatter.formatSmsMessage(userId, event, position), false);
}
}
- public static void sendSmsSync(long userId, Event event, Position position) throws RecoverablePduException,
- UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException {
+ @Override
+ public void sendSync(long userId, Event event, Position position) throws SMSException,
+ InterruptedException {
User user = Context.getPermissionsManager().getUser(userId);
- if (Context.getSmppManager() != null && user.getPhone() != null) {
+ if (Context.getSmsManager() != null && user.getPhone() != null) {
Context.getStatisticsManager().registerSms();
- Context.getSmppManager().sendMessageSync(user.getPhone(),
+ Context.getSmsManager().sendMessageSync(user.getPhone(),
NotificationFormatter.formatSmsMessage(userId, event, position), false);
}
}