use of org.onebusaway.transit_data.model.blocks.BlockBean in project onebusaway-application-modules by camsys.
the class BlockAction method show.
public DefaultHttpHeaders show() throws ServiceException {
if (!isVersion(V2))
return setUnknownVersionResponse();
if (hasErrors())
return setValidationErrorsResponse();
BlockBean block = _service.getBlockForId(_id);
if (block == null)
return setResourceNotFoundResponse();
BeanFactoryV2 factory = getBeanFactoryV2();
EntryWithReferencesBean<BlockV2Bean> response = factory.getBlockResponse(block);
return setOkResponse(response);
}
use of org.onebusaway.transit_data.model.blocks.BlockBean in project onebusaway-application-modules by camsys.
the class BlockBeanServiceImpl method getBlockForId.
@Cacheable
public BlockBean getBlockForId(AgencyAndId blockId) {
BlockEntry blockEntry = _graph.getBlockEntryForId(blockId);
if (blockEntry == null)
return null;
BlockBean bean = new BlockBean();
bean.setId(AgencyAndIdLibrary.convertToString(blockEntry.getId()));
List<BlockConfigurationBean> configBeans = new ArrayList<BlockConfigurationBean>();
for (BlockConfigurationEntry blockConfiguration : blockEntry.getConfigurations()) {
BlockConfigurationBean configBean = getBlockConfigurationAsBean(blockConfiguration);
configBeans.add(configBean);
}
bean.setConfigurations(configBeans);
return bean;
}
Aggregations