aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-30 14:59:09 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-30 14:59:09 -0700
commit85f04c6d30e11d8b748ea2b431dbeffce1126a65 (patch)
treebef590914d97fb830cf5e15bfea15d021f182af3 /src/main/java/org/traccar
parent0202dbf7258df8cbe8168ddc985e774b1cadf964 (diff)
downloadtrackermap-server-85f04c6d30e11d8b748ea2b431dbeffce1126a65.tar.gz
trackermap-server-85f04c6d30e11d8b748ea2b431dbeffce1126a65.tar.bz2
trackermap-server-85f04c6d30e11d8b748ea2b431dbeffce1126a65.zip
Remove test identity manager
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/reports/ReportUtils.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/org/traccar/reports/ReportUtils.java b/src/main/java/org/traccar/reports/ReportUtils.java
index 23646c4d6..dd1ef478f 100644
--- a/src/main/java/org/traccar/reports/ReportUtils.java
+++ b/src/main/java/org/traccar/reports/ReportUtils.java
@@ -171,7 +171,8 @@ public final class ReportUtils {
}
private static TripReport calculateTrip(
- ArrayList<Position> positions, int startIndex, int endIndex, boolean ignoreOdometer) {
+ IdentityManager identityManager, ArrayList<Position> positions,
+ int startIndex, int endIndex, boolean ignoreOdometer) {
Position startTrip = positions.get(startIndex);
Position endTrip = positions.get(endIndex);
@@ -189,7 +190,7 @@ public final class ReportUtils {
long tripDuration = endTrip.getFixTime().getTime() - startTrip.getFixTime().getTime();
long deviceId = startTrip.getDeviceId();
trip.setDeviceId(deviceId);
- trip.setDeviceName(Context.getIdentityManager().getById(deviceId).getName());
+ trip.setDeviceName(identityManager.getById(deviceId).getName());
trip.setStartPositionId(startTrip.getId());
trip.setStartLat(startTrip.getLatitude());
@@ -238,7 +239,8 @@ public final class ReportUtils {
}
private static StopReport calculateStop(
- ArrayList<Position> positions, int startIndex, int endIndex, boolean ignoreOdometer) {
+ IdentityManager identityManager, ArrayList<Position> positions,
+ int startIndex, int endIndex, boolean ignoreOdometer) {
Position startStop = positions.get(startIndex);
Position endStop = positions.get(endIndex);
@@ -247,7 +249,7 @@ public final class ReportUtils {
long deviceId = startStop.getDeviceId();
stop.setDeviceId(deviceId);
- stop.setDeviceName(Context.getIdentityManager().getById(deviceId).getName());
+ stop.setDeviceName(identityManager.getById(deviceId).getName());
stop.setPositionId(startStop.getId());
stop.setLatitude(startStop.getLatitude());
@@ -286,12 +288,13 @@ public final class ReportUtils {
}
private static <T extends BaseReport> T calculateTripOrStop(
- ArrayList<Position> positions, int startIndex, int endIndex, boolean ignoreOdometer, Class<T> reportClass) {
+ IdentityManager identityManager, ArrayList<Position> positions,
+ int startIndex, int endIndex, boolean ignoreOdometer, Class<T> reportClass) {
if (reportClass.equals(TripReport.class)) {
- return (T) calculateTrip(positions, startIndex, endIndex, ignoreOdometer);
+ return (T) calculateTrip(identityManager, positions, startIndex, endIndex, ignoreOdometer);
} else {
- return (T) calculateStop(positions, startIndex, endIndex, ignoreOdometer);
+ return (T) calculateStop(identityManager, positions, startIndex, endIndex, ignoreOdometer);
}
}
@@ -351,15 +354,15 @@ public final class ReportUtils {
}
if (startEventIndex != -1 && startNoEventIndex != -1 && event != null
&& trips != deviceState.getMotionState()) {
- result.add(calculateTripOrStop(positions, startEventIndex, startNoEventIndex,
- ignoreOdometer, reportClass));
+ result.add(calculateTripOrStop(identityManager, positions,
+ startEventIndex, startNoEventIndex, ignoreOdometer, reportClass));
startEventIndex = -1;
}
}
if (startEventIndex != -1 && (startNoEventIndex != -1 || !trips)) {
- result.add(calculateTripOrStop(positions, startEventIndex,
- startNoEventIndex != -1 ? startNoEventIndex : positions.size() - 1,
- ignoreOdometer, reportClass));
+ result.add(calculateTripOrStop(identityManager, positions,
+ startEventIndex, startNoEventIndex != -1 ? startNoEventIndex : positions.size() - 1,
+ ignoreOdometer, reportClass));
}
}