aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/notification/NotificationFormatter.java4
-rw-r--r--src/main/java/org/traccar/session/cache/CacheManager.java7
2 files changed, 3 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/notification/NotificationFormatter.java b/src/main/java/org/traccar/notification/NotificationFormatter.java
index 85e8a54bb..e994729c0 100644
--- a/src/main/java/org/traccar/notification/NotificationFormatter.java
+++ b/src/main/java/org/traccar/notification/NotificationFormatter.java
@@ -19,6 +19,7 @@ package org.traccar.notification;
import org.apache.velocity.VelocityContext;
import org.traccar.helper.model.UserUtil;
import org.traccar.model.Device;
+import org.traccar.model.Driver;
import org.traccar.model.Event;
import org.traccar.model.Geofence;
import org.traccar.model.Maintenance;
@@ -66,7 +67,8 @@ public class NotificationFormatter {
}
String driverUniqueId = event.getString(Position.KEY_DRIVER_UNIQUE_ID);
if (driverUniqueId != null) {
- velocityContext.put("driver", cacheManager.findDriverByUniqueId(device.getId(), driverUniqueId));
+ velocityContext.put("driver", cacheManager.getDeviceObjects(device.getId(), Driver.class).stream()
+ .filter(driver -> driver.getUniqueId().equals(driverUniqueId)).findFirst().orElse(null));
}
return textTemplateFormatter.formatMessage(velocityContext, event.getType(), templatePath);
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java
index 0aadb3692..4b6422de2 100644
--- a/src/main/java/org/traccar/session/cache/CacheManager.java
+++ b/src/main/java/org/traccar/session/cache/CacheManager.java
@@ -155,13 +155,6 @@ public class CacheManager implements BroadcastInterface {
}
}
- public Driver findDriverByUniqueId(long deviceId, String driverUniqueId) {
- return getDeviceObjects(deviceId, Driver.class).stream()
- .filter(driver -> driver.getUniqueId().equals(driverUniqueId))
- .findFirst()
- .orElse(null);
- }
-
public void addDevice(long deviceId) throws StorageException {
try {
lock.writeLock().lock();