aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-17 11:14:32 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-17 11:14:32 +1200
commit31153730de44a31b87c8131d95de1127d2758508 (patch)
tree6dcfe3a6f54cd37b8487a34f141da417dad95461 /src/org/traccar/database/DataManager.java
parentfe83a2a83d086f8af8579f2a6c546f3576067964 (diff)
downloadtrackermap-server-31153730de44a31b87c8131d95de1127d2758508.tar.gz
trackermap-server-31153730de44a31b87c8131d95de1127d2758508.tar.bz2
trackermap-server-31153730de44a31b87c8131d95de1127d2758508.zip
Load latest positions from db
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index d8efaaaca..807a75f34 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -133,17 +133,6 @@ public class DataManager {
return devices.get(uniqueId);
}
- // TODO: possibly remove this method
- public void updateLatestPosition(Position position) throws SQLException {
- QueryBuilder.create(dataSource, properties.getProperty("database.updateLatestPosition"))
- .setObject(position)
- .setDate("time", position.getFixTime()) // tmp
- .setLong("device_id", position.getDeviceId()) // tmp
- .setLong("power", 0) // tmp
- .setString("extended_info", position.getOther()) // tmp
- .executeUpdate();
- }
-
private void createDatabaseSchema() throws SQLException {
Connection connection = dataSource.getConnection();
@@ -248,7 +237,6 @@ public class DataManager {
.setObject(user)
.executeUpdate();
}
-
Context.getPermissionsManager().refresh();
}
@@ -318,12 +306,28 @@ public class DataManager {
.setString("extended_info", position.getOther()) // tmp
.executeUpdate());
}
-
+
+ // TODO: possibly remove this method
+ public void updateLatestPosition(Position position) throws SQLException {
+ QueryBuilder.create(dataSource, properties.getProperty("database.updateLatestPosition"))
+ .setObject(position)
+ .setDate("time", position.getFixTime()) // tmp
+ .setLong("device_id", position.getDeviceId()) // tmp
+ .setLong("power", 0) // tmp
+ .setString("extended_info", position.getOther()) // tmp
+ .executeUpdate();
+ }
+
+ public Collection<Position> getLatestPositions() throws SQLException {
+ return QueryBuilder.create(dataSource, properties.getProperty("database.selectLatestPositions"))
+ .executeQuery(new Position());
+ }
+
public Server getServer() throws SQLException {
return QueryBuilder.create(dataSource, properties.getProperty("database.selectServers"))
.executeQuerySingle(new Server());
}
-
+
public void updateServer(Server server) throws SQLException {
QueryBuilder.create(dataSource, properties.getProperty("database.updateServer"))
.setObject(server)