Search in sources :

Example 1 with BlockV2Bean

use of org.onebusaway.api.model.transit.blocks.BlockV2Bean in project onebusaway-application-modules by camsys.

the class BeanFactoryV2 method getBlock.

public BlockV2Bean getBlock(BlockBean block) {
    BlockV2Bean bean = new BlockV2Bean();
    bean.setId(block.getId());
    List<BlockConfigurationV2Bean> blockConfigs = new ArrayList<BlockConfigurationV2Bean>();
    for (BlockConfigurationBean blockConfig : block.getConfigurations()) blockConfigs.add(getBlockConfig(blockConfig));
    bean.setConfigurations(blockConfigs);
    return bean;
}
Also used : BlockV2Bean(org.onebusaway.api.model.transit.blocks.BlockV2Bean) ArrayList(java.util.ArrayList) BlockConfigurationBean(org.onebusaway.transit_data.model.blocks.BlockConfigurationBean) BlockConfigurationV2Bean(org.onebusaway.api.model.transit.blocks.BlockConfigurationV2Bean)

Example 2 with BlockV2Bean

use of org.onebusaway.api.model.transit.blocks.BlockV2Bean 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)

Aggregations

BlockV2Bean (org.onebusaway.api.model.transit.blocks.BlockV2Bean)2 ArrayList (java.util.ArrayList)1 BeanFactoryV2 (org.onebusaway.api.model.transit.BeanFactoryV2)1 BlockConfigurationV2Bean (org.onebusaway.api.model.transit.blocks.BlockConfigurationV2Bean)1 BlockBean (org.onebusaway.transit_data.model.blocks.BlockBean)1 BlockConfigurationBean (org.onebusaway.transit_data.model.blocks.BlockConfigurationBean)1