aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
authorEdward Valley <ed.valley@yandex.com>2019-07-10 17:03:25 -0400
committerEdward Valley <ed.valley@yandex.com>2019-07-10 17:03:25 -0400
commit2c604b9c9ee8f996902acfdd60626324a8414d34 (patch)
treedb8a77746ff1b59b846b6806e1019c128803bec1 /src/main/java/org/traccar/database
parent11568839d89fa5bf58da0a654248f9b7696ee406 (diff)
downloadtrackermap-server-2c604b9c9ee8f996902acfdd60626324a8414d34.tar.gz
trackermap-server-2c604b9c9ee8f996902acfdd60626324a8414d34.tar.bz2
trackermap-server-2c604b9c9ee8f996902acfdd60626324a8414d34.zip
Changes after third review
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java18
-rw-r--r--src/main/java/org/traccar/database/IdentityManager.java6
2 files changed, 22 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index de4607d1f..d1a205b01 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.config.Config;
import org.traccar.Context;
+import org.traccar.model.Command;
import org.traccar.model.Device;
import org.traccar.model.DeviceState;
import org.traccar.model.DeviceAccumulators;
@@ -114,6 +115,21 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
return devicesByUniqueId.get(uniqueId);
}
+ public String getDevicePassword(long id) {
+
+ return getById(id).getString(Command.KEY_DEVICE_PASSWORD);
+ }
+
+ public String getDevicePassword(long id, String defaultPassword) {
+
+ String password = getDevicePassword(id);
+ if (password != null) {
+ return password;
+ }
+
+ return defaultPassword;
+ }
+
public Device getDeviceByPhone(String phone) {
return devicesByPhone.get(phone);
}
diff --git a/src/main/java/org/traccar/database/IdentityManager.java b/src/main/java/org/traccar/database/IdentityManager.java
index 6228a0f75..331706669 100644
--- a/src/main/java/org/traccar/database/IdentityManager.java
+++ b/src/main/java/org/traccar/database/IdentityManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,10 @@ public interface IdentityManager {
Device getByUniqueId(String uniqueId) throws Exception;
+ String getDevicePassword(long id);
+
+ String getDevicePassword(long id, String defaultPassword);
+
Position getLastPosition(long deviceId);
boolean isLatestPosition(Position position);