Search in sources :

Example 21 with Cacheable

use of org.onebusaway.container.cache.Cacheable 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)

Example 22 with Cacheable

use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.

the class RoutesBeanServiceImpl method getRouteIdsForAgencyId.

@Cacheable
@Override
public ListBean<String> getRouteIdsForAgencyId(String agencyId) {
    AgencyEntry agency = _graphDao.getAgencyForId(agencyId);
    if (agency == null)
        throw new NoSuchAgencyServiceException(agencyId);
    List<String> ids = new ArrayList<String>();
    for (RouteCollectionEntry routeCollection : agency.getRouteCollections()) {
        AgencyAndId id = routeCollection.getId();
        ids.add(AgencyAndIdLibrary.convertToString(id));
    }
    return new ListBean<String>(ids, false);
}
Also used : AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) NoSuchAgencyServiceException(org.onebusaway.exceptions.NoSuchAgencyServiceException) ArrayList(java.util.ArrayList) ListBean(org.onebusaway.transit_data.model.ListBean) RouteCollectionEntry(org.onebusaway.transit_data_federation.services.transit_graph.RouteCollectionEntry) AgencyEntry(org.onebusaway.transit_data_federation.services.transit_graph.AgencyEntry) Cacheable(org.onebusaway.container.cache.Cacheable)

Example 23 with Cacheable

use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.

the class StopBeanServiceImpl method getStopForId.

@Cacheable
public StopBean getStopForId(AgencyAndId id) {
    StopEntry stop = _transitGraphDao.getStopEntryForId(id);
    StopNarrative narrative = _narrativeService.getStopForId(id);
    if (stop == null) {
        // try looking up consolidated id
        AgencyAndId consolidatedId = _consolidatedStopsService.getConsolidatedStopIdForHiddenStopId(id);
        if (consolidatedId != null)
            return getStopForId(consolidatedId);
        throw new NoSuchStopServiceException(AgencyAndIdLibrary.convertToString(id));
    }
    StopBean sb = new StopBean();
    fillStopBean(stop, narrative, sb);
    fillRoutesForStopBean(stop, sb);
    return sb;
}
Also used : AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) NoSuchStopServiceException(org.onebusaway.exceptions.NoSuchStopServiceException) StopEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopEntry) StopBean(org.onebusaway.transit_data.model.StopBean) StopNarrative(org.onebusaway.transit_data_federation.model.narrative.StopNarrative) Cacheable(org.onebusaway.container.cache.Cacheable)

Aggregations

Cacheable (org.onebusaway.container.cache.Cacheable)23 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)10 ArrayList (java.util.ArrayList)8 HashSet (java.util.HashSet)7 RouteCollectionEntry (org.onebusaway.transit_data_federation.services.transit_graph.RouteCollectionEntry)6 StopEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopEntry)6 TripEntry (org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)6 HashMap (java.util.HashMap)4 AgencyEntry (org.onebusaway.transit_data_federation.services.transit_graph.AgencyEntry)4 Date (java.util.Date)3 LocalizedServiceId (org.onebusaway.gtfs.model.calendar.LocalizedServiceId)3 ServiceDate (org.onebusaway.gtfs.model.calendar.ServiceDate)3 RouteBean (org.onebusaway.transit_data.model.RouteBean)3 ShapePoints (org.onebusaway.transit_data_federation.model.ShapePoints)3 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)3 BlockEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry)3 FactoryMap (org.onebusaway.collections.FactoryMap)2 NoSuchAgencyServiceException (org.onebusaway.exceptions.NoSuchAgencyServiceException)2 CoordinateBounds (org.onebusaway.geospatial.model.CoordinateBounds)2 CoordinatePoint (org.onebusaway.geospatial.model.CoordinatePoint)2