aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/NotificationManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-04 10:38:49 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-04 10:38:49 -0700
commit8c12ded81c5dce295fcb229c566209d784f55356 (patch)
tree335f01a30f5c26dc1d5cf24c2c5dfded074a1cd1 /src/main/java/org/traccar/database/NotificationManager.java
parentfd84b0dcb86208c2c9c64fbe067cf7d4324892ac (diff)
downloadtrackermap-server-8c12ded81c5dce295fcb229c566209d784f55356.tar.gz
trackermap-server-8c12ded81c5dce295fcb229c566209d784f55356.tar.bz2
trackermap-server-8c12ded81c5dce295fcb229c566209d784f55356.zip
Remove maintenance manager
Diffstat (limited to 'src/main/java/org/traccar/database/NotificationManager.java')
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java57
1 files changed, 26 insertions, 31 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index f358b1d4d..64f3b6775 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -77,42 +77,37 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
usersToForward = new HashSet<>();
}
for (long userId : users) {
- if ((event.getGeofenceId() == 0
- || Context.getGeofenceManager().checkItemPermission(userId, event.getGeofenceId()))
- && (event.getMaintenanceId() == 0
- || Context.getMaintenancesManager().checkItemPermission(userId, event.getMaintenanceId()))) {
- if (usersToForward != null) {
- usersToForward.add(userId);
- }
- final Set<String> notificators = new HashSet<>();
- for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getEventTime())) {
- Notification notification = getById(notificationId);
- if (getById(notificationId).getType().equals(event.getType())) {
- boolean filter = false;
- if (event.getType().equals(Event.TYPE_ALARM)) {
- String alarmsAttribute = notification.getString("alarms");
- if (alarmsAttribute == null) {
- filter = true;
- } else {
- List<String> alarms = Arrays.asList(alarmsAttribute.split(","));
- filter = !alarms.contains(event.getString(Position.KEY_ALARM));
- }
- }
- if (!filter) {
- notificators.addAll(notification.getNotificatorsTypes());
+ if (usersToForward != null) {
+ usersToForward.add(userId);
+ }
+ final Set<String> notificators = new HashSet<>();
+ for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getEventTime())) {
+ Notification notification = getById(notificationId);
+ if (getById(notificationId).getType().equals(event.getType())) {
+ boolean filter = false;
+ if (event.getType().equals(Event.TYPE_ALARM)) {
+ String alarmsAttribute = notification.getString("alarms");
+ if (alarmsAttribute == null) {
+ filter = true;
+ } else {
+ List<String> alarms = Arrays.asList(alarmsAttribute.split(","));
+ filter = !alarms.contains(event.getString(Position.KEY_ALARM));
}
}
+ if (!filter) {
+ notificators.addAll(notification.getNotificatorsTypes());
+ }
}
+ }
- if (position != null && position.getAddress() == null
- && geocodeOnRequest && Context.getGeocoder() != null) {
- position.setAddress(Context.getGeocoder()
- .getAddress(position.getLatitude(), position.getLongitude(), null));
- }
+ if (position != null && position.getAddress() == null
+ && geocodeOnRequest && Context.getGeocoder() != null) {
+ position.setAddress(Context.getGeocoder()
+ .getAddress(position.getLatitude(), position.getLongitude(), null));
+ }
- for (String notificator : notificators) {
- Context.getNotificatorManager().getNotificator(notificator).sendAsync(userId, event, position);
- }
+ for (String notificator : notificators) {
+ Context.getNotificatorManager().getNotificator(notificator).sendAsync(userId, event, position);
}
}
if (Context.getEventForwarder() != null) {