From 5f7b0b7183e7b7bb10bc3b24afc4ecf5d8654c9b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 8 Oct 2016 12:30:21 +1300 Subject: Add parameter to refresh geofences (fix #2414) --- src/org/traccar/api/resource/GeofenceResource.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/api/resource/GeofenceResource.java b/src/org/traccar/api/resource/GeofenceResource.java index 960ab813f..615606cdc 100644 --- a/src/org/traccar/api/resource/GeofenceResource.java +++ b/src/org/traccar/api/resource/GeofenceResource.java @@ -45,9 +45,13 @@ public class GeofenceResource extends BaseResource { @GET public Collection get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("groupId") long groupId, - @QueryParam("deviceId") long deviceId) throws SQLException { + @QueryParam("deviceId") long deviceId, @QueryParam("refresh") boolean refresh) throws SQLException { GeofenceManager geofenceManager = Context.getGeofenceManager(); + if (refresh) { + geofenceManager.refreshGeofences(); + } + Set result; if (all) { Context.getPermissionsManager().checkAdmin(getUserId()); @@ -57,7 +61,7 @@ public class GeofenceResource extends BaseResource { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); - result = new HashSet(geofenceManager.getUserGeofencesIds(userId)); + result = new HashSet<>(geofenceManager.getUserGeofencesIds(userId)); } if (groupId != 0) { -- cgit v1.2.3