aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification/NotificationFormatter.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-27 15:13:10 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-27 15:13:10 +0500
commit395779143dd61df7ba526ee7a80a91094291a30b (patch)
tree31bc760a68167e0bb445e7c80475b11acdb1e8ed /src/org/traccar/notification/NotificationFormatter.java
parent1972191b8802f3f9295cb151202c50d115a87f0e (diff)
downloadtrackermap-server-395779143dd61df7ba526ee7a80a91094291a30b.tar.gz
trackermap-server-395779143dd61df7ba526ee7a80a91094291a30b.tar.bz2
trackermap-server-395779143dd61df7ba526ee7a80a91094291a30b.zip
- Removed commented parameters from release configs
- Style fixes
Diffstat (limited to 'src/org/traccar/notification/NotificationFormatter.java')
-rw-r--r--src/org/traccar/notification/NotificationFormatter.java130
1 files changed, 62 insertions, 68 deletions
diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java
index edfa70f4d..2b648ef4c 100644
--- a/src/org/traccar/notification/NotificationFormatter.java
+++ b/src/org/traccar/notification/NotificationFormatter.java
@@ -76,24 +76,33 @@ public final class NotificationFormatter {
Formatter formatter = new Formatter(stringBuilder, Locale.getDefault());
switch (event.getType()) {
- case Event.TYPE_COMMAND_RESULT : formatter.format(TITLE_TEMPLATE_TYPE_COMMAND_RESULT, device.getName());
- break;
- case Event.TYPE_DEVICE_ONLINE : formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName());
- break;
- case Event.TYPE_DEVICE_OFFLINE : formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName());
- break;
- case Event.TYPE_DEVICE_MOVING : formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_MOVING, device.getName());
- break;
- case Event.TYPE_DEVICE_STOPPED : formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_STOPPED, device.getName());
- break;
- case Event.TYPE_DEVICE_OVERSPEED: formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_OVERSPEED, device.getName());
- break;
- case Event.TYPE_GEOFENCE_ENTER : formatter.format(TITLE_TEMPLATE_TYPE_GEOFENCE_ENTER, device.getName());
- break;
- case Event.TYPE_GEOFENCE_EXIT : formatter.format(TITLE_TEMPLATE_TYPE_GEOFENCE_EXIT, device.getName());
- break;
- default : formatter.format("Unknown type");
- break;
+ case Event.TYPE_COMMAND_RESULT:
+ formatter.format(TITLE_TEMPLATE_TYPE_COMMAND_RESULT, device.getName());
+ break;
+ case Event.TYPE_DEVICE_ONLINE:
+ formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName());
+ break;
+ case Event.TYPE_DEVICE_OFFLINE:
+ formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName());
+ break;
+ case Event.TYPE_DEVICE_MOVING:
+ formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_MOVING, device.getName());
+ break;
+ case Event.TYPE_DEVICE_STOPPED:
+ formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_STOPPED, device.getName());
+ break;
+ case Event.TYPE_DEVICE_OVERSPEED:
+ formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_OVERSPEED, device.getName());
+ break;
+ case Event.TYPE_GEOFENCE_ENTER:
+ formatter.format(TITLE_TEMPLATE_TYPE_GEOFENCE_ENTER, device.getName());
+ break;
+ case Event.TYPE_GEOFENCE_EXIT:
+ formatter.format(TITLE_TEMPLATE_TYPE_GEOFENCE_EXIT, device.getName());
+ break;
+ default:
+ formatter.format("Unknown type");
+ break;
}
String result = formatter.toString();
formatter.close();
@@ -106,56 +115,41 @@ public final class NotificationFormatter {
Formatter formatter = new Formatter(stringBuilder, Locale.getDefault());
switch (event.getType()) {
- case Event.TYPE_COMMAND_RESULT : formatter.format(MESSAGE_TEMPLATE_TYPE_COMMAND_RESULT,
- device.getName(),
- event.getServerTime(),
- position.getAttributes().get("result"));
- break;
- case Event.TYPE_DEVICE_ONLINE : formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_ONLINE,
- device.getName(),
- event.getServerTime());
- break;
- case Event.TYPE_DEVICE_OFFLINE : formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_OFFLINE,
- device.getName(),
- event.getServerTime());
- break;
- case Event.TYPE_DEVICE_MOVING : formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_MOVING,
- device.getName(),
- position.getFixTime(),
- position.getLatitude(),
- position.getLongitude());
- break;
- case Event.TYPE_DEVICE_STOPPED : formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_STOPPED,
- device.getName(),
- position.getFixTime(),
- position.getLatitude(),
- position.getLongitude());
- break;
- case Event.TYPE_DEVICE_OVERSPEED: formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_OVERSPEED,
- device.getName(),
- position.getFixTime(),
- position.getLatitude(),
- position.getLongitude(),
- position.getSpeed());
- break;
- case Event.TYPE_GEOFENCE_ENTER : formatter.format(MESSAGE_TEMPLATE_TYPE_GEOFENCE_ENTER,
- device.getName(),
- position.getFixTime(),
- position.getLatitude(),
- position.getLongitude(),
- (Context.getGeofenceManager() != null)
- ? Context.getGeofenceManager().getGeofence(event.getGeofenceId()).getName() : "");
- break;
- case Event.TYPE_GEOFENCE_EXIT : formatter.format(MESSAGE_TEMPLATE_TYPE_GEOFENCE_EXIT,
- device.getName(),
- position.getFixTime(),
- position.getLatitude(),
- position.getLongitude(),
- (Context.getGeofenceManager() != null)
- ? Context.getGeofenceManager().getGeofence(event.getGeofenceId()).getName() : "");
- break;
- default : formatter.format("Unknown type");
- break;
+ case Event.TYPE_COMMAND_RESULT:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_COMMAND_RESULT, device.getName(), event.getServerTime(),
+ position.getAttributes().get("result"));
+ break;
+ case Event.TYPE_DEVICE_ONLINE:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName(), event.getServerTime());
+ break;
+ case Event.TYPE_DEVICE_OFFLINE:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName(), event.getServerTime());
+ break;
+ case Event.TYPE_DEVICE_MOVING:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_MOVING, device.getName(), position.getFixTime(),
+ position.getLatitude(), position.getLongitude());
+ break;
+ case Event.TYPE_DEVICE_STOPPED:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_STOPPED, device.getName(), position.getFixTime(),
+ position.getLatitude(), position.getLongitude());
+ break;
+ case Event.TYPE_DEVICE_OVERSPEED:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_OVERSPEED, device.getName(), position.getFixTime(),
+ position.getLatitude(), position.getLongitude(), position.getSpeed());
+ break;
+ case Event.TYPE_GEOFENCE_ENTER:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_GEOFENCE_ENTER, device.getName(), position.getFixTime(),
+ position.getLatitude(), position.getLongitude(), Context.getGeofenceManager() != null
+ ? Context.getGeofenceManager().getGeofence(event.getGeofenceId()).getName() : "");
+ break;
+ case Event.TYPE_GEOFENCE_EXIT:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_GEOFENCE_EXIT, device.getName(), position.getFixTime(),
+ position.getLatitude(), position.getLongitude(), Context.getGeofenceManager() != null
+ ? Context.getGeofenceManager().getGeofence(event.getGeofenceId()).getName() : "");
+ break;
+ default:
+ formatter.format("Unknown type");
+ break;
}
String result = formatter.toString();
formatter.close();