Search in sources :

Example 1 with BlockBean

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);
}
Also used : BlockV2Bean(org.onebusaway.api.model.transit.blocks.BlockV2Bean) BlockBean(org.onebusaway.transit_data.model.blocks.BlockBean) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2)

Example 2 with BlockBean

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;
}
Also used : BlockEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry) BlockBean(org.onebusaway.transit_data.model.blocks.BlockBean) ArrayList(java.util.ArrayList) BlockConfigurationBean(org.onebusaway.transit_data.model.blocks.BlockConfigurationBean) BlockConfigurationEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry) Cacheable(org.onebusaway.container.cache.Cacheable)

Aggregations

BlockBean (org.onebusaway.transit_data.model.blocks.BlockBean)2 ArrayList (java.util.ArrayList)1 BeanFactoryV2 (org.onebusaway.api.model.transit.BeanFactoryV2)1 BlockV2Bean (org.onebusaway.api.model.transit.blocks.BlockV2Bean)1 Cacheable (org.onebusaway.container.cache.Cacheable)1 BlockConfigurationBean (org.onebusaway.transit_data.model.blocks.BlockConfigurationBean)1 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)1 BlockEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry)1