aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/GeofenceEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-15 14:22:23 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-15 14:22:23 +0500
commitf08bb5adf425269a00e760c669bdeeadc8c7e112 (patch)
treec2215abadf212d5e56def143e906683f8390f677 /src/org/traccar/events/GeofenceEventHandler.java
parent8ddcc66dc6441ce8f8a122d09872c143922fa0f0 (diff)
downloadtrackermap-server-f08bb5adf425269a00e760c669bdeeadc8c7e112.tar.gz
trackermap-server-f08bb5adf425269a00e760c669bdeeadc8c7e112.tar.bz2
trackermap-server-f08bb5adf425269a00e760c669bdeeadc8c7e112.zip
- Work only with cached devices from everywhere
- Some optimization
Diffstat (limited to 'src/org/traccar/events/GeofenceEventHandler.java')
-rw-r--r--src/org/traccar/events/GeofenceEventHandler.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/events/GeofenceEventHandler.java b/src/org/traccar/events/GeofenceEventHandler.java
index ed63b6f7d..56029fced 100644
--- a/src/org/traccar/events/GeofenceEventHandler.java
+++ b/src/org/traccar/events/GeofenceEventHandler.java
@@ -10,7 +10,6 @@ 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;
@@ -32,21 +31,20 @@ public class GeofenceEventHandler extends BaseEventHandler {
return null;
}
- Device device = dataManager.getDeviceById(position.getDeviceId());
- if (device == null) {
+ if (getDevice() == null) {
return null;
}
List<Long> currentGeofences = geofenceManager.getCurrentDeviceGeofences(position);
List<Long> oldGeofences = new ArrayList<Long>();
- if (device.getGeofenceIds() != null) {
- oldGeofences.addAll(device.getGeofenceIds());
+ if (getDevice().getGeofenceIds() != null) {
+ oldGeofences.addAll(getDevice().getGeofenceIds());
}
List<Long> newGeofences = new ArrayList<Long>(currentGeofences);
newGeofences.removeAll(oldGeofences);
oldGeofences.removeAll(currentGeofences);
- device.setGeofenceIds(currentGeofences);
+ getDevice().setGeofenceIds(currentGeofences);
Collection<Event> events = new ArrayList<>();
try {