aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/notification
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-01-15 15:49:36 -0800
committerAnton Tananaev <anton@traccar.org>2024-01-15 15:49:36 -0800
commita531585474ca9ee7437d2a5b1698d1cf5f507a09 (patch)
tree8cb92b92c8d2970cd1c8375fae1e69abc97f21b0 /src/main/java/org/traccar/notification
parent2b893df60f62ee8b363cd6dd528c155bb5124c5c (diff)
downloadtrackermap-server-a531585474ca9ee7437d2a5b1698d1cf5f507a09.tar.gz
trackermap-server-a531585474ca9ee7437d2a5b1698d1cf5f507a09.tar.bz2
trackermap-server-a531585474ca9ee7437d2a5b1698d1cf5f507a09.zip
Add notification to templates
Diffstat (limited to 'src/main/java/org/traccar/notification')
-rw-r--r--src/main/java/org/traccar/notification/NotificationFormatter.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/notification/NotificationFormatter.java b/src/main/java/org/traccar/notification/NotificationFormatter.java
index e994729c0..7685eac0d 100644
--- a/src/main/java/org/traccar/notification/NotificationFormatter.java
+++ b/src/main/java/org/traccar/notification/NotificationFormatter.java
@@ -23,6 +23,7 @@ import org.traccar.model.Driver;
import org.traccar.model.Event;
import org.traccar.model.Geofence;
import org.traccar.model.Maintenance;
+import org.traccar.model.Notification;
import org.traccar.model.Position;
import org.traccar.model.Server;
import org.traccar.model.User;
@@ -44,13 +45,15 @@ public class NotificationFormatter {
this.textTemplateFormatter = textTemplateFormatter;
}
- public NotificationMessage formatMessage(User user, Event event, Position position, String templatePath) {
+ public NotificationMessage formatMessage(
+ Notification notification, User user, Event event, Position position, String templatePath) {
Server server = cacheManager.getServer();
Device device = cacheManager.getObject(Device.class, event.getDeviceId());
VelocityContext velocityContext = textTemplateFormatter.prepareContext(server, user);
+ velocityContext.put("notification", notification);
velocityContext.put("device", device);
velocityContext.put("event", event);
if (position != null) {