Search in sources :

Example 31 with ServiceIdActivation

use of org.onebusaway.transit_data_federation.services.transit_graph.ServiceIdActivation 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;
}
Also used : BlockTripBean(org.onebusaway.transit_data.model.blocks.BlockTripBean) TimeZone(java.util.TimeZone) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) LocalizedServiceId(org.onebusaway.gtfs.model.calendar.LocalizedServiceId) BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) ArrayList(java.util.ArrayList) ServiceIdActivation(org.onebusaway.transit_data_federation.services.transit_graph.ServiceIdActivation) BlockConfigurationBean(org.onebusaway.transit_data.model.blocks.BlockConfigurationBean)

Aggregations

ServiceIdActivation (org.onebusaway.transit_data_federation.services.transit_graph.ServiceIdActivation)31 ServiceDate (org.onebusaway.gtfs.model.calendar.ServiceDate)19 Test (org.junit.Test)17 Date (java.util.Date)16 BlockTripEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)8 HashSet (java.util.HashSet)7 TripEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl)7 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)7 TripEntry (org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)7 ArrayList (java.util.ArrayList)6 LocalizedServiceId (org.onebusaway.gtfs.model.calendar.LocalizedServiceId)6 BlockEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl)6 BlockEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry)6 Set (java.util.Set)5 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)5 StopEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.StopEntryImpl)5 FactoryMap (org.onebusaway.collections.FactoryMap)4 FrequencyBlockStopTimeIndex (org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockStopTimeIndex)4 FrequencyBlockTripIndex (org.onebusaway.transit_data_federation.services.blocks.FrequencyBlockTripIndex)4 TimeZone (java.util.TimeZone)3