diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-01 19:11:22 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 19:11:22 +1300 |
commit | 7adac25c304b046ebfc59b1197663625e862cc81 (patch) | |
tree | e61c162edfe823f7f97226c097ac2173ccff3f96 /src/org/traccar/reports/Events.java | |
parent | 12ddac1b181692a1e32a1a26e9189ab3091dd4bc (diff) | |
parent | fdc61388a4f86bbd7fc7034fcf672486910eb58c (diff) | |
download | trackermap-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/Events.java')
-rw-r--r-- | src/org/traccar/reports/Events.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/org/traccar/reports/Events.java b/src/org/traccar/reports/Events.java index 77d995f56..88ff687d8 100644 --- a/src/org/traccar/reports/Events.java +++ b/src/org/traccar/reports/Events.java @@ -28,9 +28,6 @@ import java.util.HashMap; import java.util.Iterator; 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; @@ -44,16 +41,15 @@ import org.traccar.model.Event; import org.traccar.model.Geofence; import org.traccar.model.Group; import org.traccar.reports.model.DeviceReport; -import org.traccar.web.JsonConverter; public final class Events { private Events() { } - public static String getJson(long userId, Collection<Long> deviceIds, Collection<Long> groupIds, + public static Collection<Event> getObjects(long userId, Collection<Long> deviceIds, Collection<Long> groupIds, Collection<String> types, Date from, Date to) throws SQLException { - JsonArrayBuilder json = Json.createArrayBuilder(); + ArrayList<Event> result = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); Collection<Event> events = Context.getDataManager().getEvents(deviceId, from, to); @@ -62,12 +58,12 @@ public final class Events { if (all || types.contains(event.getType())) { long geofenceId = event.getGeofenceId(); if (geofenceId == 0 || Context.getGeofenceManager().checkGeofence(userId, geofenceId)) { - json.add(JsonConverter.objectToJson(event)); + result.add(event); } } } } - return json.build().toString(); + return result; } public static void getExcel(OutputStream outputStream, |