Search in sources :

Example 1 with TripsForRouteQueryBean

use of org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean in project onebusaway-application-modules by camsys.

the class RealtimeServiceV2Impl method getAllTripsForRoute.

/**
 * PRIVATE METHODS
 */
private ListBean<TripDetailsBean> getAllTripsForRoute(String routeId, long currentTime) {
    TripsForRouteQueryBean tripRouteQueryBean = new TripsForRouteQueryBean();
    tripRouteQueryBean.setRouteId(routeId);
    tripRouteQueryBean.setTime(currentTime);
    TripDetailsInclusionBean inclusionBean = new TripDetailsInclusionBean();
    inclusionBean.setIncludeTripBean(true);
    inclusionBean.setIncludeTripStatus(true);
    tripRouteQueryBean.setInclusion(inclusionBean);
    return _transitDataService.getTripsForRoute(tripRouteQueryBean);
}
Also used : TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripsForRouteQueryBean(org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean)

Example 2 with TripsForRouteQueryBean

use of org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean in project onebusaway-application-modules by camsys.

the class TripsForRouteAction 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;
    TripsForRouteQueryBean query = new TripsForRouteQueryBean();
    query.setRouteId(_id);
    query.setTime(time);
    query.setMaxCount(_maxCount.getMaxCount());
    TripDetailsInclusionBean inclusion = query.getInclusion();
    inclusion.setIncludeTripBean(_includeTrip);
    inclusion.setIncludeTripSchedule(_includeSchedule);
    inclusion.setIncludeTripStatus(_includeStatus);
    BeanFactoryV2 factory = getBeanFactoryV2();
    try {
        ListBean<TripDetailsBean> trips = _service.getTripsForRoute(query);
        return setOkResponse(factory.getTripDetailsResponse(trips));
    } catch (OutOfServiceAreaServiceException ex) {
        return setOkResponse(factory.getEmptyList(TripDetailsV2Bean.class, true));
    }
}
Also used : OutOfServiceAreaServiceException(org.onebusaway.exceptions.OutOfServiceAreaServiceException) TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripsForRouteQueryBean(org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean) TripDetailsBean(org.onebusaway.transit_data.model.trips.TripDetailsBean) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2)

Example 3 with TripsForRouteQueryBean

use of org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean in project onebusaway-application-modules by camsys.

the class RealtimeServiceImpl method getAllTripsForRoute.

/**
 * PRIVATE METHODS
 */
private ListBean<TripDetailsBean> getAllTripsForRoute(String routeId, long currentTime) {
    TripsForRouteQueryBean tripRouteQueryBean = new TripsForRouteQueryBean();
    tripRouteQueryBean.setRouteId(routeId);
    tripRouteQueryBean.setTime(currentTime);
    TripDetailsInclusionBean inclusionBean = new TripDetailsInclusionBean();
    inclusionBean.setIncludeTripBean(true);
    inclusionBean.setIncludeTripStatus(true);
    tripRouteQueryBean.setInclusion(inclusionBean);
    return _transitDataService.getTripsForRoute(tripRouteQueryBean);
}
Also used : TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripsForRouteQueryBean(org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean)

Example 4 with TripsForRouteQueryBean

use of org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean in project onebusaway-application-modules by camsys.

the class VehicleLocationsAction method getAllTripsForRoute.

private ListBean<TripDetailsBean> getAllTripsForRoute(String routeId, long currentTime) {
    TripsForRouteQueryBean query = new TripsForRouteQueryBean();
    query.setRouteId(routeId);
    query.setTime(currentTime);
    TripDetailsInclusionBean inclusionBean = new TripDetailsInclusionBean();
    inclusionBean.setIncludeTripBean(true);
    inclusionBean.setIncludeTripStatus(true);
    query.setInclusion(inclusionBean);
    return _transitDataService.getTripsForRoute(query);
}
Also used : TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripsForRouteQueryBean(org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean)

Aggregations

TripDetailsInclusionBean (org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean)4 TripsForRouteQueryBean (org.onebusaway.transit_data.model.trips.TripsForRouteQueryBean)4 BeanFactoryV2 (org.onebusaway.api.model.transit.BeanFactoryV2)1 OutOfServiceAreaServiceException (org.onebusaway.exceptions.OutOfServiceAreaServiceException)1 TripDetailsBean (org.onebusaway.transit_data.model.trips.TripDetailsBean)1