aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-14 18:50:48 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-14 18:50:48 -0700
commit0d5c7606c73d84aab44f69936ab62afa0b68939b (patch)
tree4e9cbebe1ddcd3e3b75a15bee8e23d05374ca434 /src/main/java/org/traccar/handler
parent415ba3ddb0f770b829c997beb3e575ffb6e195ec (diff)
downloadtrackermap-server-0d5c7606c73d84aab44f69936ab62afa0b68939b.tar.gz
trackermap-server-0d5c7606c73d84aab44f69936ab62afa0b68939b.tar.bz2
trackermap-server-0d5c7606c73d84aab44f69936ab62afa0b68939b.zip
Refactor notification manager
Diffstat (limited to 'src/main/java/org/traccar/handler')
-rw-r--r--src/main/java/org/traccar/handler/events/BaseEventHandler.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/handler/events/BaseEventHandler.java b/src/main/java/org/traccar/handler/events/BaseEventHandler.java
index 41f677f6c..f7199f6dc 100644
--- a/src/main/java/org/traccar/handler/events/BaseEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/BaseEventHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,17 +18,26 @@ package org.traccar.handler.events;
import java.util.Map;
import org.traccar.BaseDataHandler;
-import org.traccar.Context;
+import org.traccar.database.NotificationManager;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import javax.inject.Inject;
+
public abstract class BaseEventHandler extends BaseDataHandler {
+ private NotificationManager notificationManager;
+
+ @Inject
+ public void setNotificationManager(NotificationManager notificationManager) {
+ this.notificationManager = notificationManager;
+ }
+
@Override
protected Position handlePosition(Position position) {
Map<Event, Position> events = analyzePosition(position);
- if (events != null && Context.getNotificationManager() != null) {
- Context.getNotificationManager().updateEvents(events);
+ if (events != null) {
+ notificationManager.updateEvents(events);
}
return position;
}