diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-24 14:55:06 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-24 14:55:06 +1200 |
commit | ea0bdea88003f46fd6f6164d5c45e33d53f47c81 (patch) | |
tree | d8e51a10e56f7e916cc2bf7486d75c90feb5696e /src/org/traccar/notification/NotificationMail.java | |
parent | a645eb8e2338f11e2c807045b1787a47cd1f1464 (diff) | |
parent | f6484e9808f50aa997f028f9421b05aad6aed8bd (diff) | |
download | trackermap-server-ea0bdea88003f46fd6f6164d5c45e33d53f47c81.tar.gz trackermap-server-ea0bdea88003f46fd6f6164d5c45e33d53f47c81.tar.bz2 trackermap-server-ea0bdea88003f46fd6f6164d5c45e33d53f47c81.zip |
Merge pull request #2242 from Abyss777/users_cache
Implement users cache
Diffstat (limited to 'src/org/traccar/notification/NotificationMail.java')
-rw-r--r-- | src/org/traccar/notification/NotificationMail.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index f9d42968f..f8449e7d2 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -15,7 +15,6 @@ */ package org.traccar.notification; -import java.sql.SQLException; import java.util.Properties; import javax.mail.Message; @@ -27,7 +26,6 @@ import javax.mail.internet.MimeMessage; import org.traccar.Config; import org.traccar.Context; -import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.Event; import org.traccar.model.Extensible; @@ -106,14 +104,13 @@ public final class NotificationMail { } public static void sendMailSync(long userId, Event event, Position position) { - DataManager dataManager = Context.getDataManager(); Properties mailServerProperties; Session mailSession; MimeMessage mailMessage; try { - User user = dataManager.getUser(userId); + User user = Context.getPermissionsManager().getUser(userId); mailServerProperties = getConfigProperies(); if (!mailServerProperties.containsKey("mail.smtp.host")) { @@ -130,8 +127,7 @@ public final class NotificationMail { mailMessage.setFrom(new InternetAddress(mailServerProperties.getProperty("mail.smtp.from"))); } - mailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress( - Context.getDataManager().getUser(userId).getEmail())); + mailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(user.getEmail())); mailMessage.setSubject(NotificationFormatter.formatTitle(userId, event, position)); mailMessage.setText(NotificationFormatter.formatMessage(userId, event, position)); @@ -142,7 +138,7 @@ public final class NotificationMail { transport.sendMessage(mailMessage, mailMessage.getAllRecipients()); transport.close(); - } catch (MessagingException | SQLException error) { + } catch (MessagingException error) { Log.warning(error); } } |