aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index c4fc48ebf..9f9a83cd2 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2016 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
private static final Logger LOGGER = LoggerFactory.getLogger(NotificationManager.class);
- private boolean geocodeOnRequest;
+ private final boolean geocodeOnRequest;
public NotificationManager(DataManager dataManager) {
super(dataManager, Notification.class);
@@ -70,11 +70,6 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
LOGGER.warn("Event save error", error);
}
- if (position != null && geocodeOnRequest && Context.getGeocoder() != null && position.getAddress() == null) {
- position.setAddress(Context.getGeocoder()
- .getAddress(position.getLatitude(), position.getLongitude(), null));
- }
-
long deviceId = event.getDeviceId();
Set<Long> users = Context.getPermissionsManager().getDeviceUsers(deviceId);
Set<Long> usersToForward = null;
@@ -108,6 +103,13 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
}
}
}
+
+ 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);
}