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 18:09:50 -0300 |
commit | bb289a69fa4d292378c5c534e10985be65b2e392 (patch) | |
tree | 43ded3eed61aabf70d8212e663aa6c966b55a9dc /src/org/traccar/notification/NotificationSms.java | |
parent | 0117dfeef0a7ffbc7a47d9681811177136336730 (diff) | |
download | trackermap-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.java | 27 |
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); } } |