aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-14 08:56:45 +1200
committerGitHub <noreply@github.com>2016-07-14 08:56:45 +1200
commit82fd4d09aa7ac37bf2eb1857b12efbd3bc773a94 (patch)
tree59e55fd0c4f9bffa4c140982c7f040bb8636ad9b /src/org/traccar/database
parentd154cb277fe2f7b5dfe6bdaee1a013729bbf22eb (diff)
parent7ce8c4ecf82828920926f81f55cbc4fb833ef259 (diff)
downloadtrackermap-server-82fd4d09aa7ac37bf2eb1857b12efbd3bc773a94.tar.gz
trackermap-server-82fd4d09aa7ac37bf2eb1857b12efbd3bc773a94.tar.bz2
trackermap-server-82fd4d09aa7ac37bf2eb1857b12efbd3bc773a94.zip
Merge pull request #2110 from Abyss777/master
Added possibility to forward all events
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java14
-rw-r--r--src/org/traccar/database/NotificationManager.java3
2 files changed, 12 insertions, 5 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index b3f24383f..0dc3c5c52 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -401,9 +401,11 @@ public class DataManager implements IdentityManager {
QueryBuilder.create(dataSource, getQuery("database.updateDeviceStatus"))
.setObject(device)
.executeUpdate();
- Device cachedDevice = getDeviceById(device.getId());
- cachedDevice.setStatus(device.getStatus());
- cachedDevice.setMotion(device.getMotion());
+ if (devicesById.containsKey(device.getId())) {
+ Device cachedDevice = devicesById.get(device.getId());
+ cachedDevice.setStatus(device.getStatus());
+ cachedDevice.setMotion(device.getMotion());
+ }
}
public void removeDevice(long deviceId) throws SQLException {
@@ -512,8 +514,10 @@ public class DataManager implements IdentityManager {
.setDate("now", new Date())
.setObject(position)
.executeUpdate();
- Device device = getDeviceById(position.getDeviceId());
- device.setPositionId(position.getId());
+ if (devicesById.containsKey(position.getDeviceId())) {
+ Device cachedDevice = devicesById.get(position.getDeviceId());
+ cachedDevice.setPositionId(position.getId());
+ }
}
public Collection<Position> getLatestPositions() throws SQLException {
diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java
index e618d7ed3..911c5d2dc 100644
--- a/src/org/traccar/database/NotificationManager.java
+++ b/src/org/traccar/database/NotificationManager.java
@@ -68,6 +68,9 @@ public class NotificationManager {
}
}
}
+ if (Context.getEventForvarder() != null) {
+ Context.getEventForvarder().forwardEvent(event, position);
+ }
}
public void updateEvents(Collection<Event> events, Position position) {