aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java4
-rw-r--r--src/main/java/org/traccar/database/GroupsManager.java20
-rw-r--r--src/main/java/org/traccar/database/ManagableObjects.java27
-rw-r--r--src/main/java/org/traccar/database/SimpleObjectManager.java5
4 files changed, 3 insertions, 53 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index a9b8454eb..a14fd7022 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -38,7 +38,7 @@ import org.traccar.model.Position;
import org.traccar.model.Server;
import org.traccar.storage.StorageException;
-public class DeviceManager extends BaseObjectManager<Device> implements IdentityManager, ManagableObjects {
+public class DeviceManager extends BaseObjectManager<Device> implements IdentityManager {
private static final Logger LOGGER = LoggerFactory.getLogger(DeviceManager.class);
@@ -162,7 +162,6 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
return Context.getPermissionsManager().getDevicePermissions(userId);
}
- @Override
public Set<Long> getUserItems(long userId) {
if (Context.getPermissionsManager() != null) {
Set<Long> result = new HashSet<>();
@@ -186,7 +185,6 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
return result;
}
- @Override
public Set<Long> getManagedItems(long userId) {
Set<Long> result = new HashSet<>(getUserItems(userId));
for (long managedUserId : Context.getUsersManager().getUserItems(userId)) {
diff --git a/src/main/java/org/traccar/database/GroupsManager.java b/src/main/java/org/traccar/database/GroupsManager.java
index dafddc0cc..9322dd80a 100644
--- a/src/main/java/org/traccar/database/GroupsManager.java
+++ b/src/main/java/org/traccar/database/GroupsManager.java
@@ -23,7 +23,7 @@ import org.traccar.Context;
import org.traccar.model.Group;
import org.traccar.storage.StorageException;
-public class GroupsManager extends BaseObjectManager<Group> implements ManagableObjects {
+public class GroupsManager extends BaseObjectManager<Group> {
public GroupsManager(DataManager dataManager) {
super(dataManager, Group.class);
@@ -62,22 +62,4 @@ public class GroupsManager extends BaseObjectManager<Group> implements Managable
super.updateItem(group);
}
- @Override
- public Set<Long> getUserItems(long userId) {
- if (Context.getPermissionsManager() != null) {
- return Context.getPermissionsManager().getGroupPermissions(userId);
- } else {
- return new HashSet<>();
- }
- }
-
- @Override
- public Set<Long> getManagedItems(long userId) {
- Set<Long> result = getUserItems(userId);
- for (long managedUserId : Context.getUsersManager().getUserItems(userId)) {
- result.addAll(getUserItems(managedUserId));
- }
- return result;
- }
-
}
diff --git a/src/main/java/org/traccar/database/ManagableObjects.java b/src/main/java/org/traccar/database/ManagableObjects.java
deleted file mode 100644
index ec9549493..000000000
--- a/src/main/java/org/traccar/database/ManagableObjects.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.database;
-
-import java.util.Set;
-
-public interface ManagableObjects {
-
- Set<Long> getUserItems(long userId);
-
- Set<Long> getManagedItems(long userId);
-
-}
diff --git a/src/main/java/org/traccar/database/SimpleObjectManager.java b/src/main/java/org/traccar/database/SimpleObjectManager.java
index 78701720f..74bbc054f 100644
--- a/src/main/java/org/traccar/database/SimpleObjectManager.java
+++ b/src/main/java/org/traccar/database/SimpleObjectManager.java
@@ -29,8 +29,7 @@ import org.traccar.model.Permission;
import org.traccar.model.User;
import org.traccar.storage.StorageException;
-public abstract class SimpleObjectManager<T extends BaseModel> extends BaseObjectManager<T>
- implements ManagableObjects {
+public abstract class SimpleObjectManager<T extends BaseModel> extends BaseObjectManager<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleObjectManager.class);
@@ -40,7 +39,6 @@ public abstract class SimpleObjectManager<T extends BaseModel> extends BaseObjec
super(dataManager, baseClass);
}
- @Override
public final Set<Long> getUserItems(long userId) {
try {
readLock();
@@ -55,7 +53,6 @@ public abstract class SimpleObjectManager<T extends BaseModel> extends BaseObjec
}
}
- @Override
public Set<Long> getManagedItems(long userId) {
Set<Long> result = getUserItems(userId);
for (long managedUserId : Context.getUsersManager().getUserItems(userId)) {