From 1efe470d4df335dfaaad5a9e2c6417c24d8864e1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 3 Dec 2023 12:12:57 -0800 Subject: Move find driver method --- src/main/java/org/traccar/notification/NotificationFormatter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/java/org/traccar/notification') 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); -- cgit v1.2.3