aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Trips.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-01 19:11:22 +1300
committerGitHub <noreply@github.com>2016-11-01 19:11:22 +1300
commit7adac25c304b046ebfc59b1197663625e862cc81 (patch)
treee61c162edfe823f7f97226c097ac2173ccff3f96 /src/org/traccar/reports/Trips.java
parent12ddac1b181692a1e32a1a26e9189ab3091dd4bc (diff)
parentfdc61388a4f86bbd7fc7034fcf672486910eb58c (diff)
downloadtrackermap-server-7adac25c304b046ebfc59b1197663625e862cc81.tar.gz
trackermap-server-7adac25c304b046ebfc59b1197663625e862cc81.tar.bz2
trackermap-server-7adac25c304b046ebfc59b1197663625e862cc81.zip
Merge pull request #2502 from Abyss777/reports_jsonconverter
Remove explicit JSON conversion from reports
Diffstat (limited to 'src/org/traccar/reports/Trips.java')
-rw-r--r--src/org/traccar/reports/Trips.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/org/traccar/reports/Trips.java b/src/org/traccar/reports/Trips.java
index 705644849..30fef40c9 100644
--- a/src/org/traccar/reports/Trips.java
+++ b/src/org/traccar/reports/Trips.java
@@ -26,9 +26,6 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
-import javax.json.Json;
-import javax.json.JsonArrayBuilder;
-
import org.jxls.area.Area;
import org.jxls.builder.xls.XlsCommentAreaBuilder;
import org.jxls.common.CellRef;
@@ -42,7 +39,6 @@ import org.traccar.model.Group;
import org.traccar.model.Position;
import org.traccar.reports.model.DeviceReport;
import org.traccar.reports.model.TripReport;
-import org.traccar.web.JsonConverter;
public final class Trips {
@@ -167,16 +163,14 @@ public final class Trips {
return result;
}
- public static String getJson(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
+ public static Collection<TripReport> getObjects(long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
Date from, Date to) throws SQLException {
- JsonArrayBuilder json = Json.createArrayBuilder();
+ ArrayList<TripReport> result = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- for (TripReport tripReport : detectTrips(deviceId, from, to)) {
- json.add(JsonConverter.objectToJson(tripReport));
- }
+ result.addAll(detectTrips(deviceId, from, to));
}
- return json.build().toString();
+ return result;
}
public static void getExcel(OutputStream outputStream,