aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/reports')
-rw-r--r--src/org/traccar/reports/Events.java6
-rw-r--r--src/org/traccar/reports/ReportUtils.java2
-rw-r--r--src/org/traccar/reports/Route.java6
-rw-r--r--src/org/traccar/reports/Summary.java (renamed from src/org/traccar/reports/General.java)18
-rw-r--r--src/org/traccar/reports/model/SummaryReport.java (renamed from src/org/traccar/reports/model/GeneralReport.java)8
5 files changed, 20 insertions, 20 deletions
diff --git a/src/org/traccar/reports/Events.java b/src/org/traccar/reports/Events.java
index de4354371..9e14bd3db 100644
--- a/src/org/traccar/reports/Events.java
+++ b/src/org/traccar/reports/Events.java
@@ -20,7 +20,7 @@ public final class Events {
public static String getJson(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Collection<String> types, Date from, Date to) throws SQLException {
JsonObjectBuilder json = Json.createObjectBuilder();
- for (long deviceId: ReportUtils.getReportedDevices(deviceIds, groupIds)) {
+ for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
for (String type : types) {
json.add(String.valueOf(deviceId), JsonConverter.arrayToJson(Context.getDataManager()
@@ -34,12 +34,12 @@ public final class Events {
Collection<String> types, Date from, Date to) throws SQLException {
CsvBuilder csv = new CsvBuilder();
csv.addHeaderLine(new Event());
- for (long deviceId: ReportUtils.getReportedDevices(deviceIds, groupIds)) {
+ for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
for (String type : types) {
csv.addArray(Context.getDataManager().getEvents(deviceId, type, from, to));
}
}
- return csv.get();
+ return csv.build();
}
}
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index c4c63e525..5041871f7 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -10,7 +10,7 @@ public final class ReportUtils {
private ReportUtils() {
}
- public static Collection<Long> getReportedDevices(Collection<Long> deviceIds, Collection<Long> groupIds) {
+ public static Collection<Long> getDeviceList(Collection<Long> deviceIds, Collection<Long> groupIds) {
Collection<Long> result = new ArrayList<>();
result.addAll(deviceIds);
for (long groupId : groupIds) {
diff --git a/src/org/traccar/reports/Route.java b/src/org/traccar/reports/Route.java
index a77e3c5ff..7abe5c194 100644
--- a/src/org/traccar/reports/Route.java
+++ b/src/org/traccar/reports/Route.java
@@ -20,7 +20,7 @@ public final class Route {
public static String getJson(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws SQLException {
JsonObjectBuilder json = Json.createObjectBuilder();
- for (long deviceId: ReportUtils.getReportedDevices(deviceIds, groupIds)) {
+ for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
json.add(String.valueOf(deviceId), JsonConverter.arrayToJson(Context.getDataManager()
.getPositions(deviceId, from, to)));
@@ -32,10 +32,10 @@ public final class Route {
Date from, Date to) throws SQLException {
CsvBuilder csv = new CsvBuilder();
csv.addHeaderLine(new Position());
- for (long deviceId: ReportUtils.getReportedDevices(deviceIds, groupIds)) {
+ for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
csv.addArray(Context.getDataManager().getPositions(deviceId, from, to));
}
- return csv.get();
+ return csv.build();
}
}
diff --git a/src/org/traccar/reports/General.java b/src/org/traccar/reports/Summary.java
index 8a2b3940b..474562002 100644
--- a/src/org/traccar/reports/General.java
+++ b/src/org/traccar/reports/Summary.java
@@ -12,17 +12,17 @@ import javax.json.JsonObjectBuilder;
import org.traccar.Context;
import org.traccar.helper.DistanceCalculator;
import org.traccar.model.Position;
-import org.traccar.reports.model.GeneralReport;
+import org.traccar.reports.model.SummaryReport;
import org.traccar.web.CsvBuilder;
import org.traccar.web.JsonConverter;
-public final class General {
+public final class Summary {
- private General() {
+ private Summary() {
}
- private static GeneralReport calculateGeneralResult(long deviceId, Date from, Date to) throws SQLException {
- GeneralReport result = new GeneralReport();
+ private static SummaryReport calculateGeneralResult(long deviceId, Date from, Date to) throws SQLException {
+ SummaryReport result = new SummaryReport();
Collection<Position> positions = Context.getDataManager().getPositions(deviceId, from, to);
if (positions != null && !positions.isEmpty()) {
result.setDeviceName(Context.getDeviceManager().getDeviceById(deviceId).getName());
@@ -46,7 +46,7 @@ public final class General {
public static String getJson(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws SQLException {
JsonObjectBuilder json = Json.createObjectBuilder();
- for (long deviceId: ReportUtils.getReportedDevices(deviceIds, groupIds)) {
+ for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
json.add(String.valueOf(deviceId), JsonConverter.objectToJson(calculateGeneralResult(deviceId, from, to)));
}
@@ -56,11 +56,11 @@ public final class General {
public static String getCsv(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws SQLException {
CsvBuilder csv = new CsvBuilder();
- csv.addHeaderLine(new GeneralReport());
- for (long deviceId: ReportUtils.getReportedDevices(deviceIds, groupIds)) {
+ csv.addHeaderLine(new SummaryReport());
+ for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
csv.addLine(calculateGeneralResult(deviceId, from, to));
}
- return csv.get();
+ return csv.build();
}
}
diff --git a/src/org/traccar/reports/model/GeneralReport.java b/src/org/traccar/reports/model/SummaryReport.java
index f60bb7238..aed3915f1 100644
--- a/src/org/traccar/reports/model/GeneralReport.java
+++ b/src/org/traccar/reports/model/SummaryReport.java
@@ -1,6 +1,6 @@
package org.traccar.reports.model;
-public class GeneralReport {
+public class SummaryReport {
private String deviceName;
public String getDeviceName() {
@@ -10,7 +10,7 @@ public class GeneralReport {
this.deviceName = deviceName;
}
- private double distance = 0;
+ private double distance;
public double getDistance() {
return distance;
}
@@ -22,7 +22,7 @@ public class GeneralReport {
this.distance += distance;
}
- private double averageSpeed = 0;
+ private double averageSpeed;
public double getAverageSpeed() {
return averageSpeed;
}
@@ -30,7 +30,7 @@ public class GeneralReport {
this.averageSpeed = averageSpeed;
}
- private double maxSpeed = 0;
+ private double maxSpeed;
public double getMaxSpeed() {
return maxSpeed;
}