aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-09-21 09:29:42 +0500
committerAbyss777 <abyss@fox5.ru>2016-09-21 09:29:42 +0500
commitb298aef26f01154e84e9a00b29ff62921484a220 (patch)
treefa8b81237c8a4771241aab2da99fa22759ba7587 /src/org/traccar/database
parente0a4ed2a60fd1a38a904fa7156afba6c0aee1cdb (diff)
downloadtrackermap-server-b298aef26f01154e84e9a00b29ff62921484a220.tar.gz
trackermap-server-b298aef26f01154e84e9a00b29ff62921484a220.tar.bz2
trackermap-server-b298aef26f01154e84e9a00b29ff62921484a220.zip
- Add two functions to lookup attributes from device to server and from device to config
- Removed constant
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DeviceManager.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java
index 5f68df831..21e370051 100644
--- a/src/org/traccar/database/DeviceManager.java
+++ b/src/org/traccar/database/DeviceManager.java
@@ -316,7 +316,16 @@ public class DeviceManager implements IdentityManager {
groupsById.remove(groupId);
}
- public String lookupAttribute(long deviceId, String attributeName) {
+ public String lookupServerAttribute(long deviceId, String attributeName) {
+ return lookupAttribute(deviceId, attributeName, true);
+ }
+
+ public String lookupConfigAttribute(long deviceId, String attributeName) {
+ return lookupAttribute(deviceId, attributeName, false);
+ }
+
+
+ private String lookupAttribute(long deviceId, String attributeName, boolean lookupServer) {
String result = null;
Device device = getDeviceById(deviceId);
if (device != null) {
@@ -338,8 +347,12 @@ public class DeviceManager implements IdentityManager {
}
}
if (result == null) {
- Server server = Context.getPermissionsManager().getServer();
- result = (String) server.getAttributes().get(attributeName);
+ if (lookupServer) {
+ Server server = Context.getPermissionsManager().getServer();
+ result = (String) server.getAttributes().get(attributeName);
+ } else {
+ result = Context.getConfig().getString(attributeName);
+ }
}
}
return result;