diff options
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(); + } } |