From 6dbe4dfd44c7acda448fbda279b0f0a088c76489 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 4 Nov 2018 14:52:42 +1300 Subject: Alarm types filtering option --- src/org/traccar/database/NotificationManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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 { 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) { -- cgit v1.2.3