diff options
author | Abyss777 <abyss@fox5.ru> | 2016-08-23 14:48:01 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-08-23 14:48:01 +0500 |
commit | 21bf1014e55ab8049e18ee991c6ee80b23d1789c (patch) | |
tree | 1b69c9e0e303773fc5d85958ac6bd369471b9637 /src/org/traccar/notification | |
parent | 5536fbe00c022c151007ad077d911b5162201cd4 (diff) | |
download | traccar-server-21bf1014e55ab8049e18ee991c6ee80b23d1789c.tar.gz traccar-server-21bf1014e55ab8049e18ee991c6ee80b23d1789c.tar.bz2 traccar-server-21bf1014e55ab8049e18ee991c6ee80b23d1789c.zip |
Implement cache for users objects
Diffstat (limited to 'src/org/traccar/notification')
-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); } } |