diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-04-29 07:26:44 +0000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-04-29 07:26:44 +0000 |
commit | 933639c9ae85204011b40540584bc2c2058e4a52 (patch) | |
tree | 3f6eaeff9e245888fc26349d95d4b572e2aefd7f /src/org/traccar/model/DatabaseDataManager.java | |
parent | 3291206a50732601dedec5aa4982a8d6db87e16e (diff) | |
download | trackermap-server-933639c9ae85204011b40540584bc2c2058e4a52.tar.gz trackermap-server-933639c9ae85204011b40540584bc2c2058e4a52.tar.bz2 trackermap-server-933639c9ae85204011b40540584bc2c2058e4a52.zip |
Diffstat (limited to 'src/org/traccar/model/DatabaseDataManager.java')
-rw-r--r-- | src/org/traccar/model/DatabaseDataManager.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java index 8e12f177c..7d90ac194 100644 --- a/src/org/traccar/model/DatabaseDataManager.java +++ b/src/org/traccar/model/DatabaseDataManager.java @@ -77,9 +77,9 @@ public class DatabaseDataManager implements DataManager { queryAddPosition = new NamedParameterStatement(connection, query); } - public synchronized List getDevices() throws SQLException { + public synchronized List<Device> getDevices() throws SQLException { - List deviceList = new LinkedList(); + List<Device> deviceList = new LinkedList(); queryGetDevices.prepare(); ResultSet result = queryGetDevices.executeQuery(); @@ -101,9 +101,8 @@ public class DatabaseDataManager implements DataManager { if ((devices == null) || (Calendar.getInstance().getTimeInMillis() - devicesLastUpdate.getTimeInMillis() > devicesRefreshDelay)) { devices = new HashMap(); - List deviceList = getDevices(); - for (Object device: deviceList) { - devices.put(((Device) device).getImei(), device); + for (Device device: getDevices()) { + devices.put(device.getImei(), device); } devicesLastUpdate = Calendar.getInstance(); } @@ -111,7 +110,23 @@ public class DatabaseDataManager implements DataManager { return (Device) devices.get(imei); } - public List getPositions(Long deviceId) { return null; } // TODO: implement + public List<Position> getPositions(Long deviceId) { // TODO: implement + + List<Position> positionList = new LinkedList(); + + Position p = new Position(); + p.setDeviceId(new Long(1)); + p.setTime(new Date()); + p.setValid(true); + p.setLatitude(1.0); + p.setLongitude(1.0); + p.setSpeed(1.0); + p.setCourse(1.0); + + positionList.add(p); + + return positionList; + } public synchronized void addPosition(Position position) throws SQLException { |