From 2377f5746ffb8a3364ad65a382ca5fce3fe11e87 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 27 Dec 2020 17:59:19 -0800 Subject: Remove GPX and CSV export --- .../org/traccar/api/resource/PositionResource.java | 33 ---------------------- 1 file changed, 33 deletions(-) (limited to 'src/main/java/org/traccar/api') diff --git a/src/main/java/org/traccar/api/resource/PositionResource.java b/src/main/java/org/traccar/api/resource/PositionResource.java index e93feaccf..998d59706 100644 --- a/src/main/java/org/traccar/api/resource/PositionResource.java +++ b/src/main/java/org/traccar/api/resource/PositionResource.java @@ -18,18 +18,13 @@ package org.traccar.api.resource; import org.traccar.Context; import org.traccar.api.BaseResource; import org.traccar.model.Position; -import org.traccar.web.CsvBuilder; -import org.traccar.web.GpxBuilder; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; @@ -42,11 +37,6 @@ import java.util.List; @Consumes(MediaType.APPLICATION_JSON) public class PositionResource extends BaseResource { - public static final String TEXT_CSV = "text/csv"; - public static final String CONTENT_DISPOSITION_VALUE_CSV = "attachment; filename=positions.csv"; - public static final String GPX = "application/gpx+xml"; - public static final String CONTENT_DISPOSITION_VALUE_GPX = "attachment; filename=positions.gpx"; - @GET public Collection getJson( @QueryParam("deviceId") long deviceId, @QueryParam("id") List positionIds, @@ -72,27 +62,4 @@ public class PositionResource extends BaseResource { } } - @GET - @Produces(TEXT_CSV) - public Response getCsv( - @QueryParam("deviceId") long deviceId, @QueryParam("from") Date from, @QueryParam("to") Date to) - throws SQLException { - Context.getPermissionsManager().checkDevice(getUserId(), deviceId); - CsvBuilder csv = new CsvBuilder(); - csv.addHeaderLine(new Position()); - csv.addArray(Context.getDataManager().getPositions(deviceId, from, to)); - return Response.ok(csv.build()).header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE_CSV).build(); - } - - @GET - @Produces(GPX) - public Response getGpx( - @QueryParam("deviceId") long deviceId, @QueryParam("from") Date from, @QueryParam("to") Date to) - throws SQLException { - Context.getPermissionsManager().checkDevice(getUserId(), deviceId); - GpxBuilder gpx = new GpxBuilder(Context.getIdentityManager().getById(deviceId).getName()); - gpx.addPositions(Context.getDataManager().getPositions(deviceId, from, to)); - return Response.ok(gpx.build()).header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE_GPX).build(); - } - } -- cgit v1.2.3