use of org.onebusaway.transit_data.model.blocks.BlockConfigurationBean 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;
}
use of org.onebusaway.transit_data.model.blocks.BlockConfigurationBean in project onebusaway-application-modules by camsys.
the class BlockAction method execute.
@Override
@Actions({ @Action(value = "/where/block"), @Action(value = "/where/iphone/block") })
public String execute() throws ServiceException {
if (_id == null)
return INPUT;
_blockInstance = _service.getBlockInstance(_id, _serviceDate.getTime());
if (_blockInstance == null)
return ERROR;
BlockConfigurationBean blockConfig = _blockInstance.getBlockConfiguration();
_timeZone = TimeZone.getTimeZone(blockConfig.getTimeZone());
return SUCCESS;
}
use of org.onebusaway.transit_data.model.blocks.BlockConfigurationBean 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;
}
use of org.onebusaway.transit_data.model.blocks.BlockConfigurationBean in project onebusaway-application-modules by camsys.
the class BlockBeanServiceImpl method getBlockConfigurationAsBean.
private BlockConfigurationBean getBlockConfigurationAsBean(BlockConfigurationEntry blockConfiguration) {
BlockConfigurationBean bean = new BlockConfigurationBean();
ServiceIdActivation serviceIds = blockConfiguration.getServiceIds();
AgencyAndId blockId = blockConfiguration.getBlock().getId();
bean.setBlockId(AgencyAndIdLibrary.convertToString(blockId));
List<String> activeServiceIds = new ArrayList<String>();
for (LocalizedServiceId lsid : serviceIds.getActiveServiceIds()) activeServiceIds.add(AgencyAndIdLibrary.convertToString(lsid.getId()));
bean.setActiveServiceIds(activeServiceIds);
List<String> inactiveServiceIds = new ArrayList<String>();
for (LocalizedServiceId lsid : serviceIds.getInactiveServiceIds()) inactiveServiceIds.add(AgencyAndIdLibrary.convertToString(lsid.getId()));
bean.setInactiveServiceIds(inactiveServiceIds);
List<BlockTripBean> tripBeans = new ArrayList<BlockTripBean>();
for (BlockTripEntry blockTrip : blockConfiguration.getTrips()) tripBeans.add(getBlockTripAsBean(blockTrip));
bean.setTrips(tripBeans);
TimeZone tz = _agencyService.getTimeZoneForAgencyId(blockId.getAgencyId());
bean.setTimeZone(tz.getID());
return bean;
}
use of org.onebusaway.transit_data.model.blocks.BlockConfigurationBean in project onebusaway-application-modules by camsys.
the class BlockBeanServiceImpl method getBlockInstanceAsBean.
/**
**
* Private Methods
***
*/
private BlockInstanceBean getBlockInstanceAsBean(BlockInstance blockInstance) {
BlockInstanceBean bean = new BlockInstanceBean();
BlockConfigurationBean blockConfig = getBlockConfigurationAsBean(blockInstance.getBlock());
bean.setBlockId(blockConfig.getBlockId());
bean.setBlockConfiguration(blockConfig);
long serviceDate = blockInstance.getServiceDate();
bean.setServiceDate(serviceDate);
return bean;
}
Aggregations