Search in sources :

Example 1 with AlertMapper

use of org.opentripplanner.api.mapping.AlertMapper in project OpenTripPlanner by opentripplanner.

the class IndexAPI method getAlertsForTrip.

/**
 * Return all alerts for a trip
 */
@GET
@Path("/trips/{tripId}/alerts")
public Collection<ApiAlert> getAlertsForTrip(@PathParam("tripId") String tripId) {
    RoutingService routingService = createRoutingService();
    // TODO: Add locale
    AlertMapper alertMapper = new AlertMapper(null);
    FeedScopedId id = createId("tripId", tripId);
    return alertMapper.mapToApi(routingService.getTransitAlertService().getTripAlerts(id));
}
Also used : RoutingService(org.opentripplanner.routing.RoutingService) FeedScopedId(org.opentripplanner.model.FeedScopedId) AlertMapper(org.opentripplanner.api.mapping.AlertMapper) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 2 with AlertMapper

use of org.opentripplanner.api.mapping.AlertMapper in project OpenTripPlanner by opentripplanner.

the class IndexAPI method getAlertsForRoute.

/**
 * Return all alerts for a route
 */
@GET
@Path("/routes/{routeId}/alerts")
public Collection<ApiAlert> getAlertsForRoute(@PathParam("routeId") String routeId) {
    RoutingService routingService = createRoutingService();
    // TODO: Add locale
    AlertMapper alertMapper = new AlertMapper(null);
    FeedScopedId id = createId("routeId", routeId);
    return alertMapper.mapToApi(routingService.getTransitAlertService().getRouteAlerts(id));
}
Also used : RoutingService(org.opentripplanner.routing.RoutingService) FeedScopedId(org.opentripplanner.model.FeedScopedId) AlertMapper(org.opentripplanner.api.mapping.AlertMapper) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 3 with AlertMapper

use of org.opentripplanner.api.mapping.AlertMapper in project OpenTripPlanner by opentripplanner.

the class IndexAPI method getAlertsForStop.

/**
 * Return all alerts for a stop
 */
@GET
@Path("/stops/{stopId}/alerts")
public Collection<ApiAlert> getAlertsForStop(@PathParam("stopId") String stopId) {
    RoutingService routingService = createRoutingService();
    // TODO: Add locale
    AlertMapper alertMapper = new AlertMapper(null);
    FeedScopedId id = createId("stopId", stopId);
    return alertMapper.mapToApi(routingService.getTransitAlertService().getStopAlerts(id));
}
Also used : RoutingService(org.opentripplanner.routing.RoutingService) FeedScopedId(org.opentripplanner.model.FeedScopedId) AlertMapper(org.opentripplanner.api.mapping.AlertMapper) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 4 with AlertMapper

use of org.opentripplanner.api.mapping.AlertMapper in project OpenTripPlanner by opentripplanner.

the class IndexAPI method getAlertsForPattern.

/**
 * Return all alerts for a pattern
 */
@GET
@Path("/patterns/{patternId}/alerts")
public Collection<ApiAlert> getAlertsForPattern(@PathParam("patternId") String patternId) {
    RoutingService routingService = createRoutingService();
    // TODO: Add locale
    AlertMapper alertMapper = new AlertMapper(null);
    FeedScopedId id = createId("patternId", patternId);
    return alertMapper.mapToApi(routingService.getTransitAlertService().getTripPatternAlerts(id));
}
Also used : RoutingService(org.opentripplanner.routing.RoutingService) FeedScopedId(org.opentripplanner.model.FeedScopedId) AlertMapper(org.opentripplanner.api.mapping.AlertMapper) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 AlertMapper (org.opentripplanner.api.mapping.AlertMapper)4 FeedScopedId (org.opentripplanner.model.FeedScopedId)4 RoutingService (org.opentripplanner.routing.RoutingService)4