diff options
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 9bc8ea805..1c6579bf4 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -138,10 +138,11 @@ public class DataManager { private long devicesRefreshDelay; private static final long DEFAULT_REFRESH_DELAY = 300; - public Device getDeviceByImei(String imei) throws SQLException { + public Device getDeviceByUniqueId(String uniqueId) throws SQLException { - if (devices == null || !devices.containsKey(imei) || + if (devices == null || !devices.containsKey(uniqueId) || (Calendar.getInstance().getTimeInMillis() - devicesLastUpdate.getTimeInMillis() > devicesRefreshDelay)) { + devices = new HashMap<String, Device>(); for (Device device : getDevices()) { devices.put(device.getImei(), device); @@ -149,7 +150,7 @@ public class DataManager { devicesLastUpdate = Calendar.getInstance(); } - return devices.get(imei); + return devices.get(uniqueId); } private NamedParameterStatement.ResultSetProcessor<Long> generatedKeysResultSetProcessor = new NamedParameterStatement.ResultSetProcessor<Long>() { |