diff options
author | Anton Tananaev <anton@traccar.org> | 2023-01-27 07:09:07 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-01-27 07:09:07 -0800 |
commit | 0999180f58cf6a0edaf08461674eae70e839f3ce (patch) | |
tree | c417e1e267d1d5332fcfcd7a5e7e20fef13127f1 /src/main/java/org/traccar | |
parent | 18387265cd9432a906cd16b7d71547be5bf46086 (diff) | |
download | trackermap-server-0999180f58cf6a0edaf08461674eae70e839f3ce.tar.gz trackermap-server-0999180f58cf6a0edaf08461674eae70e839f3ce.tar.bz2 trackermap-server-0999180f58cf6a0edaf08461674eae70e839f3ce.zip |
Disable scheduling task
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/reports/common/ReportMailer.java | 14 | ||||
-rw-r--r-- | src/main/java/org/traccar/schedule/ScheduleManager.java | 1 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/main/java/org/traccar/reports/common/ReportMailer.java b/src/main/java/org/traccar/reports/common/ReportMailer.java index 1723c0e3b..221b35ae1 100644 --- a/src/main/java/org/traccar/reports/common/ReportMailer.java +++ b/src/main/java/org/traccar/reports/common/ReportMailer.java @@ -17,13 +17,10 @@ package org.traccar.reports.common; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.traccar.api.security.PermissionsService; import org.traccar.mail.MailManager; import org.traccar.model.User; -import org.traccar.storage.Storage; import org.traccar.storage.StorageException; -import org.traccar.storage.query.Columns; -import org.traccar.storage.query.Condition; -import org.traccar.storage.query.Request; import javax.activation.DataHandler; import javax.inject.Inject; @@ -37,12 +34,12 @@ public class ReportMailer { private static final Logger LOGGER = LoggerFactory.getLogger(ReportMailer.class); - private final Storage storage; + private final PermissionsService permissionsService; private final MailManager mailManager; @Inject - public ReportMailer(Storage storage, MailManager mailManager) { - this.storage = storage; + public ReportMailer(PermissionsService permissionsService, MailManager mailManager) { + this.permissionsService = permissionsService; this.mailManager = mailManager; } @@ -57,8 +54,7 @@ public class ReportMailer { attachment.setDataHandler(new DataHandler(new ByteArrayDataSource( stream.toByteArray(), "application/octet-stream"))); - User user = storage.getObject( - User.class, new Request(new Columns.All(), new Condition.Equals("id", userId))); + User user = permissionsService.getUser(userId); mailManager.sendMessage(user, "Report", "The report is in the attachment.", attachment); } catch (StorageException | IOException | MessagingException e) { LOGGER.warn("Email report failed", e); diff --git a/src/main/java/org/traccar/schedule/ScheduleManager.java b/src/main/java/org/traccar/schedule/ScheduleManager.java index e1de3b3af..450e531a0 100644 --- a/src/main/java/org/traccar/schedule/ScheduleManager.java +++ b/src/main/java/org/traccar/schedule/ScheduleManager.java @@ -39,7 +39,6 @@ public class ScheduleManager implements LifecycleObject { public void start() { executor = Executors.newSingleThreadScheduledExecutor(); var tasks = List.of( - TaskReports.class, TaskDeviceInactivityCheck.class, TaskWebSocketKeepalive.class, TaskHealthCheck.class); |