Skip to content

Commit

Permalink
Updating HashMap groupsByName in group-access methods
Browse files Browse the repository at this point in the history
  • Loading branch information
prangenberg committed Dec 6, 2016
1 parent f8b3d5c commit 7546048
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/org/traccar/database/DeviceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,24 @@ public void addGroup(Group group) throws SQLException {
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(
Expand Down

0 comments on commit 7546048

Please sign in to comment.