aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/GeofenceEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-16 11:23:41 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-16 11:23:41 +0500
commit1b8e05ce34ff7c576c29e383601f74cb8c01d728 (patch)
tree72356a7e9384d46aa2ed31e08765a893abe7c8b8 /src/org/traccar/events/GeofenceEventHandler.java
parent3f0f6c1f6ec4665783ec62a65f8f30a33f1d2152 (diff)
downloadtrackermap-server-1b8e05ce34ff7c576c29e383601f74cb8c01d728.tar.gz
trackermap-server-1b8e05ce34ff7c576c29e383601f74cb8c01d728.tar.bz2
trackermap-server-1b8e05ce34ff7c576c29e383601f74cb8c01d728.zip
Moved variables from parent to inheritor
Diffstat (limited to 'src/org/traccar/events/GeofenceEventHandler.java')
-rw-r--r--src/org/traccar/events/GeofenceEventHandler.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/events/GeofenceEventHandler.java b/src/org/traccar/events/GeofenceEventHandler.java
index 7d24c4efe..e9a4a640f 100644
--- a/src/org/traccar/events/GeofenceEventHandler.java
+++ b/src/org/traccar/events/GeofenceEventHandler.java
@@ -25,6 +25,7 @@ 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;
@@ -42,24 +43,24 @@ public class GeofenceEventHandler extends BaseEventHandler {
@Override
protected Collection<Event> analyzePosition(Position position) {
- if (!isLastPosition() || !position.getValid()) {
+ Device device = dataManager.getDeviceById(position.getDeviceId());
+ if (device == null) {
return null;
}
-
- if (getDevice() == null) {
+ if (position.getId() != device.getPositionId() || !position.getValid()) {
return null;
}
List<Long> currentGeofences = geofenceManager.getCurrentDeviceGeofences(position);
List<Long> oldGeofences = new ArrayList<Long>();
- if (getDevice().getGeofenceIds() != null) {
- oldGeofences.addAll(getDevice().getGeofenceIds());
+ if (device.getGeofenceIds() != null) {
+ oldGeofences.addAll(device.getGeofenceIds());
}
List<Long> newGeofences = new ArrayList<Long>(currentGeofences);
newGeofences.removeAll(oldGeofences);
oldGeofences.removeAll(currentGeofences);
- getDevice().setGeofenceIds(currentGeofences);
+ device.setGeofenceIds(currentGeofences);
Collection<Event> events = new ArrayList<>();
try {