aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-13 19:26:17 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-13 19:26:17 -0700
commit57b5aa9ada42f1c113dc0cef8f259b55b6f9ea69 (patch)
treec77791b0f4c9172a012bc4dc9690446ab8fbf222 /src/main/java
parentd492aeec2ab8ba53725d91e99140dc2774f7e3f1 (diff)
downloadtraccar-server-57b5aa9ada42f1c113dc0cef8f259b55b6f9ea69.tar.gz
traccar-server-57b5aa9ada42f1c113dc0cef8f259b55b6f9ea69.tar.bz2
traccar-server-57b5aa9ada42f1c113dc0cef8f259b55b6f9ea69.zip
Event geocoding only on notifications
Diffstat (limited to 'src/main/java')
-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);
}