From 25eb3d86b97f8a0eb806f3e0c572d80c495257d6 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Fri, 1 Jun 2018 07:29:09 -0300 Subject: replace database definition with comma separated list --- src/org/traccar/database/NotificationManager.java | 2 +- src/org/traccar/model/Notification.java | 41 +++++------------------ 2 files changed, 10 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java index 37c6b720c..10c76181a 100644 --- a/src/org/traccar/database/NotificationManager.java +++ b/src/org/traccar/database/NotificationManager.java @@ -86,7 +86,7 @@ public class NotificationManager extends ExtendedObjectManager { for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getServerTime())) { Notification notification = getById(notificationId); if (getById(notificationId).getType().equals(event.getType())) { - notificationMethods.addAll(notification.getMethods()); + notificationMethods.addAll(notification.getTransportMethods()); } } for (String nm : notificationMethods) { diff --git a/src/org/traccar/model/Notification.java b/src/org/traccar/model/Notification.java index 0d0b34cd4..0b632c861 100644 --- a/src/org/traccar/model/Notification.java +++ b/src/org/traccar/model/Notification.java @@ -40,46 +40,23 @@ public class Notification extends ScheduledModel { this.type = type; } - private boolean web; - public boolean getWeb() { - return web; - } - - public void setWeb(boolean web) { - this.web = web; - } - - private boolean mail; - - public boolean getMail() { - return mail; - } + private String transports; - public void setMail(boolean mail) { - this.mail = mail; + public String getTransports() { + return transports; } - private boolean sms; - - public boolean getSms() { - return sms; + public void setTransports(String transports) { + this.transports = transports; } - public void setSms(boolean sms) { - this.sms = sms; - } - public Set getMethods() { + public Set getTransportMethods() { final Set set = new HashSet<>(); - if (web) { - set.add("web"); - } - if (mail) { - set.add("mail"); - } - if (sms) { - set.add("sms"); + final String[] tmp = transports.split(","); + for (String t : tmp) { + set.add(t.trim()); } return set; } -- cgit v1.2.3