aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/notificators
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/notificators')
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorFirebase.java5
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorMail.java5
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorPushover.java5
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorSms.java7
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorTelegram.java5
5 files changed, 21 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorFirebase.java b/src/main/java/org/traccar/notificators/NotificatorFirebase.java
index f91ec25a0..bcce9a4d8 100644
--- a/src/main/java/org/traccar/notificators/NotificatorFirebase.java
+++ b/src/main/java/org/traccar/notificators/NotificatorFirebase.java
@@ -20,12 +20,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.config.Keys;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.model.User;
import org.traccar.notification.NotificationMessage;
import org.traccar.notification.NotificationFormatter;
+import org.traccar.session.cache.CacheManager;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
@@ -69,7 +71,8 @@ public class NotificatorFirebase extends Notificator {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getAttributes().containsKey("notificationTokens")) {
- NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position, "short");
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), userId, event, position, "short");
Notification notification = new Notification();
notification.title = shortMessage.getSubject();
diff --git a/src/main/java/org/traccar/notificators/NotificatorMail.java b/src/main/java/org/traccar/notificators/NotificatorMail.java
index 9b5637ed8..eb7f399eb 100644
--- a/src/main/java/org/traccar/notificators/NotificatorMail.java
+++ b/src/main/java/org/traccar/notificators/NotificatorMail.java
@@ -17,11 +17,13 @@
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.notification.NotificationMessage;
import org.traccar.notification.MessageException;
import org.traccar.notification.NotificationFormatter;
+import org.traccar.session.cache.CacheManager;
import javax.mail.MessagingException;
@@ -30,7 +32,8 @@ public final class NotificatorMail extends Notificator {
@Override
public void sendSync(long userId, Event event, Position position) throws MessageException {
try {
- NotificationMessage fullMessage = NotificationFormatter.formatMessage(userId, event, position, "full");
+ NotificationMessage fullMessage = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), userId, event, position, "full");
Context.getMailManager().sendMessage(userId, fullMessage.getSubject(), fullMessage.getBody());
} catch (MessagingException e) {
throw new MessageException(e);
diff --git a/src/main/java/org/traccar/notificators/NotificatorPushover.java b/src/main/java/org/traccar/notificators/NotificatorPushover.java
index 456c2fe4f..73fad9bd2 100644
--- a/src/main/java/org/traccar/notificators/NotificatorPushover.java
+++ b/src/main/java/org/traccar/notificators/NotificatorPushover.java
@@ -19,12 +19,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.config.Keys;
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;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
@@ -77,7 +79,8 @@ public class NotificatorPushover extends Notificator {
return;
}
- NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position, "short");
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), userId, event, position, "short");
Message message = new Message();
message.token = token;
diff --git a/src/main/java/org/traccar/notificators/NotificatorSms.java b/src/main/java/org/traccar/notificators/NotificatorSms.java
index fb817b112..09eb65b0c 100644
--- a/src/main/java/org/traccar/notificators/NotificatorSms.java
+++ b/src/main/java/org/traccar/notificators/NotificatorSms.java
@@ -25,6 +25,7 @@ import org.traccar.model.User;
import org.traccar.notification.MessageException;
import org.traccar.notification.NotificationFormatter;
import org.traccar.notification.NotificationMessage;
+import org.traccar.session.cache.CacheManager;
public final class NotificatorSms extends Notificator {
@@ -32,7 +33,8 @@ public final class NotificatorSms extends Notificator {
public void sendAsync(long userId, Event event, Position position) {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getPhone() != null) {
- NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position, "short");
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), userId, event, position, "short");
Main.getInjector().getInstance(StatisticsManager.class).registerSms();
Context.getSmsManager().sendMessageAsync(user.getPhone(),
shortMessage.getBody(), false);
@@ -43,7 +45,8 @@ public final class NotificatorSms extends Notificator {
public void sendSync(long userId, Event event, Position position) throws MessageException, InterruptedException {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getPhone() != null) {
- NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position, "short");
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), userId, event, position, "short");
Main.getInjector().getInstance(StatisticsManager.class).registerSms();
Context.getSmsManager().sendMessageSync(user.getPhone(),
shortMessage.getBody(), false);
diff --git a/src/main/java/org/traccar/notificators/NotificatorTelegram.java b/src/main/java/org/traccar/notificators/NotificatorTelegram.java
index 70148110c..a8e69e77d 100644
--- a/src/main/java/org/traccar/notificators/NotificatorTelegram.java
+++ b/src/main/java/org/traccar/notificators/NotificatorTelegram.java
@@ -20,12 +20,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.model.User;
import org.traccar.config.Keys;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.notification.NotificationFormatter;
import org.traccar.notification.NotificationMessage;
+import org.traccar.session.cache.CacheManager;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
@@ -99,7 +101,8 @@ public class NotificatorTelegram extends Notificator {
@Override
public void sendSync(long userId, Event event, Position position) {
User user = Context.getPermissionsManager().getUser(userId);
- NotificationMessage shortMessage = NotificationFormatter.formatMessage(userId, event, position, "short");
+ NotificationMessage shortMessage = NotificationFormatter.formatMessage(
+ Main.getInjector().getInstance(CacheManager.class), userId, event, position, "short");
TextMessage message = new TextMessage();
message.chatId = user.getString("telegramChatId");