aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
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/api/resource
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/api/resource')
-rw-r--r--src/org/traccar/api/resource/NotificationResource.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/org/traccar/api/resource/NotificationResource.java b/src/org/traccar/api/resource/NotificationResource.java
index 540f02926..2a398f40d 100644
--- a/src/org/traccar/api/resource/NotificationResource.java
+++ b/src/org/traccar/api/resource/NotificationResource.java
@@ -17,7 +17,6 @@ package org.traccar.api.resource;
import java.util.Collection;
-import javax.mail.MessagingException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -31,13 +30,9 @@ import org.traccar.api.ExtendedObjectResource;
import org.traccar.model.Event;
import org.traccar.model.Notification;
import org.traccar.model.Typed;
-import org.traccar.notification.NotificationMail;
-import org.traccar.notification.NotificationSms;
+import org.traccar.notification.NotificationException;
+import org.traccar.notification.NotificatorManager;
-import com.cloudhopper.smpp.type.RecoverablePduException;
-import com.cloudhopper.smpp.type.SmppChannelException;
-import com.cloudhopper.smpp.type.SmppTimeoutException;
-import com.cloudhopper.smpp.type.UnrecoverablePduException;
@Path("notifications")
@Produces(MediaType.APPLICATION_JSON)
@@ -56,10 +51,9 @@ public class NotificationResource extends ExtendedObjectResource<Notification> {
@POST
@Path("test")
- public Response testMessage() throws MessagingException, RecoverablePduException,
- UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException {
- NotificationMail.sendMailSync(getUserId(), new Event("test", 0), null);
- NotificationSms.sendSmsSync(getUserId(), new Event("test", 0), null);
+ public Response testMessage() throws NotificationException, InterruptedException {
+ NotificatorManager.getMail().sendSync(getUserId(), new Event("test", 0), null);
+ NotificatorManager.getSms().sendSync(getUserId(), new Event("test", 0), null);
return Response.noContent().build();
}