aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/NotificationManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-07 08:22:55 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-07 08:22:55 -0700
commit79cc136a4e8394cf340277ff2a912e97b89d5c59 (patch)
tree70ad34601939a443725a0891503ed5c040baf6bc /src/main/java/org/traccar/database/NotificationManager.java
parent3a83acbf92741b34323a74bd1a233186d507c46b (diff)
downloadtrackermap-server-79cc136a4e8394cf340277ff2a912e97b89d5c59.tar.gz
trackermap-server-79cc136a4e8394cf340277ff2a912e97b89d5c59.tar.bz2
trackermap-server-79cc136a4e8394cf340277ff2a912e97b89d5c59.zip
Remove calendar manager
Diffstat (limited to 'src/main/java/org/traccar/database/NotificationManager.java')
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index 2f912fff1..fcefb54f0 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -37,16 +37,20 @@ import org.traccar.model.Position;
import org.traccar.model.Typed;
import org.traccar.model.User;
import org.traccar.notification.MessageException;
+import org.traccar.session.cache.CacheManager;
import org.traccar.storage.StorageException;
public class NotificationManager extends ExtendedObjectManager<Notification> {
private static final Logger LOGGER = LoggerFactory.getLogger(NotificationManager.class);
+ private final CacheManager cacheManager;
+
private final boolean geocodeOnRequest;
- public NotificationManager(DataManager dataManager) {
+ public NotificationManager(DataManager dataManager, CacheManager cacheManager) {
super(dataManager, Notification.class);
+ this.cacheManager = cacheManager;
geocodeOnRequest = Context.getConfig().getBoolean(Keys.GEOCODER_ON_REQUEST);
}
@@ -56,7 +60,7 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
for (long itemId : getUserItems(userId)) {
if (getById(itemId).getAlways() || deviceNotifications.contains(itemId)) {
long calendarId = getById(itemId).getCalendarId();
- Calendar calendar = calendarId != 0 ? Context.getCalendarManager().getById(calendarId) : null;
+ Calendar calendar = calendarId != 0 ? cacheManager.getObject(Calendar.class, calendarId) : null;
if (calendar == null || calendar.checkMoment(time)) {
result.add(itemId);
}