diff options
Diffstat (limited to 'src/main/java/org/traccar/database/DeviceManager.java')
-rw-r--r-- | src/main/java/org/traccar/database/DeviceManager.java | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java index bd100245c..81043fd7a 100644 --- a/src/main/java/org/traccar/database/DeviceManager.java +++ b/src/main/java/org/traccar/database/DeviceManager.java @@ -15,32 +15,30 @@ */ package org.traccar.database; -import java.util.Collection; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicLong; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.traccar.Main; -import org.traccar.config.Config; import org.traccar.Context; +import org.traccar.config.Config; import org.traccar.config.Keys; import org.traccar.model.Command; import org.traccar.model.Device; -import org.traccar.session.ConnectionManager; -import org.traccar.session.DeviceState; -import org.traccar.model.DeviceAccumulators; import org.traccar.model.Group; import org.traccar.model.Position; import org.traccar.model.Server; +import org.traccar.session.ConnectionManager; +import org.traccar.session.DeviceState; import org.traccar.session.cache.CacheManager; import org.traccar.storage.StorageException; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicLong; + public class DeviceManager extends BaseObjectManager<Device> implements IdentityManager { private static final Logger LOGGER = LoggerFactory.getLogger(DeviceManager.class); @@ -378,23 +376,6 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity return result; } - public void resetDeviceAccumulators(DeviceAccumulators deviceAccumulators) throws StorageException { - Position last = positions.get(deviceAccumulators.getDeviceId()); - if (last != null) { - if (deviceAccumulators.getTotalDistance() != null) { - last.getAttributes().put(Position.KEY_TOTAL_DISTANCE, deviceAccumulators.getTotalDistance()); - } - if (deviceAccumulators.getHours() != null) { - last.getAttributes().put(Position.KEY_HOURS, deviceAccumulators.getHours()); - } - getDataManager().addObject(last); - updateLatestPosition(last); - Main.getInjector().getInstance(CacheManager.class).updatePosition(last); - } else { - throw new IllegalArgumentException(); - } - } - public DeviceState getDeviceState(long deviceId) { DeviceState deviceState = deviceStates.get(deviceId); if (deviceState == null) { |