diff options
author | Abyss777 <abyss@fox5.ru> | 2016-10-22 17:33:12 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-10-22 17:33:12 +0500 |
commit | 9eea2f26f64a3026f61f9deb13d1deac00cddcd6 (patch) | |
tree | 65676a07739153907fb4f4d42d4855e3a373c459 /src/org/traccar/database | |
parent | c7b678d8b9fa60849b8ff8cc480c60f2039c9598 (diff) | |
download | traccar-server-9eea2f26f64a3026f61f9deb13d1deac00cddcd6.tar.gz traccar-server-9eea2f26f64a3026f61f9deb13d1deac00cddcd6.tar.bz2 traccar-server-9eea2f26f64a3026f61f9deb13d1deac00cddcd6.zip |
Implement reset total distance API
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r-- | src/org/traccar/database/DeviceManager.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java index f32c7edd2..7d16c1c32 100644 --- a/src/org/traccar/database/DeviceManager.java +++ b/src/org/traccar/database/DeviceManager.java @@ -30,6 +30,7 @@ import org.traccar.Config; import org.traccar.Context; import org.traccar.helper.Log; import org.traccar.model.Device; +import org.traccar.model.DeviceTotalDistance; import org.traccar.model.Group; import org.traccar.model.Position; import org.traccar.model.Server; @@ -428,4 +429,15 @@ public class DeviceManager implements IdentityManager { } return result; } + + public void resetTotalDistance(DeviceTotalDistance deviceTotalDistance) throws SQLException { + Position last = positions.get(deviceTotalDistance.getDeviceId()); + if (last != null) { + last.getAttributes().put(Position.KEY_TOTAL_DISTANCE, deviceTotalDistance.getTotalDistance()); + dataManager.addPosition(last); + updateLatestPosition(last); + } else { + throw new IllegalArgumentException(); + } + } } |