use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class BlockInstanceAction method show.
public DefaultHttpHeaders show() throws ServiceException {
if (!isVersion(V2))
return setUnknownVersionResponse();
if (hasErrors())
return setValidationErrorsResponse();
BlockInstanceBean blockInstance = _service.getBlockInstance(_id, _serviceDate);
if (blockInstance == null)
return setResourceNotFoundResponse();
BeanFactoryV2 factory = getBeanFactoryV2();
BlockInstanceV2Bean bean = factory.getBlockInstance(blockInstance);
EntryWithReferencesBean<BlockInstanceV2Bean> response = factory.entry(bean);
return setOkResponse(response);
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class ConfigAction method index.
public DefaultHttpHeaders index() throws IOException, ServiceException {
if (hasErrors())
return setValidationErrorsResponse();
BundleMetadata meta = _service.getBundleMetadata();
BeanFactoryV2 factory = getBeanFactoryV2();
return setOkResponse(factory.getResponse(meta));
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class CurrentTimeAction method index.
public DefaultHttpHeaders index() {
Date date = new Date();
date.setTime(SystemTime.currentTimeMillis());
String readableTime = DateLibrary.getTimeAsIso8601String(date);
TimeBean bean = new TimeBean(date, readableTime);
if (isVersion(V1)) {
return setOkResponse(bean);
} else if (isVersion(V2)) {
BeanFactoryV2 factory = getBeanFactoryV2();
EntryWithReferencesBean<TimeBean> response = factory.entry(bean);
return setOkResponse(response);
} else {
return setUnknownVersionResponse();
}
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class EstimateCurrentVehicleAction method index.
public DefaultHttpHeaders index() throws IOException, ServiceException {
if (!isVersion(V2))
return setUnknownVersionResponse();
if (hasErrors())
return setValidationErrorsResponse();
fillInQuery();
if (hasErrors())
return setValidationErrorsResponse();
BeanFactoryV2 factory = getBeanFactoryV2();
ListBean<CurrentVehicleEstimateBean> estimates = _service.getCurrentVehicleEstimates(_query);
return setOkResponse(factory.getCurrentVehicleEstimates(estimates));
}
use of org.onebusaway.api.model.transit.BeanFactoryV2 in project onebusaway-application-modules by camsys.
the class RegisterAlarmForArrivalAndDepartureAtStopAction method show.
public DefaultHttpHeaders show() throws ServiceException {
if (hasErrors())
return setValidationErrorsResponse();
if (_query.getTime() == 0)
_query.setTime(SystemTime.currentTimeMillis());
AlarmDetails details = _alarmService.alterAlarmQuery(_alarm, _data);
String alarmId = _service.registerAlarmForArrivalAndDepartureAtStop(_query, _alarm);
if (alarmId == null)
return setResourceNotFoundResponse();
if (details != null) {
_alarmService.registerAlarm(alarmId, details);
}
if (isVersion(V2)) {
RegisteredAlarmV2Bean bean = new RegisteredAlarmV2Bean();
bean.setAlarmId(alarmId);
BeanFactoryV2 factory = getBeanFactoryV2();
return setOkResponse(factory.entry(bean));
} else {
return setUnknownVersionResponse();
}
}
Aggregations