Search in sources :

Example 1 with TripsForAgencyQueryBean

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

the class TripsForAgencyAction method show.

public DefaultHttpHeaders show() throws IOException, ServiceException {
    if (!isVersion(V2))
        return setUnknownVersionResponse();
    if (hasErrors())
        return setValidationErrorsResponse();
    long time = SystemTime.currentTimeMillis();
    if (_time != null)
        time = _time.getTime();
    TripsForAgencyQueryBean query = new TripsForAgencyQueryBean();
    query.setAgencyId(_id);
    query.setTime(time);
    query.setMaxCount(_maxCount.getMaxCount());
    TripDetailsInclusionBean inclusion = query.getInclusion();
    inclusion.setIncludeTripBean(_includeTrip);
    inclusion.setIncludeTripStatus(_includeStatus);
    inclusion.setIncludeTripSchedule(_includeSchedule);
    BeanFactoryV2 factory = getBeanFactoryV2();
    try {
        ListBean<TripDetailsBean> trips = _service.getTripsForAgency(query);
        return setOkResponse(factory.getTripDetailsResponse(trips));
    } catch (OutOfServiceAreaServiceException ex) {
        return setOkResponse(factory.getEmptyList(TripDetailsV2Bean.class, true));
    }
}
Also used : TripsForAgencyQueryBean(org.onebusaway.transit_data.model.trips.TripsForAgencyQueryBean) OutOfServiceAreaServiceException(org.onebusaway.exceptions.OutOfServiceAreaServiceException) TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean) TripDetailsBean(org.onebusaway.transit_data.model.trips.TripDetailsBean) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2)

Example 2 with TripsForAgencyQueryBean

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

the class VehicleLocationsAction method getAllTripsForAgency.

private ListBean<TripDetailsBean> getAllTripsForAgency(String agencyId, long currentTime) {
    TripsForAgencyQueryBean query = new TripsForAgencyQueryBean();
    query.setAgencyId(agencyId);
    query.setTime(currentTime);
    TripDetailsInclusionBean inclusionBean = new TripDetailsInclusionBean();
    inclusionBean.setIncludeTripBean(true);
    inclusionBean.setIncludeTripStatus(true);
    query.setInclusion(inclusionBean);
    return _transitDataService.getTripsForAgency(query);
}
Also used : TripsForAgencyQueryBean(org.onebusaway.transit_data.model.trips.TripsForAgencyQueryBean) TripDetailsInclusionBean(org.onebusaway.transit_data.model.trips.TripDetailsInclusionBean)

Aggregations

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