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));
}
}
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);
}
Aggregations