aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-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
12 files changed, 58 insertions, 58 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;