From b70e46560359a181b0136fa1c6b0400615bfc904 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 26 Jun 2018 14:15:24 +0500 Subject: Rename MailMessage to FullMessage --- .../traccar/api/resource/NotificationResource.java | 2 +- src/org/traccar/notification/FullMessage.java | 36 ++++++++++++++++++++++ src/org/traccar/notification/MailMessage.java | 36 ---------------------- .../notification/NotificationFormatter.java | 4 +-- src/org/traccar/notification/NotificationMail.java | 6 ++-- 5 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 src/org/traccar/notification/FullMessage.java delete mode 100644 src/org/traccar/notification/MailMessage.java (limited to 'src/org') diff --git a/src/org/traccar/api/resource/NotificationResource.java b/src/org/traccar/api/resource/NotificationResource.java index bec1ce3ab..0d7a7982d 100644 --- a/src/org/traccar/api/resource/NotificationResource.java +++ b/src/org/traccar/api/resource/NotificationResource.java @@ -48,7 +48,7 @@ public class NotificationResource extends ExtendedObjectResource { public Collection get() { return Context.getNotificationManager().getAllNotificationTypes(); } - + @GET @Path("notificators") public Collection getNotificators() { diff --git a/src/org/traccar/notification/FullMessage.java b/src/org/traccar/notification/FullMessage.java new file mode 100644 index 000000000..f66537c6e --- /dev/null +++ b/src/org/traccar/notification/FullMessage.java @@ -0,0 +1,36 @@ +/* + * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.notification; + +public class FullMessage { + + private String subject; + private String body; + + public FullMessage(String subject, String body) { + this.subject = subject; + this.body = body; + } + + public String getSubject() { + return subject; + } + + public String getBody() { + return body; + } +} diff --git a/src/org/traccar/notification/MailMessage.java b/src/org/traccar/notification/MailMessage.java deleted file mode 100644 index 0fce43740..000000000 --- a/src/org/traccar/notification/MailMessage.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016 Anton Tananaev (anton@traccar.org) - * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.notification; - -public class MailMessage { - - private String subject; - private String body; - - public MailMessage(String subject, String body) { - this.subject = subject; - this.body = body; - } - - public String getSubject() { - return subject; - } - - public String getBody() { - return body; - } -} diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index ddc35227e..a1abdd0cc 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -88,12 +88,12 @@ public final class NotificationFormatter { return template; } - public static MailMessage formatFullMessage(long userId, Event event, Position position) { + public static FullMessage formatFullMessage(long userId, Event event, Position position) { String templatePath = Context.getConfig().getString("message.full.templatesPath", "full"); VelocityContext velocityContext = prepareContext(userId, event, position); String formattedMessage = formatMessage(velocityContext, userId, event, position, templatePath); - return new MailMessage((String) velocityContext.get("subject"), formattedMessage); + return new FullMessage((String) velocityContext.get("subject"), formattedMessage); } public static String formatShortMessage(long userId, Event event, Position position) { diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index 76387c73b..808acca76 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -108,10 +108,10 @@ public final class NotificationMail extends Notificator { } message.addRecipient(Message.RecipientType.TO, new InternetAddress(user.getEmail())); - MailMessage mailMessage = NotificationFormatter.formatFullMessage(userId, event, position); - message.setSubject(mailMessage.getSubject()); + FullMessage fullMessage = NotificationFormatter.formatFullMessage(userId, event, position); + message.setSubject(fullMessage.getSubject()); message.setSentDate(new Date()); - message.setContent(mailMessage.getBody(), "text/html; charset=utf-8"); + message.setContent(fullMessage.getBody(), "text/html; charset=utf-8"); Transport transport = session.getTransport(); try { -- cgit v1.2.3