use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class ApiActionSupport method getBeanFactoryV2.
protected BeanFactoryV2 getBeanFactoryV2() {
BeanFactoryV2 factory = new BeanFactoryV2(_includeReferences);
factory.setApplicationKey(_key);
return factory;
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class ShapeAction method show.
public DefaultHttpHeaders show() {
if (hasErrors())
return setValidationErrorsResponse();
EncodedPolylineBean shape = _service.getShapeForId(_id);
if (shape == null)
return setResourceNotFoundResponse();
BeanFactoryV2 factory = getBeanFactoryV2();
return setOkResponse(factory.getResponse(shape));
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class ShapeIdsForAgencyAction method show.
public DefaultHttpHeaders show() {
if (hasErrors())
return setValidationErrorsResponse();
if (!isVersion(V2))
return setUnknownVersionResponse();
ListBean<String> stopIds = _service.getShapeIdsForAgencyId(_id);
BeanFactoryV2 factory = getBeanFactoryV2();
return setOkResponse(factory.getEntityIdsResponse(stopIds));
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 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));
}
}
Aggregations