use of org.traccar.web.CsvBuilder in project traccar by tananaev.
the class PositionResource method getCsv.
@GET
@Produces(TEXT_CSV)
public Response getCsv(@QueryParam("deviceId") long deviceId, @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
CsvBuilder csv = new CsvBuilder();
csv.addHeaderLine(new Position());
csv.addArray(Context.getDataManager().getPositions(deviceId, DateUtil.parseDate(from), DateUtil.parseDate(to)));
return Response.ok(csv.build()).header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE_CSV).build();
}
Aggregations