diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-23 18:29:36 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-23 18:29:36 +1200 |
commit | 4b2372336d0496c85befe099914434e5b68f05b3 (patch) | |
tree | 798de625a07c18287e829b3a037cacee179ebcff /src/org/traccar/database/DeviceManager.java | |
parent | ba82047a492be54545961716814584d8880d28ae (diff) | |
parent | 5a65c0d6be8ffc2db0ffdb0c35ecedfb2b3750c7 (diff) | |
download | trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.tar.gz trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.tar.bz2 trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.zip |
Merge pull request #3373 from Abyss777/refactor_managers
Refactor managers, permissions etc
Diffstat (limited to 'src/org/traccar/database/DeviceManager.java')
-rw-r--r-- | src/org/traccar/database/DeviceManager.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java index f2a2dd565..ba360f165 100644 --- a/src/org/traccar/database/DeviceManager.java +++ b/src/org/traccar/database/DeviceManager.java @@ -85,7 +85,7 @@ public class DeviceManager implements IdentityManager { if ((force || System.currentTimeMillis() - lastUpdate > dataRefreshDelay) && devicesLastUpdate.compareAndSet(lastUpdate, System.currentTimeMillis())) { GeofenceManager geofenceManager = Context.getGeofenceManager(); - Collection<Device> databaseDevices = dataManager.getAllDevices(); + Collection<Device> databaseDevices = dataManager.getObjects(Device.class); if (devicesById == null) { devicesById = new ConcurrentHashMap<>(databaseDevices.size()); } @@ -199,7 +199,7 @@ public class DeviceManager implements IdentityManager { } public void addDevice(Device device) throws SQLException { - dataManager.addDevice(device); + dataManager.addObject(device); devicesById.put(device.getId(), device); devicesByUniqueId.put(device.getUniqueId(), device); @@ -209,7 +209,7 @@ public class DeviceManager implements IdentityManager { } public void updateDevice(Device device) throws SQLException { - dataManager.updateDevice(device); + dataManager.updateObject(device); devicesById.put(device.getId(), device); devicesByUniqueId.put(device.getUniqueId(), device); @@ -227,7 +227,7 @@ public class DeviceManager implements IdentityManager { } public void removeDevice(long deviceId) throws SQLException { - dataManager.removeDevice(deviceId); + dataManager.removeObject(Device.class, deviceId); if (devicesById.containsKey(deviceId)) { String deviceUniqueId = devicesById.get(deviceId).getUniqueId(); @@ -289,7 +289,7 @@ public class DeviceManager implements IdentityManager { long lastUpdate = groupsLastUpdate.get(); if ((force || System.currentTimeMillis() - lastUpdate > dataRefreshDelay) && groupsLastUpdate.compareAndSet(lastUpdate, System.currentTimeMillis())) { - Collection<Group> databaseGroups = dataManager.getAllGroups(); + Collection<Group> databaseGroups = dataManager.getObjects(Group.class); if (groupsById == null) { groupsById = new ConcurrentHashMap<>(databaseGroups.size()); } @@ -359,18 +359,18 @@ public class DeviceManager implements IdentityManager { public void addGroup(Group group) throws SQLException { checkGroupCycles(group); - dataManager.addGroup(group); + dataManager.addObject(group); groupsById.put(group.getId(), group); } public void updateGroup(Group group) throws SQLException { checkGroupCycles(group); - dataManager.updateGroup(group); + dataManager.updateObject(group); groupsById.put(group.getId(), group); } public void removeGroup(long groupId) throws SQLException { - dataManager.removeGroup(groupId); + dataManager.removeObject(Group.class, groupId); groupsById.remove(groupId); } |