diff options
author | Abyss777 <abyss@fox5.ru> | 2016-06-14 18:05:05 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-06-14 18:05:05 +0500 |
commit | b588b3c723cad4629dcecbce8983933f7ff2a255 (patch) | |
tree | ee1ed23c7c02ded8ca92c904e6f4f21aacfda8d8 /src/org/traccar/database/DataManager.java | |
parent | 185c0830e17b6969977026d4be27e34878bb3db9 (diff) | |
download | trackermap-server-b588b3c723cad4629dcecbce8983933f7ff2a255.tar.gz trackermap-server-b588b3c723cad4629dcecbce8983933f7ff2a255.tar.bz2 trackermap-server-b588b3c723cad4629dcecbce8983933f7ff2a255.zip |
- Overlapping geofences
- Simplified user-device link
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 30334b78b..2b09e2fb0 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -55,7 +55,7 @@ import org.traccar.model.GroupPermission; import org.traccar.model.Position; import org.traccar.model.Server; import org.traccar.model.User; -import org.traccar.model.UserDeviceGeofence; +import org.traccar.model.DeviceGeofence; import org.traccar.model.GeofencePermission; import com.zaxxer.hikari.HikariConfig; @@ -372,7 +372,6 @@ public class DataManager implements IdentityManager { Device cachedDevice = getDeviceById(device.getId()); cachedDevice.setStatus(device.getStatus()); cachedDevice.setMotion(device.getMotion()); - cachedDevice.setGeofenceId(device.getGeofenceId()); } public void removeDevice(long deviceId) throws SQLException { @@ -596,22 +595,20 @@ public class DataManager implements IdentityManager { .executeUpdate(); } - public Collection<UserDeviceGeofence> getUserDeviceGeofences() throws SQLException { - return QueryBuilder.create(dataSource, getQuery("database.selectUserDeviceGeofences")) - .executeQuery(UserDeviceGeofence.class); + public Collection<DeviceGeofence> getDeviceGeofences() throws SQLException { + return QueryBuilder.create(dataSource, getQuery("database.selectDeviceGeofences")) + .executeQuery(DeviceGeofence.class); } - public void linkUserDeviceGeofence(long userId, long deviceId, long geofenceId) throws SQLException { - QueryBuilder.create(dataSource, getQuery("database.linkUserDeviceGeofence")) - .setLong("userId", userId) + public void linkDeviceGeofence(long deviceId, long geofenceId) throws SQLException { + QueryBuilder.create(dataSource, getQuery("database.linkDeviceGeofence")) .setLong("deviceId", deviceId) .setLong("geofenceId", geofenceId) .executeUpdate(); } - public void unlinkUserDeviceGeofence(long userId, long deviceId, long geofenceId) throws SQLException { - QueryBuilder.create(dataSource, getQuery("database.unlinkUserDeviceGeofence")) - .setLong("userId", userId) + public void unlinkDeviceGeofence(long deviceId, long geofenceId) throws SQLException { + QueryBuilder.create(dataSource, getQuery("database.unlinkDeviceGeofence")) .setLong("deviceId", deviceId) .setLong("geofenceId", geofenceId) .executeUpdate(); |