From bb289a69fa4d292378c5c534e10985be65b2e392 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Sun, 25 Mar 2018 22:16:09 -0300 Subject: generalization for notifications processing --- src/org/traccar/api/resource/NotificationResource.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/org/traccar/api') 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 { @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(); } -- cgit v1.2.3