aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-28 14:09:44 +1200
committerGitHub <noreply@github.com>2016-06-28 14:09:44 +1200
commit7327681f0bd2338f9c8ee3ea1b4a19dcc5f0de48 (patch)
tree0ea99ab937fbae96b35cc5dc62edbc74594af9e4 /src/org/traccar/database/DataManager.java
parent67f46c80d3b5e34440a2644f52b81dddfbaba5fa (diff)
parent61b2486353c742afe6214f0a0c5c2e9956ea3b97 (diff)
downloadtrackermap-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.java24
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();
+ }
}