aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-06 11:45:05 +0100
committerPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-06 11:45:05 +0100
commit7546048a58c16ad083d732aacd2af2d4a200b47c (patch)
tree11e954b71b4015b2e2e0aa8f5439ef03c2adc813
parentf8b3d5cc7286726e7719ddcd4db8d8456aa6e01f (diff)
downloadtrackermap-server-7546048a58c16ad083d732aacd2af2d4a200b47c.tar.gz
trackermap-server-7546048a58c16ad083d732aacd2af2d4a200b47c.tar.bz2
trackermap-server-7546048a58c16ad083d732aacd2af2d4a200b47c.zip
Updating HashMap groupsByName in group-access methods
-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(