aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/GeofenceEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-07-28 11:42:10 +0500
committerAbyss777 <abyss@fox5.ru>2016-07-28 11:42:10 +0500
commitf7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7 (patch)
treed7629335bf8cc14ca4531f198713b4c69b53e6a7 /src/org/traccar/events/GeofenceEventHandler.java
parentb00b35b33095110cef46c8a255686cad87ac7150 (diff)
downloadtrackermap-server-f7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7.tar.gz
trackermap-server-f7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7.tar.bz2
trackermap-server-f7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7.zip
Removed suppressing repeated events during analyzing.
Diffstat (limited to 'src/org/traccar/events/GeofenceEventHandler.java')
-rw-r--r--src/org/traccar/events/GeofenceEventHandler.java37
1 files changed, 8 insertions, 29 deletions
diff --git a/src/org/traccar/events/GeofenceEventHandler.java b/src/org/traccar/events/GeofenceEventHandler.java
index a9bed6f82..a0291dcfa 100644
--- a/src/org/traccar/events/GeofenceEventHandler.java
+++ b/src/org/traccar/events/GeofenceEventHandler.java
@@ -15,30 +15,23 @@
*/
package org.traccar.events;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.traccar.BaseEventHandler;
import org.traccar.Context;
-import org.traccar.database.DataManager;
import org.traccar.database.GeofenceManager;
-import org.traccar.helper.Log;
import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
public class GeofenceEventHandler extends BaseEventHandler {
- private int suppressRepeated;
private GeofenceManager geofenceManager;
- private DataManager dataManager;
public GeofenceEventHandler() {
- suppressRepeated = Context.getConfig().getInteger("event.suppressRepeated", 60);
geofenceManager = Context.getGeofenceManager();
- dataManager = Context.getDataManager();
}
@Override
@@ -63,29 +56,15 @@ public class GeofenceEventHandler extends BaseEventHandler {
device.setGeofenceIds(currentGeofences);
Collection<Event> events = new ArrayList<>();
- try {
- if (dataManager.getLastEvents(position.getDeviceId(),
- Event.TYPE_GEOFENCE_ENTER, suppressRepeated).isEmpty()) {
- for (long geofenceId : newGeofences) {
- Event event = new Event(Event.TYPE_GEOFENCE_ENTER, position.getDeviceId(), position.getId());
- event.setGeofenceId(geofenceId);
- events.add(event);
- }
- }
- } catch (SQLException error) {
- Log.warning(error);
+ for (long geofenceId : newGeofences) {
+ Event event = new Event(Event.TYPE_GEOFENCE_ENTER, position.getDeviceId(), position.getId());
+ event.setGeofenceId(geofenceId);
+ events.add(event);
}
- try {
- if (dataManager.getLastEvents(position.getDeviceId(),
- Event.TYPE_GEOFENCE_EXIT, suppressRepeated).isEmpty()) {
- for (long geofenceId : oldGeofences) {
- Event event = new Event(Event.TYPE_GEOFENCE_EXIT, position.getDeviceId(), position.getId());
- event.setGeofenceId(geofenceId);
- events.add(event);
- }
- }
- } catch (SQLException error) {
- Log.warning(error);
+ for (long geofenceId : oldGeofences) {
+ Event event = new Event(Event.TYPE_GEOFENCE_EXIT, position.getDeviceId(), position.getId());
+ event.setGeofenceId(geofenceId);
+ events.add(event);
}
return events;
}