Search in sources :

Example 1 with AlertPatchResponse

use of org.opentripplanner.api.model.alertpatch.AlertPatchResponse in project OpenTripPlanner by opentripplanner.

the class AlertPatcher method getRoutePatches.

/**
 * Return a list of all patches that apply to a given route
 *
 * @return Returns either an XML or a JSON document, depending on the HTTP Accept header of the
 *         client making the request.
 */
@GET
@Path("/routePatches")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML + Q, MediaType.TEXT_XML + Q })
public AlertPatchResponse getRoutePatches(@QueryParam("agency") String agency, @QueryParam("id") String id) {
    AlertPatchResponse response = new AlertPatchResponse();
    Collection<AlertPatch> alertPatches = alertPatchService.getRoutePatches(new AgencyAndId(agency, id));
    for (AlertPatch alertPatch : alertPatches) {
        response.addAlertPatch(alertPatch);
    }
    return response;
}
Also used : AlertPatchResponse(org.opentripplanner.api.model.alertpatch.AlertPatchResponse) AlertPatch(org.opentripplanner.routing.alertpatch.AlertPatch) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with AlertPatchResponse

use of org.opentripplanner.api.model.alertpatch.AlertPatchResponse in project OpenTripPlanner by opentripplanner.

the class AlertPatcher method getStopPatches.

/**
 * Return a list of all patches that apply to a given stop
 *
 * @return Returns either an XML or a JSON document, depending on the HTTP Accept header of the
 *         client making the request.
 */
@GET
@Path("/stopPatches")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML + Q, MediaType.TEXT_XML + Q })
public AlertPatchResponse getStopPatches(@QueryParam("agency") String agency, @QueryParam("id") String id) {
    AlertPatchResponse response = new AlertPatchResponse();
    Collection<AlertPatch> alertPatches = alertPatchService.getStopPatches(new AgencyAndId(agency, id));
    for (AlertPatch alertPatch : alertPatches) {
        response.addAlertPatch(alertPatch);
    }
    return response;
}
Also used : AlertPatchResponse(org.opentripplanner.api.model.alertpatch.AlertPatchResponse) AlertPatch(org.opentripplanner.routing.alertpatch.AlertPatch) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)2 AlertPatchResponse (org.opentripplanner.api.model.alertpatch.AlertPatchResponse)2 AlertPatch (org.opentripplanner.routing.alertpatch.AlertPatch)2