Search in sources :

Example 11 with OutOfServiceAreaServiceException

use of org.onebusaway.exceptions.OutOfServiceAreaServiceException in project onebusaway-application-modules by camsys.

the class VehiclesForAgencyAction method show.

public DefaultHttpHeaders show() throws IOException, ServiceException {
    if (!isVersion(V2))
        return setUnknownVersionResponse();
    if (hasErrors())
        return setValidationErrorsResponse();
    long time = SystemTime.currentTimeMillis();
    if (_time != 0)
        time = _time;
    BeanFactoryV2 factory = getBeanFactoryV2();
    try {
        ListBean<VehicleStatusBean> vehicles = _service.getAllVehiclesForAgency(_id, time);
        return setOkResponse(factory.getVehicleStatusResponse(vehicles));
    } catch (OutOfServiceAreaServiceException ex) {
        return setOkResponse(factory.getEmptyList(VehicleStatusV2Bean.class, true));
    }
}
Also used : OutOfServiceAreaServiceException(org.onebusaway.exceptions.OutOfServiceAreaServiceException) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2) VehicleStatusBean(org.onebusaway.transit_data.model.VehicleStatusBean)

Aggregations

OutOfServiceAreaServiceException (org.onebusaway.exceptions.OutOfServiceAreaServiceException)11 BeanFactoryV2 (org.onebusaway.api.model.transit.BeanFactoryV2)5 SearchQueryBean (org.onebusaway.transit_data.model.SearchQueryBean)5 CoordinateBounds (org.onebusaway.geospatial.model.CoordinateBounds)4 RouteBean (org.onebusaway.transit_data.model.RouteBean)3 RoutesBean (org.onebusaway.transit_data.model.RoutesBean)3 StopsForRouteBean (org.onebusaway.transit_data.model.StopsForRouteBean)3 TripDetailsBean (org.onebusaway.transit_data.model.trips.TripDetailsBean)3 TripDetailsInclusionBean (org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean)3 SearchResultCollection (org.onebusaway.presentation.model.SearchResultCollection)2 StopsBean (org.onebusaway.transit_data.model.StopsBean)2 VehicleStatusBean (org.onebusaway.transit_data.model.VehicleStatusBean)2 Matcher (java.util.regex.Matcher)1 StopOnRoute (org.onebusaway.enterprise.webapp.actions.api.model.StopOnRoute)1 RouteComparator (org.onebusaway.presentation.impl.RouteComparator)1 SearchResult (org.onebusaway.presentation.model.SearchResult)1 StopBean (org.onebusaway.transit_data.model.StopBean)1 TripsForAgencyQueryBean (org.onebusaway.transit_data.model.trips.TripsForAgencyQueryBean)1 TripsForBoundsQueryBean (org.onebusaway.transit_data.model.trips.TripsForBoundsQueryBean)1 TripsForRouteQueryBean (org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean)1