aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-14 12:05:25 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-14 12:05:25 +0500
commite1deb7ae138a8821fd91cf85321b68c5a73675c7 (patch)
treeb313448ef355af5e9d70d717b503e31920f2bca2 /src/org/traccar/reports
parent31ab23aeacce2ed9777ea38cdaf4cda199fc3a86 (diff)
downloadtraccar-server-e1deb7ae138a8821fd91cf85321b68c5a73675c7.tar.gz
traccar-server-e1deb7ae138a8821fd91cf85321b68c5a73675c7.tar.bz2
traccar-server-e1deb7ae138a8821fd91cf85321b68c5a73675c7.zip
Implemented helper lookupPreference
Diffstat (limited to 'src/org/traccar/reports')
-rw-r--r--src/org/traccar/reports/ReportUtils.java29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index 9614ecf71..ed97c6857 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -32,38 +32,15 @@ public final class ReportUtils {
}
public static String getDistanceUnit(long userId) {
- String unit;
- String userUnit = Context.getPermissionsManager().getUser(userId).getDistanceUnit();
- String serverUnit = Context.getPermissionsManager().getServer().getDistanceUnit();
- if (Context.getPermissionsManager().getServer().getForceSettings()) {
- unit = serverUnit != null ? serverUnit : userUnit;
- } else {
- unit = userUnit != null ? userUnit : serverUnit;
- }
- return unit != null ? unit : "km";
+ return (String) Context.getPermissionsManager().lookupPreference(userId, "distanceUnit", "km");
}
public static String getSpeedUnit(long userId) {
- String unit;
- String userUnit = Context.getPermissionsManager().getUser(userId).getSpeedUnit();
- String serverUnit = Context.getPermissionsManager().getServer().getSpeedUnit();
- if (Context.getPermissionsManager().getServer().getForceSettings()) {
- unit = serverUnit != null ? serverUnit : userUnit;
- } else {
- unit = userUnit != null ? userUnit : serverUnit;
- }
- return unit != null ? unit : "kn";
+ return (String) Context.getPermissionsManager().lookupPreference(userId, "speedUnit", "kn");
}
public static TimeZone getTimezone(long userId) {
- String timezone;
- String userTimezone = Context.getPermissionsManager().getUser(userId).getTimezone();
- String serverTimezone = Context.getPermissionsManager().getServer().getTimezone();
- if (Context.getPermissionsManager().getServer().getForceSettings()) {
- timezone = serverTimezone != null ? serverTimezone : userTimezone;
- } else {
- timezone = userTimezone != null ? userTimezone : serverTimezone;
- }
+ String timezone = (String) Context.getPermissionsManager().lookupPreference(userId, "timezone", null);
return timezone != null ? TimeZone.getTimeZone(timezone) : TimeZone.getDefault();
}