diff options
author | Abyss777 <abyss@fox5.ru> | 2016-11-22 13:31:59 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-11-22 13:31:59 +0500 |
commit | 64560f850e12ec8ff5db9d2401158d5d3007b214 (patch) | |
tree | 5308c6695a320eeb78b41739a04a9c05af6aec0f /src/org/traccar/notification/NotificationFormatter.java | |
parent | 94c3b6e92531a0b666141611e6d9cf311e30a108 (diff) | |
download | trackermap-server-64560f850e12ec8ff5db9d2401158d5d3007b214.tar.gz trackermap-server-64560f850e12ec8ff5db9d2401158d5d3007b214.tar.bz2 trackermap-server-64560f850e12ec8ff5db9d2401158d5d3007b214.zip |
Add mail templates for new event types
Diffstat (limited to 'src/org/traccar/notification/NotificationFormatter.java')
-rw-r--r-- | src/org/traccar/notification/NotificationFormatter.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index b48fe9efc..d21c05afe 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -39,6 +39,10 @@ public final class NotificationFormatter { public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_ONLINE = "Device: %1$s%n" + "Online%n" + "Time: %2$tc%n"; + public static final String TITLE_TEMPLATE_TYPE_DEVICE_UNKNOWN = "%1$s: status is unknown"; + public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_UNKNOWN = "Device: %1$s%n" + + "Status is unknown%n" + + "Time: %2$tc%n"; public static final String TITLE_TEMPLATE_TYPE_DEVICE_OFFLINE = "%1$s: offline"; public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_OFFLINE = "Device: %1$s%n" + "Offline%n" @@ -88,6 +92,11 @@ public final class NotificationFormatter { + "Ignition OFF%n" + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n" + "Time: %2$tc%n"; + public static final String TITLE_TEMPLATE_TYPE_MAINTENANCE_NEED = "%1$s: maintenance is needed"; + public static final String MESSAGE_TEMPLATE_TYPE_MAINTENANCE_NEED = "Device: %1$s%n" + + "Maintenance is needed%n" + + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n" + + "Time: %2$tc%n"; public static String formatTitle(long userId, Event event, Position position) { Device device = Context.getIdentityManager().getDeviceById(event.getDeviceId()); @@ -101,6 +110,9 @@ public final class NotificationFormatter { case Event.TYPE_DEVICE_ONLINE: formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName()); break; + case Event.TYPE_DEVICE_UNKNOWN: + formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_UNKNOWN, device.getName()); + break; case Event.TYPE_DEVICE_OFFLINE: formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName()); break; @@ -128,6 +140,9 @@ public final class NotificationFormatter { case Event.TYPE_IGNITION_OFF: formatter.format(TITLE_TEMPLATE_TYPE_IGNITION_OFF, device.getName()); break; + case Event.TYPE_MAINTENANCE_NEED: + formatter.format(TITLE_TEMPLATE_TYPE_MAINTENANCE_NEED, device.getName()); + break; default: formatter.format("Unknown type"); break; @@ -150,6 +165,9 @@ public final class NotificationFormatter { case Event.TYPE_DEVICE_ONLINE: formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName(), event.getServerTime()); break; + case Event.TYPE_DEVICE_UNKNOWN: + formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_UNKNOWN, device.getName(), event.getServerTime()); + break; case Event.TYPE_DEVICE_OFFLINE: formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName(), event.getServerTime()); break; @@ -188,6 +206,10 @@ public final class NotificationFormatter { formatter.format(MESSAGE_TEMPLATE_TYPE_IGNITION_OFF, device.getName(), position.getFixTime(), position.getLatitude(), position.getLongitude()); break; + case Event.TYPE_MAINTENANCE_NEED: + formatter.format(MESSAGE_TEMPLATE_TYPE_MAINTENANCE_NEED, device.getName(), position.getFixTime(), + position.getLatitude(), position.getLongitude()); + break; default: formatter.format("Unknown type"); break; |