diff options
author | Abyss777 <abyss@fox5.ru> | 2018-01-11 14:28:02 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-01-11 14:28:02 +0500 |
commit | df65b06ad4a7d072f1affb837733cebc7058c2c0 (patch) | |
tree | 4c6b5b7c4bf6e8028563661c6d7f8c6cda7ee3e9 | |
parent | df584abd8c0be33c21870dc107ea3dd0d8bc2dfd (diff) | |
download | trackermap-server-df65b06ad4a7d072f1affb837733cebc7058c2c0.tar.gz trackermap-server-df65b06ad4a7d072f1affb837733cebc7058c2c0.tar.bz2 trackermap-server-df65b06ad4a7d072f1affb837733cebc7058c2c0.zip |
Update group and device cache on group delete.
-rw-r--r-- | src/org/traccar/api/BaseObjectResource.java | 4 | ||||
-rw-r--r-- | src/org/traccar/database/DeviceManager.java | 2 | ||||
-rw-r--r-- | src/org/traccar/database/GroupsManager.java | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/api/BaseObjectResource.java b/src/org/traccar/api/BaseObjectResource.java index 806c78624..3914f8cce 100644 --- a/src/org/traccar/api/BaseObjectResource.java +++ b/src/org/traccar/api/BaseObjectResource.java @@ -141,6 +141,10 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour } } if (baseClass.equals(Group.class) || baseClass.equals(Device.class) || baseClass.equals(User.class)) { + if (baseClass.equals(Group.class)) { + Context.getGroupsManager().updateGroupCache(true); + Context.getDeviceManager().updateDeviceCache(true); + } Context.getPermissionsManager().refreshDeviceAndGroupPermissions(); if (baseClass.equals(User.class)) { Context.getPermissionsManager().refreshAllUsersPermissions(); diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java index cb410b7c0..4c329786f 100644 --- a/src/org/traccar/database/DeviceManager.java +++ b/src/org/traccar/database/DeviceManager.java @@ -65,7 +65,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity refreshLastPositions(); } - private void updateDeviceCache(boolean force) throws SQLException { + public void updateDeviceCache(boolean force) throws SQLException { long lastUpdate = devicesLastUpdate.get(); if ((force || System.currentTimeMillis() - lastUpdate > dataRefreshDelay) && devicesLastUpdate.compareAndSet(lastUpdate, System.currentTimeMillis())) { diff --git a/src/org/traccar/database/GroupsManager.java b/src/org/traccar/database/GroupsManager.java index c0456085b..c1a07a498 100644 --- a/src/org/traccar/database/GroupsManager.java +++ b/src/org/traccar/database/GroupsManager.java @@ -47,7 +47,7 @@ public class GroupsManager extends BaseObjectManager<Group> implements Managable } } - private void updateGroupCache(boolean force) throws SQLException { + public void updateGroupCache(boolean force) throws SQLException { long lastUpdate = groupsLastUpdate.get(); if ((force || System.currentTimeMillis() - lastUpdate > dataRefreshDelay) && groupsLastUpdate.compareAndSet(lastUpdate, System.currentTimeMillis())) { |