diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-28 17:07:25 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-28 17:07:25 +1200 |
commit | e849d3a56f55c83dc0ebed02165a124e30e22dbd (patch) | |
tree | 730e542145652ca1d06c64a6944dfa70e0b31b6b /src/org/traccar/model/Notification.java | |
parent | 4d6229c7daa4a7b8f28337c5eca9a422876c98b1 (diff) | |
parent | 14840af2abd9976b8f5634af8e77f4a7126dfac1 (diff) | |
download | trackermap-server-e849d3a56f55c83dc0ebed02165a124e30e22dbd.tar.gz trackermap-server-e849d3a56f55c83dc0ebed02165a124e30e22dbd.tar.bz2 trackermap-server-e849d3a56f55c83dc0ebed02165a124e30e22dbd.zip |
Merge pull request #3950 from Abyss777/notification_refactor
Notification refactor to allow custom "notificators"
Diffstat (limited to 'src/org/traccar/model/Notification.java')
-rw-r--r-- | src/org/traccar/model/Notification.java | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/org/traccar/model/Notification.java b/src/org/traccar/model/Notification.java index cc80f2ae2..f1983a03a 100644 --- a/src/org/traccar/model/Notification.java +++ b/src/org/traccar/model/Notification.java @@ -15,6 +15,13 @@ */ package org.traccar.model; +import java.util.HashSet; +import java.util.Set; + +import org.traccar.database.QueryIgnore; + +import com.fasterxml.jackson.annotation.JsonIgnore; + public class Notification extends ScheduledModel { private boolean always; @@ -37,33 +44,29 @@ 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; + private String notificators; - public boolean getMail() { - return mail; + public String getNotificators() { + return notificators; } - public void setMail(boolean mail) { - this.mail = mail; + public void setNotificators(String transports) { + this.notificators = transports; } - private boolean sms; - public boolean getSms() { - return sms; + @JsonIgnore + @QueryIgnore + public Set<String> getNotificatorsTypes() { + final Set<String> result = new HashSet<>(); + if (notificators != null) { + final String[] transportsList = notificators.split(","); + for (String transport : transportsList) { + result.add(transport.trim()); + } + } + return result; } - public void setSms(boolean sms) { - this.sms = sms; - } } |