diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-06-28 14:09:44 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-28 14:09:44 +1200 |
commit | 7327681f0bd2338f9c8ee3ea1b4a19dcc5f0de48 (patch) | |
tree | 0ea99ab937fbae96b35cc5dc62edbc74594af9e4 /src/org/traccar/database/DataManager.java | |
parent | 67f46c80d3b5e34440a2644f52b81dddfbaba5fa (diff) | |
parent | 61b2486353c742afe6214f0a0c5c2e9956ea3b97 (diff) | |
download | trackermap-server-7327681f0bd2338f9c8ee3ea1b4a19dcc5f0de48.tar.gz trackermap-server-7327681f0bd2338f9c8ee3ea1b4a19dcc5f0de48.tar.bz2 trackermap-server-7327681f0bd2338f9c8ee3ea1b4a19dcc5f0de48.zip |
Merge pull request #2052 from Abyss777/master
Notifications via email
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 860bf1b84..031703023 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -52,6 +52,7 @@ import org.traccar.model.Geofence; import org.traccar.model.Group; import org.traccar.model.GroupGeofence; import org.traccar.model.GroupPermission; +import org.traccar.model.Notification; import org.traccar.model.Position; import org.traccar.model.Server; import org.traccar.model.User; @@ -644,4 +645,27 @@ public class DataManager implements IdentityManager { .setLong("geofenceId", geofenceId) .executeUpdate(); } + + public Collection<Notification> getNotifications() throws SQLException { + return QueryBuilder.create(dataSource, getQuery("database.selectNotifications")) + .executeQuery(Notification.class); + } + + public void addNotification(Notification notification) throws SQLException { + notification.setId(QueryBuilder.create(dataSource, getQuery("database.insertNotification"), true) + .setObject(notification) + .executeUpdate()); + } + + public void updateNotification(Notification notification) throws SQLException { + QueryBuilder.create(dataSource, getQuery("database.updateNotification")) + .setObject(notification) + .executeUpdate(); + } + + public void removeNotification(Notification notification) throws SQLException { + QueryBuilder.create(dataSource, getQuery("database.deleteNotification")) + .setLong("id", notification.getId()) + .executeUpdate(); + } } |