Example #1
0
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("{id}/getfirststopfrom")
  public Response getFirstStopFrom(@PathParam("id") Integer id, @QueryParam("time") Integer time)
      throws IOException {

    log.write("\ngetfirststopfrom/" + id);
    log.flush();

    boa.server.domain.Station s = boa.server.domain.Stations.getStations().getStationById(id);

    if (s == null)
      return Response.ok()
          .entity(new boa.server.plugin.json.Response(404, "No station having the specified id."))
          .build();

    if (time == null) time = new Integer(0);

    boa.server.domain.Stop fs = s.getFirstStopFromTime(time);

    if (fs == null) return Response.ok().entity("").build();

    boa.server.plugin.json.Stop js = new boa.server.plugin.json.Stop(fs);
    return Response.ok().entity(js).build();
  }