aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-04 10:55:50 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-04 10:55:50 -0700
commit94a2a94330d82fa1c1960b8783e5061c188196e3 (patch)
tree641ae96b88b9929c817b432d5d62c86aefbf8f18 /src
parentb45b64ce97113c68ef6118665c4a8b0106249264 (diff)
downloadtrackermap-server-94a2a94330d82fa1c1960b8783e5061c188196e3.tar.gz
trackermap-server-94a2a94330d82fa1c1960b8783e5061c188196e3.tar.bz2
trackermap-server-94a2a94330d82fa1c1960b8783e5061c188196e3.zip
Rename report models
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/api/resource/ReportResource.java12
-rw-r--r--src/main/java/org/traccar/reports/Events.java6
-rw-r--r--src/main/java/org/traccar/reports/Route.java6
-rw-r--r--src/main/java/org/traccar/reports/Stops.java18
-rw-r--r--src/main/java/org/traccar/reports/Summary.java22
-rw-r--r--src/main/java/org/traccar/reports/Trips.java20
-rw-r--r--src/main/java/org/traccar/reports/common/ReportUtils.java22
-rw-r--r--src/main/java/org/traccar/reports/model/BaseReportItem.java (renamed from src/main/java/org/traccar/reports/model/BaseReport.java)2
-rw-r--r--src/main/java/org/traccar/reports/model/DeviceReportSection.java (renamed from src/main/java/org/traccar/reports/model/DeviceReport.java)2
-rw-r--r--src/main/java/org/traccar/reports/model/StopReportItem.java (renamed from src/main/java/org/traccar/reports/model/StopReport.java)2
-rw-r--r--src/main/java/org/traccar/reports/model/SummaryReportItem.java (renamed from src/main/java/org/traccar/reports/model/SummaryReport.java)2
-rw-r--r--src/main/java/org/traccar/reports/model/TripReportItem.java (renamed from src/main/java/org/traccar/reports/model/TripReport.java)2
-rw-r--r--src/test/java/org/traccar/reports/ReportUtilsTest.java82
13 files changed, 99 insertions, 99 deletions
diff --git a/src/main/java/org/traccar/api/resource/ReportResource.java b/src/main/java/org/traccar/api/resource/ReportResource.java
index a7bbe1067..5346df31b 100644
--- a/src/main/java/org/traccar/api/resource/ReportResource.java
+++ b/src/main/java/org/traccar/api/resource/ReportResource.java
@@ -46,9 +46,9 @@ import org.traccar.model.UserRestrictions;
import org.traccar.reports.Events;
import org.traccar.reports.Summary;
import org.traccar.reports.Trips;
-import org.traccar.reports.model.StopReport;
-import org.traccar.reports.model.SummaryReport;
-import org.traccar.reports.model.TripReport;
+import org.traccar.reports.model.StopReportItem;
+import org.traccar.reports.model.SummaryReportItem;
+import org.traccar.reports.model.TripReportItem;
import org.traccar.reports.Route;
import org.traccar.reports.Stops;
import org.traccar.storage.StorageException;
@@ -147,7 +147,7 @@ public class ReportResource extends BaseResource {
@Path("summary")
@GET
- public Collection<SummaryReport> getSummary(
+ public Collection<SummaryReportItem> getSummary(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") Date from, @QueryParam("to") Date to, @QueryParam("daily") boolean daily)
throws StorageException {
@@ -174,7 +174,7 @@ public class ReportResource extends BaseResource {
@Path("trips")
@GET
@Produces(MediaType.APPLICATION_JSON)
- public Collection<TripReport> getTrips(
+ public Collection<TripReportItem> getTrips(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") Date from, @QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
@@ -199,7 +199,7 @@ public class ReportResource extends BaseResource {
@Path("stops")
@GET
@Produces(MediaType.APPLICATION_JSON)
- public Collection<StopReport> getStops(
+ public Collection<StopReportItem> getStops(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") Date from, @QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
diff --git a/src/main/java/org/traccar/reports/Events.java b/src/main/java/org/traccar/reports/Events.java
index c5db305ed..130fba724 100644
--- a/src/main/java/org/traccar/reports/Events.java
+++ b/src/main/java/org/traccar/reports/Events.java
@@ -34,7 +34,7 @@ import org.traccar.model.Geofence;
import org.traccar.model.Group;
import org.traccar.model.Maintenance;
import org.traccar.reports.common.ReportUtils;
-import org.traccar.reports.model.DeviceReport;
+import org.traccar.reports.model.DeviceReportSection;
import org.traccar.storage.Storage;
import org.traccar.storage.StorageException;
@@ -73,7 +73,7 @@ public final class Events {
Collection<Long> deviceIds, Collection<Long> groupIds,
Collection<String> types, Date from, Date to) throws StorageException, IOException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<DeviceReport> devicesEvents = new ArrayList<>();
+ ArrayList<DeviceReportSection> devicesEvents = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
HashMap<Long, String> geofenceNames = new HashMap<>();
HashMap<Long, String> maintenanceNames = new HashMap<>();
@@ -107,7 +107,7 @@ public final class Events {
iterator.remove();
}
}
- DeviceReport deviceEvents = new DeviceReport();
+ DeviceReportSection deviceEvents = new DeviceReportSection();
Device device = Context.getIdentityManager().getById(deviceId);
deviceEvents.setDeviceName(device.getName());
sheetNames.add(WorkbookUtil.createSafeSheetName(deviceEvents.getDeviceName()));
diff --git a/src/main/java/org/traccar/reports/Route.java b/src/main/java/org/traccar/reports/Route.java
index d7745157a..5b8629aad 100644
--- a/src/main/java/org/traccar/reports/Route.java
+++ b/src/main/java/org/traccar/reports/Route.java
@@ -30,7 +30,7 @@ import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.Position;
import org.traccar.reports.common.ReportUtils;
-import org.traccar.reports.model.DeviceReport;
+import org.traccar.reports.model.DeviceReportSection;
import org.traccar.storage.StorageException;
public final class Route {
@@ -53,13 +53,13 @@ public final class Route {
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws StorageException, IOException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<DeviceReport> devicesRoutes = new ArrayList<>();
+ ArrayList<DeviceReportSection> devicesRoutes = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
Collection<Position> positions = Context.getDataManager()
.getPositions(deviceId, from, to);
- DeviceReport deviceRoutes = new DeviceReport();
+ DeviceReportSection deviceRoutes = new DeviceReportSection();
Device device = Context.getIdentityManager().getById(deviceId);
deviceRoutes.setDeviceName(device.getName());
sheetNames.add(WorkbookUtil.createSafeSheetName(deviceRoutes.getDeviceName()));
diff --git a/src/main/java/org/traccar/reports/Stops.java b/src/main/java/org/traccar/reports/Stops.java
index 82eb62f66..e688d53da 100644
--- a/src/main/java/org/traccar/reports/Stops.java
+++ b/src/main/java/org/traccar/reports/Stops.java
@@ -33,8 +33,8 @@ import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.reports.common.ReportUtils;
-import org.traccar.reports.model.DeviceReport;
-import org.traccar.reports.model.StopReport;
+import org.traccar.reports.model.DeviceReportSection;
+import org.traccar.reports.model.StopReportItem;
import org.traccar.storage.StorageException;
public final class Stops {
@@ -42,7 +42,7 @@ public final class Stops {
private Stops() {
}
- private static Collection<StopReport> detectStops(long deviceId, Date from, Date to) throws StorageException {
+ private static Collection<StopReportItem> detectStops(long deviceId, Date from, Date to) throws StorageException {
boolean ignoreOdometer = Context.getDeviceManager()
.lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true);
@@ -51,14 +51,14 @@ public final class Stops {
return ReportUtils.detectTripsAndStops(
identityManager, deviceManager, Context.getDataManager().getPositions(deviceId, from, to),
- Context.getTripsConfig(), ignoreOdometer, StopReport.class);
+ Context.getTripsConfig(), ignoreOdometer, StopReportItem.class);
}
- public static Collection<StopReport> getObjects(
+ public static Collection<StopReportItem> getObjects(
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws StorageException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<StopReport> result = new ArrayList<>();
+ ArrayList<StopReportItem> result = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
result.addAll(detectStops(deviceId, from, to));
@@ -70,12 +70,12 @@ public final class Stops {
OutputStream outputStream, long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws StorageException, IOException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<DeviceReport> devicesStops = new ArrayList<>();
+ ArrayList<DeviceReportSection> devicesStops = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- Collection<StopReport> stops = detectStops(deviceId, from, to);
- DeviceReport deviceStops = new DeviceReport();
+ Collection<StopReportItem> stops = detectStops(deviceId, from, to);
+ DeviceReportSection deviceStops = new DeviceReportSection();
Device device = Context.getIdentityManager().getById(deviceId);
deviceStops.setDeviceName(device.getName());
sheetNames.add(WorkbookUtil.createSafeSheetName(deviceStops.getDeviceName()));
diff --git a/src/main/java/org/traccar/reports/Summary.java b/src/main/java/org/traccar/reports/Summary.java
index 20d80a9f5..30c4cb057 100644
--- a/src/main/java/org/traccar/reports/Summary.java
+++ b/src/main/java/org/traccar/reports/Summary.java
@@ -30,7 +30,7 @@ import org.traccar.Context;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
import org.traccar.reports.common.ReportUtils;
-import org.traccar.reports.model.SummaryReport;
+import org.traccar.reports.model.SummaryReportItem;
import org.traccar.storage.StorageException;
public final class Summary {
@@ -38,8 +38,8 @@ public final class Summary {
private Summary() {
}
- private static SummaryReport calculateSummaryResult(long deviceId, Collection<Position> positions) {
- SummaryReport result = new SummaryReport();
+ private static SummaryReportItem calculateSummaryResult(long deviceId, Collection<Position> positions) {
+ SummaryReportItem result = new SummaryReportItem();
result.setDeviceId(deviceId);
result.setDeviceName(Context.getIdentityManager().getById(deviceId).getName());
if (positions != null && !positions.isEmpty()) {
@@ -97,12 +97,12 @@ public final class Summary {
return calendar.get(Calendar.DAY_OF_MONTH);
}
- private static Collection<SummaryReport> calculateSummaryResults(
+ private static Collection<SummaryReportItem> calculateSummaryResults(
long userId, long deviceId, Date from, Date to, boolean daily) throws StorageException {
ArrayList<Position> positions = new ArrayList<>(Context.getDataManager().getPositions(deviceId, from, to));
- ArrayList<SummaryReport> results = new ArrayList<>();
+ ArrayList<SummaryReportItem> results = new ArrayList<>();
if (daily && !positions.isEmpty()) {
int startIndex = 0;
int startDay = getDay(userId, positions.iterator().next().getFixTime());
@@ -122,14 +122,14 @@ public final class Summary {
return results;
}
- public static Collection<SummaryReport> getObjects(long userId, Collection<Long> deviceIds,
- Collection<Long> groupIds, Date from, Date to, boolean daily) throws StorageException {
+ public static Collection<SummaryReportItem> getObjects(long userId, Collection<Long> deviceIds,
+ Collection<Long> groupIds, Date from, Date to, boolean daily) throws StorageException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<SummaryReport> result = new ArrayList<>();
+ ArrayList<SummaryReportItem> result = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- Collection<SummaryReport> deviceResults = calculateSummaryResults(userId, deviceId, from, to, daily);
- for (SummaryReport summaryReport : deviceResults) {
+ Collection<SummaryReportItem> deviceResults = calculateSummaryResults(userId, deviceId, from, to, daily);
+ for (SummaryReportItem summaryReport : deviceResults) {
if (summaryReport.getStartTime() != null && summaryReport.getEndTime() != null) {
result.add(summaryReport);
}
@@ -142,7 +142,7 @@ public final class Summary {
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to, boolean daily) throws StorageException, IOException {
ReportUtils.checkPeriodLimit(from, to);
- Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from, to, daily);
+ Collection<SummaryReportItem> summaries = getObjects(userId, deviceIds, groupIds, from, to, daily);
String templatePath = Context.getConfig().getString("report.templatesPath",
"templates/export/");
try (InputStream inputStream = new FileInputStream(templatePath + "/summary.xlsx")) {
diff --git a/src/main/java/org/traccar/reports/Trips.java b/src/main/java/org/traccar/reports/Trips.java
index 58131debb..74e24cf2f 100644
--- a/src/main/java/org/traccar/reports/Trips.java
+++ b/src/main/java/org/traccar/reports/Trips.java
@@ -32,8 +32,8 @@ import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.reports.common.ReportUtils;
-import org.traccar.reports.model.DeviceReport;
-import org.traccar.reports.model.TripReport;
+import org.traccar.reports.model.DeviceReportSection;
+import org.traccar.reports.model.TripReportItem;
import org.traccar.storage.StorageException;
public final class Trips {
@@ -41,7 +41,7 @@ public final class Trips {
private Trips() {
}
- private static Collection<TripReport> detectTrips(long deviceId, Date from, Date to) throws StorageException {
+ private static Collection<TripReportItem> detectTrips(long deviceId, Date from, Date to) throws StorageException {
boolean ignoreOdometer = Context.getDeviceManager()
.lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true);
@@ -50,13 +50,13 @@ public final class Trips {
return ReportUtils.detectTripsAndStops(
identityManager, deviceManager, Context.getDataManager().getPositions(deviceId, from, to),
- Context.getTripsConfig(), ignoreOdometer, TripReport.class);
+ Context.getTripsConfig(), ignoreOdometer, TripReportItem.class);
}
- public static Collection<TripReport> getObjects(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
- Date from, Date to) throws StorageException {
+ public static Collection<TripReportItem> getObjects(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
+ Date from, Date to) throws StorageException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<TripReport> result = new ArrayList<>();
+ ArrayList<TripReportItem> result = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
result.addAll(detectTrips(deviceId, from, to));
@@ -68,12 +68,12 @@ public final class Trips {
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws StorageException, IOException {
ReportUtils.checkPeriodLimit(from, to);
- ArrayList<DeviceReport> devicesTrips = new ArrayList<>();
+ ArrayList<DeviceReportSection> devicesTrips = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- Collection<TripReport> trips = detectTrips(deviceId, from, to);
- DeviceReport deviceTrips = new DeviceReport();
+ Collection<TripReportItem> trips = detectTrips(deviceId, from, to);
+ DeviceReportSection deviceTrips = new DeviceReportSection();
Device device = Context.getIdentityManager().getById(deviceId);
deviceTrips.setDeviceName(device.getName());
sheetNames.add(WorkbookUtil.createSafeSheetName(deviceTrips.getDeviceName()));
diff --git a/src/main/java/org/traccar/reports/common/ReportUtils.java b/src/main/java/org/traccar/reports/common/ReportUtils.java
index 27972b453..b56b58a58 100644
--- a/src/main/java/org/traccar/reports/common/ReportUtils.java
+++ b/src/main/java/org/traccar/reports/common/ReportUtils.java
@@ -37,9 +37,9 @@ import org.traccar.session.DeviceState;
import org.traccar.model.Driver;
import org.traccar.model.Event;
import org.traccar.model.Position;
-import org.traccar.reports.model.BaseReport;
-import org.traccar.reports.model.StopReport;
-import org.traccar.reports.model.TripReport;
+import org.traccar.reports.model.BaseReportItem;
+import org.traccar.reports.model.StopReportItem;
+import org.traccar.reports.model.TripReportItem;
import org.traccar.storage.Storage;
import org.traccar.storage.StorageException;
import org.traccar.storage.query.Columns;
@@ -185,7 +185,7 @@ public final class ReportUtils {
transformer.write();
}
- private static TripReport calculateTrip(
+ private static TripReportItem calculateTrip(
IdentityManager identityManager, ArrayList<Position> positions,
int startIndex, int endIndex, boolean ignoreOdometer) {
@@ -200,7 +200,7 @@ public final class ReportUtils {
}
}
- TripReport trip = new TripReport();
+ TripReportItem trip = new TripReportItem();
long tripDuration = endTrip.getFixTime().getTime() - startTrip.getFixTime().getTime();
long deviceId = startTrip.getDeviceId();
@@ -253,14 +253,14 @@ public final class ReportUtils {
return trip;
}
- private static StopReport calculateStop(
+ private static StopReportItem calculateStop(
IdentityManager identityManager, ArrayList<Position> positions,
int startIndex, int endIndex, boolean ignoreOdometer) {
Position startStop = positions.get(startIndex);
Position endStop = positions.get(endIndex);
- StopReport stop = new StopReport();
+ StopReportItem stop = new StopReportItem();
long deviceId = startStop.getDeviceId();
stop.setDeviceId(deviceId);
@@ -302,11 +302,11 @@ public final class ReportUtils {
}
- private static <T extends BaseReport> T calculateTripOrStop(
+ private static <T extends BaseReportItem> T calculateTripOrStop(
IdentityManager identityManager, ArrayList<Position> positions,
int startIndex, int endIndex, boolean ignoreOdometer, Class<T> reportClass) {
- if (reportClass.equals(TripReport.class)) {
+ if (reportClass.equals(TripReportItem.class)) {
return (T) calculateTrip(identityManager, positions, startIndex, endIndex, ignoreOdometer);
} else {
return (T) calculateStop(identityManager, positions, startIndex, endIndex, ignoreOdometer);
@@ -333,7 +333,7 @@ public final class ReportUtils {
}
}
- public static <T extends BaseReport> Collection<T> detectTripsAndStops(
+ public static <T extends BaseReportItem> Collection<T> detectTripsAndStops(
IdentityManager identityManager, DeviceManager deviceManager,
Collection<Position> positionCollection,
TripsConfig tripsConfig, boolean ignoreOdometer, Class<T> reportClass) {
@@ -342,7 +342,7 @@ public final class ReportUtils {
ArrayList<Position> positions = new ArrayList<>(positionCollection);
if (!positions.isEmpty()) {
- boolean trips = reportClass.equals(TripReport.class);
+ boolean trips = reportClass.equals(TripReportItem.class);
MotionEventHandler motionHandler = new MotionEventHandler(identityManager, deviceManager, tripsConfig);
DeviceState deviceState = new DeviceState();
deviceState.setMotionState(isMoving(positions, 0, tripsConfig));
diff --git a/src/main/java/org/traccar/reports/model/BaseReport.java b/src/main/java/org/traccar/reports/model/BaseReportItem.java
index 928c0557d..6e270dfe3 100644
--- a/src/main/java/org/traccar/reports/model/BaseReport.java
+++ b/src/main/java/org/traccar/reports/model/BaseReportItem.java
@@ -18,7 +18,7 @@ package org.traccar.reports.model;
import java.util.Date;
-public class BaseReport {
+public class BaseReportItem {
private long deviceId;
diff --git a/src/main/java/org/traccar/reports/model/DeviceReport.java b/src/main/java/org/traccar/reports/model/DeviceReportSection.java
index 932753d15..ffc4d774f 100644
--- a/src/main/java/org/traccar/reports/model/DeviceReport.java
+++ b/src/main/java/org/traccar/reports/model/DeviceReportSection.java
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-public class DeviceReport {
+public class DeviceReportSection {
private String deviceName;
diff --git a/src/main/java/org/traccar/reports/model/StopReport.java b/src/main/java/org/traccar/reports/model/StopReportItem.java
index e20f2c503..3c35bdc21 100644
--- a/src/main/java/org/traccar/reports/model/StopReport.java
+++ b/src/main/java/org/traccar/reports/model/StopReportItem.java
@@ -16,7 +16,7 @@
*/
package org.traccar.reports.model;
-public class StopReport extends BaseReport {
+public class StopReportItem extends BaseReportItem {
private long positionId;
diff --git a/src/main/java/org/traccar/reports/model/SummaryReport.java b/src/main/java/org/traccar/reports/model/SummaryReportItem.java
index 886f8b9e2..44a15cf1d 100644
--- a/src/main/java/org/traccar/reports/model/SummaryReport.java
+++ b/src/main/java/org/traccar/reports/model/SummaryReportItem.java
@@ -16,7 +16,7 @@
*/
package org.traccar.reports.model;
-public class SummaryReport extends BaseReport {
+public class SummaryReportItem extends BaseReportItem {
private long engineHours; // milliseconds
diff --git a/src/main/java/org/traccar/reports/model/TripReport.java b/src/main/java/org/traccar/reports/model/TripReportItem.java
index 151c34bd5..332a34cca 100644
--- a/src/main/java/org/traccar/reports/model/TripReport.java
+++ b/src/main/java/org/traccar/reports/model/TripReportItem.java
@@ -16,7 +16,7 @@
*/
package org.traccar.reports.model;
-public class TripReport extends BaseReport {
+public class TripReportItem extends BaseReportItem {
private long startPositionId;
diff --git a/src/test/java/org/traccar/reports/ReportUtilsTest.java b/src/test/java/org/traccar/reports/ReportUtilsTest.java
index 247e43499..e947a9afa 100644
--- a/src/test/java/org/traccar/reports/ReportUtilsTest.java
+++ b/src/test/java/org/traccar/reports/ReportUtilsTest.java
@@ -6,8 +6,8 @@ import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Position;
import org.traccar.reports.common.ReportUtils;
-import org.traccar.reports.model.StopReport;
-import org.traccar.reports.model.TripReport;
+import org.traccar.reports.model.StopReportItem;
+import org.traccar.reports.model.TripReportItem;
import org.traccar.reports.common.TripsConfig;
import java.text.DateFormat;
@@ -93,13 +93,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 180000, 900000, false, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, TripReport.class);
+ Collection<TripReportItem> trips = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, TripReportItem.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
- TripReport itemTrip = trips.iterator().next();
+ TripReportItem itemTrip = trips.iterator().next();
assertEquals(date("2016-01-01 00:02:00.000"), itemTrip.getStartTime());
assertEquals(date("2016-01-01 00:05:00.000"), itemTrip.getEndTime());
@@ -108,15 +108,15 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(3000, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> stops = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
- Iterator<StopReport> iterator = stops.iterator();
+ Iterator<StopReportItem> iterator = stops.iterator();
- StopReport itemStop = iterator.next();
+ StopReportItem itemStop = iterator.next();
assertEquals(date("2016-01-01 00:00:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:02:00.000"), itemStop.getEndTime());
@@ -147,13 +147,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 180000, 900000, true, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, TripReport.class);
+ Collection<TripReportItem> trips = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, TripReportItem.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
- TripReport itemTrip = trips.iterator().next();
+ TripReportItem itemTrip = trips.iterator().next();
assertEquals(date("2016-01-01 00:02:00.000"), itemTrip.getStartTime());
assertEquals(date("2016-01-01 00:05:00.000"), itemTrip.getEndTime());
@@ -163,7 +163,7 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(3000, itemTrip.getDistance(), 0.01);
trips = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, TripReport.class);
+ mockIdentityManager(), null, data, tripsConfig, false, TripReportItem.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
@@ -177,15 +177,15 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(3000, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> stops = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
- Iterator<StopReport> iterator = stops.iterator();
+ Iterator<StopReportItem> iterator = stops.iterator();
- StopReport itemStop = iterator.next();
+ StopReportItem itemStop = iterator.next();
assertEquals(date("2016-01-01 00:00:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:02:00.000"), itemStop.getEndTime());
@@ -218,13 +218,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 180000, 900000, false, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, TripReport.class);
+ Collection<TripReportItem> trips = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, TripReportItem.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
- TripReport itemTrip = trips.iterator().next();
+ TripReportItem itemTrip = trips.iterator().next();
assertEquals(date("2016-01-01 00:02:00.000"), itemTrip.getStartTime());
assertEquals(date("2016-01-01 00:09:00.000"), itemTrip.getEndTime());
@@ -233,15 +233,15 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(10, itemTrip.getMaxSpeed(), 0.01);
assertEquals(7000, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> stops = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
- Iterator<StopReport> iterator = stops.iterator();
+ Iterator<StopReportItem> iterator = stops.iterator();
- StopReport itemStop = iterator.next();
+ StopReportItem itemStop = iterator.next();
assertEquals(date("2016-01-01 00:00:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:02:00.000"), itemStop.getEndTime());
@@ -268,13 +268,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> result = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(result);
assertFalse(result.isEmpty());
- StopReport itemStop = result.iterator().next();
+ StopReportItem itemStop = result.iterator().next();
assertEquals(date("2016-01-01 00:00:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:05:00.000"), itemStop.getEndTime());
@@ -295,13 +295,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> result = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(result);
assertFalse(result.isEmpty());
- StopReport itemStop = result.iterator().next();
+ StopReportItem itemStop = result.iterator().next();
assertEquals(date("2016-01-01 00:00:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:04:00.000"), itemStop.getEndTime());
@@ -322,13 +322,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> result = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(result);
assertFalse(result.isEmpty());
- StopReport itemStop = result.iterator().next();
+ StopReportItem itemStop = result.iterator().next();
assertEquals(date("2016-01-01 00:02:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:05:00.000"), itemStop.getEndTime());
@@ -349,8 +349,8 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 200000, 900000, false, false, 0.01);
- Collection<StopReport> result = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> result = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(result);
assertTrue(result.isEmpty());
@@ -372,13 +372,13 @@ public class ReportUtilsTest extends BaseTest {
TripsConfig tripsConfig = new TripsConfig(500, 200000, 200000, 900000, false, false, 0.01);
- Collection<TripReport> trips = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, TripReport.class);
+ Collection<TripReportItem> trips = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, TripReportItem.class);
assertNotNull(trips);
assertFalse(trips.isEmpty());
- TripReport itemTrip = trips.iterator().next();
+ TripReportItem itemTrip = trips.iterator().next();
assertEquals(date("2016-01-01 00:00:00.000"), itemTrip.getStartTime());
assertEquals(date("2016-01-01 00:04:00.000"), itemTrip.getEndTime());
@@ -387,13 +387,13 @@ public class ReportUtilsTest extends BaseTest {
assertEquals(7, itemTrip.getMaxSpeed(), 0.01);
assertEquals(600, itemTrip.getDistance(), 0.01);
- Collection<StopReport> stops = ReportUtils.detectTripsAndStops(
- mockIdentityManager(), null, data, tripsConfig, false, StopReport.class);
+ Collection<StopReportItem> stops = ReportUtils.detectTripsAndStops(
+ mockIdentityManager(), null, data, tripsConfig, false, StopReportItem.class);
assertNotNull(stops);
assertFalse(stops.isEmpty());
- StopReport itemStop = stops.iterator().next();
+ StopReportItem itemStop = stops.iterator().next();
assertEquals(date("2016-01-01 00:04:00.000"), itemStop.getStartTime());
assertEquals(date("2016-01-01 00:24:00.000"), itemStop.getEndTime());