aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-04 14:52:42 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-04 14:52:42 +1300
commit6dbe4dfd44c7acda448fbda279b0f0a088c76489 (patch)
tree571e8c4153aa2fdaeedebaf307475131318f5d96
parentd8d5f0277a342e7254c465d209725dd362554e58 (diff)
downloadtrackermap-server-6dbe4dfd44c7acda448fbda279b0f0a088c76489.tar.gz
trackermap-server-6dbe4dfd44c7acda448fbda279b0f0a088c76489.tar.bz2
trackermap-server-6dbe4dfd44c7acda448fbda279b0f0a088c76489.zip
Alarm types filtering option
-rw-r--r--src/org/traccar/database/NotificationManager.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java
index 60f7f4e4f..09df4c571 100644
--- a/src/org/traccar/database/NotificationManager.java
+++ b/src/org/traccar/database/NotificationManager.java
@@ -90,7 +90,16 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getServerTime())) {
Notification notification = getById(notificationId);
if (getById(notificationId).getType().equals(event.getType())) {
- notificators.addAll(notification.getNotificatorsTypes());
+ boolean filter = false;
+ if (event.getType().equals(Event.TYPE_ALARM)) {
+ String alarms = notification.getString("alarms");
+ if (alarms == null || !alarms.contains(event.getString(Position.KEY_ALARM))) {
+ filter = true;
+ }
+ }
+ if (!filter) {
+ notificators.addAll(notification.getNotificatorsTypes());
+ }
}
}
for (String notificator : notificators) {