aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/database/DeviceManager.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java
index 403953d56..a75b0616c 100644
--- a/src/org/traccar/database/DeviceManager.java
+++ b/src/org/traccar/database/DeviceManager.java
@@ -313,17 +313,24 @@ public class DeviceManager implements IdentityManager {
checkGroupCycles(group);
dataManager.addGroup(group);
groupsById.put(group.getId(), group);
+ groupsByName.put(group.getName(), group);
}
public void updateGroup(Group group) throws SQLException {
+ String oldGroupName = groupsById.get(group.getId()).getName();
checkGroupCycles(group);
dataManager.updateGroup(group);
groupsById.put(group.getId(), group);
+ if (!oldGroupName.equals(group.getName())) {
+ groupsByName.remove(oldGroupName);
+ }
+ groupsByName.put(group.getName(), group);
}
public void removeGroup(long groupId) throws SQLException {
dataManager.removeGroup(groupId);
groupsById.remove(groupId);
+ groupsByName.remove(getGroupById(groupId).getName());
}
public boolean lookupAttributeBoolean(