diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-09 18:03:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-09 18:03:52 -0700 |
commit | 336d6c4353fd77ad268aaf5cfe9c0296edfb0201 (patch) | |
tree | 1c89b1a3de09c051e305386cf3ba8dbef458cb5a /src/main/java/org/traccar/api/resource | |
parent | adafc5f6130854dd88c191dd04489073419ee41d (diff) | |
download | trackermap-server-336d6c4353fd77ad268aaf5cfe9c0296edfb0201.tar.gz trackermap-server-336d6c4353fd77ad268aaf5cfe9c0296edfb0201.tar.bz2 trackermap-server-336d6c4353fd77ad268aaf5cfe9c0296edfb0201.zip |
Remove more from context
Diffstat (limited to 'src/main/java/org/traccar/api/resource')
-rw-r--r-- | src/main/java/org/traccar/api/resource/NotificationResource.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/api/resource/NotificationResource.java b/src/main/java/org/traccar/api/resource/NotificationResource.java index 9ea811473..0a95b257a 100644 --- a/src/main/java/org/traccar/api/resource/NotificationResource.java +++ b/src/main/java/org/traccar/api/resource/NotificationResource.java @@ -17,6 +17,7 @@ package org.traccar.api.resource; import java.util.Collection; +import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -33,6 +34,7 @@ import org.traccar.model.Notification; import org.traccar.model.Typed; import org.traccar.model.User; import org.traccar.notification.MessageException; +import org.traccar.notification.NotificatorManager; import org.traccar.storage.StorageException; @Path("notifications") @@ -40,6 +42,9 @@ import org.traccar.storage.StorageException; @Consumes(MediaType.APPLICATION_JSON) public class NotificationResource extends ExtendedObjectResource<Notification> { + @Inject + private NotificatorManager notificatorManager; + public NotificationResource() { super(Notification.class); } @@ -53,16 +58,15 @@ public class NotificationResource extends ExtendedObjectResource<Notification> { @GET @Path("notificators") public Collection<Typed> getNotificators() { - return Context.getNotificatorManager().getAllNotificatorTypes(); + return notificatorManager.getAllNotificatorTypes(); } @POST @Path("test") public Response testMessage() throws MessageException, InterruptedException, StorageException { User user = permissionsService.getUser(getUserId()); - for (Typed method : Context.getNotificatorManager().getAllNotificatorTypes()) { - Context.getNotificatorManager() - .getNotificator(method.getType()).send(user, new Event("test", 0), null); + for (Typed method : notificatorManager.getAllNotificatorTypes()) { + notificatorManager.getNotificator(method.getType()).send(user, new Event("test", 0), null); } return Response.noContent().build(); } @@ -72,7 +76,7 @@ public class NotificationResource extends ExtendedObjectResource<Notification> { public Response testMessage(@PathParam("notificator") String notificator) throws MessageException, InterruptedException, StorageException { User user = permissionsService.getUser(getUserId()); - Context.getNotificatorManager().getNotificator(notificator).send(user, new Event("test", 0), null); + notificatorManager.getNotificator(notificator).send(user, new Event("test", 0), null); return Response.noContent().build(); } |