use of org.onebusaway.api.model.where.StopWithArrivalsAndDeparturesBeanV1 in project onebusaway-application-modules by camsys.
the class ArrivalsAndDeparturesForStopAction method show.
public DefaultHttpHeaders show() throws ServiceException {
if (hasErrors())
return setValidationErrorsResponse();
if (_query.getTime() == 0)
_query.setTime(SystemTime.currentTimeMillis());
StopWithArrivalsAndDeparturesBean result = _service.getStopWithArrivalsAndDepartures(_id, _query);
if (result == null)
return setResourceNotFoundResponse();
if (isVersion(V1)) {
// Convert data to v1 form
List<ArrivalAndDepartureBeanV1> arrivals = getArrivalsAsV1(result);
StopWithArrivalsAndDeparturesBeanV1 v1 = new StopWithArrivalsAndDeparturesBeanV1(result.getStop(), arrivals, result.getNearbyStops());
return setOkResponse(v1);
} else if (isVersion(V2)) {
BeanFactoryV2 factory = getBeanFactoryV2();
return setOkResponse(factory.getResponse(result));
} else {
return setUnknownVersionResponse();
}
}
Aggregations