diff options
author | André Abreu <andre.abreu.98@gmail.com> | 2020-06-29 18:45:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 10:45:22 -0700 |
commit | abf47d3a6f41ae80ad4114a4d6532718bfb1af3e (patch) | |
tree | c1ec2d4783f45dcecc465cda802d9baec27b16be | |
parent | f2b658b2a197eacf74c5c6da035621726c05802b (diff) | |
download | trackermap-server-abf47d3a6f41ae80ad4114a4d6532718bfb1af3e.tar.gz trackermap-server-abf47d3a6f41ae80ad4114a4d6532718bfb1af3e.tar.bz2 trackermap-server-abf47d3a6f41ae80ad4114a4d6532718bfb1af3e.zip |
Fix multiple alarms types comparison (#4552)
* Fix multiple alarms types comparison
* renamed `alarmsStr` to `alarmsAttribute`
* always filter when `alarmsAttribute` is null
-rw-r--r-- | src/main/java/org/traccar/database/NotificationManager.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java index 09df4c571..7d2a1bb2e 100644 --- a/src/main/java/org/traccar/database/NotificationManager.java +++ b/src/main/java/org/traccar/database/NotificationManager.java @@ -92,9 +92,12 @@ public class NotificationManager extends ExtendedObjectManager<Notification> { if (getById(notificationId).getType().equals(event.getType())) { 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))) { + String alarmsAttribute = notification.getString("alarms"); + if (alarmsAttribute == null) { filter = true; + } else { + List<String> alarms = Arrays.asList(alarmsAttribute.split(",")); + filter = !alarms.contains(event.getString(Position.KEY_ALARM)); } } if (!filter) { |