aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/GroupsManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-16 07:09:00 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-16 07:09:00 -0700
commitd3e83f9fa0d066e5a15fde225599cc43071c031a (patch)
tree0ed36805063b795fb5f2e30ad785a9222ef00990 /src/main/java/org/traccar/database/GroupsManager.java
parentd3fd20d4a4f7dc647e75c5a0cb962759630ed967 (diff)
downloadtrackermap-server-d3e83f9fa0d066e5a15fde225599cc43071c031a.tar.gz
trackermap-server-d3e83f9fa0d066e5a15fde225599cc43071c031a.tar.bz2
trackermap-server-d3e83f9fa0d066e5a15fde225599cc43071c031a.zip
Remove groups manager
Diffstat (limited to 'src/main/java/org/traccar/database/GroupsManager.java')
-rw-r--r--src/main/java/org/traccar/database/GroupsManager.java64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/main/java/org/traccar/database/GroupsManager.java b/src/main/java/org/traccar/database/GroupsManager.java
deleted file mode 100644
index 4df848042..000000000
--- a/src/main/java/org/traccar/database/GroupsManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2017 - 2022 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.HashSet;
-import java.util.Set;
-
-import org.traccar.model.Group;
-import org.traccar.storage.StorageException;
-
-public class GroupsManager extends BaseObjectManager<Group> {
-
- public GroupsManager(DataManager dataManager) {
- super(dataManager, Group.class);
- }
-
- private void checkGroupCycles(Group group) {
- Set<Long> groups = new HashSet<>();
- while (group != null) {
- if (groups.contains(group.getId())) {
- throw new IllegalArgumentException("Cycle in group hierarchy");
- }
- groups.add(group.getId());
- group = getById(group.getGroupId());
- }
- }
-
- @Override
- public Set<Long> getAllItems() {
- Set<Long> result = super.getAllItems();
- if (result.isEmpty()) {
- refreshItems();
- result = super.getAllItems();
- }
- return result;
- }
-
- @Override
- protected void addNewItem(Group group) {
- checkGroupCycles(group);
- super.addNewItem(group);
- }
-
- @Override
- public void updateItem(Group group) throws StorageException {
- checkGroupCycles(group);
- super.updateItem(group);
- }
-
-}