aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/NotificationManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-23 18:29:36 +1200
committerGitHub <noreply@github.com>2017-07-23 18:29:36 +1200
commit4b2372336d0496c85befe099914434e5b68f05b3 (patch)
tree798de625a07c18287e829b3a037cacee179ebcff /src/org/traccar/database/NotificationManager.java
parentba82047a492be54545961716814584d8880d28ae (diff)
parent5a65c0d6be8ffc2db0ffdb0c35ecedfb2b3750c7 (diff)
downloadtrackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.tar.gz
trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.tar.bz2
trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.zip
Merge pull request #3373 from Abyss777/refactor_managers
Refactor managers, permissions etc
Diffstat (limited to 'src/org/traccar/database/NotificationManager.java')
-rw-r--r--src/org/traccar/database/NotificationManager.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java
index 48caa615c..0987f255b 100644
--- a/src/org/traccar/database/NotificationManager.java
+++ b/src/org/traccar/database/NotificationManager.java
@@ -49,7 +49,7 @@ public class NotificationManager {
public void updateEvent(Event event, Position position) {
try {
- dataManager.addEvent(event);
+ dataManager.addObject(event);
} catch (SQLException error) {
Log.warning(error);
}
@@ -57,7 +57,7 @@ public class NotificationManager {
Set<Long> users = Context.getPermissionsManager().getDeviceUsers(event.getDeviceId());
for (long userId : users) {
if (event.getGeofenceId() == 0 || Context.getGeofenceManager() != null
- && Context.getGeofenceManager().checkGeofence(userId, event.getGeofenceId())) {
+ && Context.getGeofenceManager().checkItemPermission(userId, event.getGeofenceId())) {
Notification notification = getUserNotificationByType(userId, event.getType());
if (notification != null) {
if (notification.getWeb()) {
@@ -105,7 +105,7 @@ public class NotificationManager {
notificationsLock.writeLock().lock();
try {
userNotifications.clear();
- for (Notification notification : dataManager.getNotifications()) {
+ for (Notification notification : dataManager.getObjects(Notification.class)) {
getUserNotificationsUnsafe(notification.getUserId()).add(notification);
}
} finally {
@@ -139,7 +139,7 @@ public class NotificationManager {
|| cachedNotification.getSms() != notification.getSms()) {
if (!notification.getWeb() && !notification.getMail() && !notification.getSms()) {
try {
- dataManager.removeNotification(cachedNotification);
+ dataManager.removeObject(Notification.class, cachedNotification.getId());
} catch (SQLException error) {
Log.warning(error);
}
@@ -160,7 +160,7 @@ public class NotificationManager {
notificationsLock.writeLock().unlock();
}
try {
- dataManager.updateNotification(cachedNotification);
+ dataManager.updateObject(cachedNotification);
} catch (SQLException error) {
Log.warning(error);
}
@@ -170,7 +170,7 @@ public class NotificationManager {
}
} else if (notification.getWeb() || notification.getMail() || notification.getSms()) {
try {
- dataManager.addNotification(notification);
+ dataManager.addObject(notification);
} catch (SQLException error) {
Log.warning(error);
}