aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/GeofenceResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/resource/GeofenceResource.java')
-rw-r--r--src/org/traccar/api/resource/GeofenceResource.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/api/resource/GeofenceResource.java b/src/org/traccar/api/resource/GeofenceResource.java
index 4a52822cc..c39d882b6 100644
--- a/src/org/traccar/api/resource/GeofenceResource.java
+++ b/src/org/traccar/api/resource/GeofenceResource.java
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Response;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.Set;
@Path("geofences")
@@ -85,7 +86,10 @@ public class GeofenceResource extends BaseResource {
public Response add(Geofence entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
Context.getGeofenceManager().addItem(entity);
- Context.getDataManager().linkGeofence(getUserId(), entity.getId());
+ LinkedHashMap<String, Long> link = new LinkedHashMap<>();
+ link.put("userId", getUserId());
+ link.put("geofenceId", entity.getId());
+ Context.getDataManager().linkObject(link, true);
Context.getGeofenceManager().refreshUserItems();
return Response.ok(entity).build();
}