aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/database/DriversManager.java16
-rw-r--r--src/org/traccar/events/DriverEventHandler.java19
-rw-r--r--src/org/traccar/model/Event.java2
3 files changed, 6 insertions, 31 deletions
diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java
index cba2e14c1..e89d59311 100644
--- a/src/org/traccar/database/DriversManager.java
+++ b/src/org/traccar/database/DriversManager.java
@@ -210,20 +210,4 @@ public class DriversManager {
}
return drivers;
}
-
- public final boolean authorizeDriverByUniqueId(String driverUniqueId, long deviceId) {
- if (driversByUniqueId.containsKey(driverUniqueId)) {
- long chekingDriverId = getDriverByUniqueId(driverUniqueId).getId();
- Set<Long> deviceDrivers = getAllDeviceDrivers(deviceId);
- if (deviceDrivers.isEmpty()) {
- return true;
- }
- for (long driverId : deviceDrivers) {
- if (chekingDriverId == driverId) {
- return true;
- }
- }
- }
- return false;
- }
}
diff --git a/src/org/traccar/events/DriverEventHandler.java b/src/org/traccar/events/DriverEventHandler.java
index 9109373c7..eb5f2a301 100644
--- a/src/org/traccar/events/DriverEventHandler.java
+++ b/src/org/traccar/events/DriverEventHandler.java
@@ -26,12 +26,6 @@ import org.traccar.model.Position;
public class DriverEventHandler extends BaseEventHandler {
- private boolean notRepeat;
-
- public DriverEventHandler() {
- notRepeat = Context.getConfig().getBoolean("event.driver.notRepeat");
- }
-
@Override
protected Collection<Event> analyzePosition(Position position) {
if (!Context.getIdentityManager().isLatestPosition(position)) {
@@ -40,15 +34,12 @@ public class DriverEventHandler extends BaseEventHandler {
String driverUniqueId = position.getString(Position.KEY_DRIVER_UNIQUE_ID);
if (driverUniqueId != null) {
String oldDriverUniqueId = null;
- if (notRepeat) {
- Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
- if (lastPosition != null) {
- oldDriverUniqueId = lastPosition.getString(Position.KEY_DRIVER_UNIQUE_ID);
- }
+ Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
+ if (lastPosition != null) {
+ oldDriverUniqueId = lastPosition.getString(Position.KEY_DRIVER_UNIQUE_ID);
}
- if (!driverUniqueId.equals(oldDriverUniqueId)
- && !Context.getDriversManager().authorizeDriverByUniqueId(driverUniqueId, position.getDeviceId())) {
- Event event = new Event(Event.TYPE_DRIVER_UNAUTHORIZED, position.getDeviceId(), position.getId());
+ if (!driverUniqueId.equals(oldDriverUniqueId)) {
+ Event event = new Event(Event.TYPE_DRIVER_CHANGED, position.getDeviceId(), position.getId());
event.set(Position.KEY_DRIVER_UNIQUE_ID, driverUniqueId);
return Collections.singleton(event);
}
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java
index dd5358f75..2d836abeb 100644
--- a/src/org/traccar/model/Event.java
+++ b/src/org/traccar/model/Event.java
@@ -61,7 +61,7 @@ public class Event extends Message {
public static final String TYPE_TEXT_MESSAGE = "textMessage";
- public static final String TYPE_DRIVER_UNAUTHORIZED = "driverUnauthorized";
+ public static final String TYPE_DRIVER_CHANGED = "driverChanged";
private Date serverTime;