aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorWeb.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorWeb.java b/src/main/java/org/traccar/notificators/NotificatorWeb.java
index 023cb04af..e19a94c1d 100644
--- a/src/main/java/org/traccar/notificators/NotificatorWeb.java
+++ b/src/main/java/org/traccar/notificators/NotificatorWeb.java
@@ -17,15 +17,34 @@
package org.traccar.notificators;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.model.User;
+import org.traccar.notification.NotificationFormatter;
+import org.traccar.notification.NotificationMessage;
+import org.traccar.session.cache.CacheManager;
public final class NotificatorWeb implements Notificator {
@Override
public void send(User user, Event event, Position position) {
- Context.getConnectionManager().updateEvent(user.getId(), event);
+
+ Event copy = new Event();
+ copy.setId(event.getId());
+ copy.setDeviceId(event.getDeviceId());
+ copy.setType(event.getType());
+ copy.setEventTime(event.getEventTime());
+ copy.setPositionId(event.getPositionId());
+ copy.setGeofenceId(event.getGeofenceId());
+ copy.setMaintenanceId(event.getMaintenanceId());
+ copy.getAttributes().putAll(event.getAttributes());
+
+ NotificationMessage message = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), user, event, position, "short");
+ copy.set("message", message.getBody());
+
+ Context.getConnectionManager().updateEvent(user.getId(), copy);
}
}