aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-14 18:05:05 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-14 18:05:05 +0500
commitb588b3c723cad4629dcecbce8983933f7ff2a255 (patch)
treeee1ed23c7c02ded8ca92c904e6f4f21aacfda8d8 /src/org/traccar/api/resource
parent185c0830e17b6969977026d4be27e34878bb3db9 (diff)
downloadtrackermap-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/api/resource')
-rw-r--r--src/org/traccar/api/resource/DeviceGeofenceResource.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/org/traccar/api/resource/DeviceGeofenceResource.java b/src/org/traccar/api/resource/DeviceGeofenceResource.java
index dc7014d79..99d64292b 100644
--- a/src/org/traccar/api/resource/DeviceGeofenceResource.java
+++ b/src/org/traccar/api/resource/DeviceGeofenceResource.java
@@ -17,7 +17,7 @@ package org.traccar.api.resource;
import org.traccar.Context;
import org.traccar.api.BaseResource;
-import org.traccar.model.UserDeviceGeofence;
+import org.traccar.model.DeviceGeofence;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -35,25 +35,21 @@ import java.sql.SQLException;
public class DeviceGeofenceResource extends BaseResource {
@POST
- public Response add(UserDeviceGeofence entity) throws SQLException {
+ public Response add(DeviceGeofence entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getPermissionsManager().checkUser(getUserId(), entity.getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId());
Context.getPermissionsManager().checkGeofence(getUserId(), entity.getGeofenceId());
- Context.getDataManager().linkUserDeviceGeofence(entity.getUserId(),
- entity.getDeviceId(), entity.getGeofenceId());
+ Context.getDataManager().linkDeviceGeofence(entity.getDeviceId(), entity.getGeofenceId());
Context.getGeofenceManager().refresh();
return Response.ok(entity).build();
}
@DELETE
- public Response remove(UserDeviceGeofence entity) throws SQLException {
+ public Response remove(DeviceGeofence entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getPermissionsManager().checkUser(getUserId(), entity.getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId());
Context.getPermissionsManager().checkGeofence(getUserId(), entity.getGeofenceId());
- Context.getDataManager().unlinkUserDeviceGeofence(entity.getUserId(), entity.getDeviceId(),
- entity.getGeofenceId());
+ Context.getDataManager().unlinkDeviceGeofence(entity.getDeviceId(), entity.getGeofenceId());
Context.getGeofenceManager().refresh();
return Response.noContent().build();
}