aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java43
-rw-r--r--src/main/java/org/traccar/database/PermissionsManager.java11
2 files changed, 12 insertions, 42 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) {
diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java
index 4ac27c717..9d1e5aadf 100644
--- a/src/main/java/org/traccar/database/PermissionsManager.java
+++ b/src/main/java/org/traccar/database/PermissionsManager.java
@@ -179,17 +179,6 @@ public class PermissionsManager {
return user != null && user.getAdministrator();
}
- public boolean getUserManager(long userId) {
- User user = getUser(userId);
- return user != null && user.getUserLimit() != 0;
- }
-
- public void checkManager(long userId) throws SecurityException {
- if (!getUserManager(userId)) {
- throw new SecurityException("Manager access required");
- }
- }
-
public void refreshPermissions(Permission permission) {
if (permission.getOwnerClass().equals(User.class)) {
if (permission.getPropertyClass().equals(Device.class)