aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-10 13:52:56 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-10 13:52:56 +0500
commita2caa60c024e2cf858ed4f7ed1c4afcfdb7b523b (patch)
tree1d22859c20981726076493c7cd45035874f9b0fa /src/org/traccar
parentb8ee37b82077d9883e006ed9afcce1b9f2e6cd55 (diff)
downloadtrackermap-server-a2caa60c024e2cf858ed4f7ed1c4afcfdb7b523b.tar.gz
trackermap-server-a2caa60c024e2cf858ed4f7ed1c4afcfdb7b523b.tar.bz2
trackermap-server-a2caa60c024e2cf858ed4f7ed1c4afcfdb7b523b.zip
- Used constants in ReportResource
- Renamed variables and functions in ReportController - Changed Strings - Fixed year
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/api/resource/ReportResource.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/org/traccar/api/resource/ReportResource.java b/src/org/traccar/api/resource/ReportResource.java
index 0dc9ab6a4..d5687c741 100644
--- a/src/org/traccar/api/resource/ReportResource.java
+++ b/src/org/traccar/api/resource/ReportResource.java
@@ -17,12 +17,15 @@ import org.traccar.reports.Route;
import org.traccar.web.JsonConverter;
@Path("reports")
-@Consumes("application/json")
+@Consumes(javax.ws.rs.core.MediaType.APPLICATION_JSON)
public class ReportResource extends BaseResource {
+ public static final String TEXT_CSV = "text/csv";
+ public static final String CONTENT_DISPOSITION_VALUE = "attachment; filename=report.csv";
+
@Path("route")
@GET
- @Produces("application/json")
+ @Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)
public Response getRouteJson(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
@@ -32,19 +35,19 @@ public class ReportResource extends BaseResource {
@Path("route")
@GET
- @Produces("text/csv")
+ @Produces(TEXT_CSV)
public Response getRouteCsv(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
return Response.ok(Route.getCsv(getUserId(), deviceIds, groupIds,
JsonConverter.parseDate(from), JsonConverter.parseDate(to)))
- .header("Content-Disposition", "attachment; filename=route.csv")
+ .header(javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE)
.build();
}
@Path("events")
@GET
- @Produces("application/json")
+ @Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)
public Response getEventsJson(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("type") final List<String> types,
@@ -55,20 +58,20 @@ public class ReportResource extends BaseResource {
@Path("events")
@GET
- @Produces("text/csv")
+ @Produces(TEXT_CSV)
public Response getEventsCsv(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("type") final List<String> types,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
return Response.ok(Events.getCsv(getUserId(), deviceIds, groupIds,
types, JsonConverter.parseDate(from), JsonConverter.parseDate(to)))
- .header("Content-Disposition", "attachment; filename=events.csv")
+ .header(javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE)
.build();
}
@Path("summary")
@GET
- @Produces("application/json")
+ @Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)
public Response getSummaryJson(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
@@ -78,13 +81,13 @@ public class ReportResource extends BaseResource {
@Path("summary")
@GET
- @Produces("text/csv")
+ @Produces(TEXT_CSV)
public Response getSummaryCsv(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
return Response.ok(Summary.getCsv(getUserId(), deviceIds, groupIds,
JsonConverter.parseDate(from), JsonConverter.parseDate(to)))
- .header("Content-Disposition", "attachment; filename=summary.csv")
+ .header(javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE)
.build();
}