aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/resource/PositionResource.java33
1 files changed, 0 insertions, 33 deletions
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<Position> getJson(
@QueryParam("deviceId") long deviceId, @QueryParam("id") List<Long> 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();
- }
-
}