Search in sources :

Example 1 with NoSuchAgencyServiceException

use of org.onebusaway.exceptions.NoSuchAgencyServiceException in project onebusaway-application-modules by camsys.

the class RoutesBeanServiceImpl method getRoutesForAgencyId.

@Cacheable
@Override
public ListBean<RouteBean> getRoutesForAgencyId(String agencyId) {
    AgencyEntry agency = _graphDao.getAgencyForId(agencyId);
    if (agency == null)
        throw new NoSuchAgencyServiceException(agencyId);
    List<RouteBean> routes = new ArrayList<RouteBean>();
    for (RouteCollectionEntry routeCollection : agency.getRouteCollections()) {
        AgencyAndId routeId = routeCollection.getId();
        RouteBean route = _routeBeanService.getRouteForId(routeId);
        routes.add(route);
    }
    return new ListBean<RouteBean>(routes, false);
}
Also used : RouteBean(org.onebusaway.transit_data.model.RouteBean) 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 2 with NoSuchAgencyServiceException

use of org.onebusaway.exceptions.NoSuchAgencyServiceException in project onebusaway-application-modules by camsys.

the class FederatedServiceCollectionImpl method getServiceForAgencyIds.

@Override
public FederatedService getServiceForAgencyIds(Iterable<String> agencyIds) throws ServiceAreaServiceException {
    Set<FederatedService> providers = new HashSet<FederatedService>();
    for (String id : agencyIds) {
        FederatedService provider = getServiceForAgencyId(id);
        if (provider == null)
            throw new NoSuchAgencyServiceException(id);
        providers.add(provider);
    }
    return getProviderFromProviders(providers);
}
Also used : FederatedService(org.onebusaway.federations.FederatedService) NoSuchAgencyServiceException(org.onebusaway.exceptions.NoSuchAgencyServiceException) HashSet(java.util.HashSet)

Example 3 with NoSuchAgencyServiceException

use of org.onebusaway.exceptions.NoSuchAgencyServiceException in project onebusaway-application-modules by camsys.

the class StopsBeanServiceImpl method getStopsIdsForAgencyId.

@Override
public ListBean<String> getStopsIdsForAgencyId(String agencyId) {
    AgencyEntry agency = _transitGraphDao.getAgencyForId(agencyId);
    if (agency == null)
        throw new NoSuchAgencyServiceException(agencyId);
    List<String> ids = new ArrayList<String>();
    for (StopEntry stop : agency.getStops()) {
        AgencyAndId id = stop.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) StopEntry(org.onebusaway.transit_data_federation.services.transit_graph.StopEntry) AgencyEntry(org.onebusaway.transit_data_federation.services.transit_graph.AgencyEntry)

Example 4 with NoSuchAgencyServiceException

use of org.onebusaway.exceptions.NoSuchAgencyServiceException 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)

Aggregations

NoSuchAgencyServiceException (org.onebusaway.exceptions.NoSuchAgencyServiceException)4 ArrayList (java.util.ArrayList)3 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)3 ListBean (org.onebusaway.transit_data.model.ListBean)3 AgencyEntry (org.onebusaway.transit_data_federation.services.transit_graph.AgencyEntry)3 Cacheable (org.onebusaway.container.cache.Cacheable)2 RouteCollectionEntry (org.onebusaway.transit_data_federation.services.transit_graph.RouteCollectionEntry)2 HashSet (java.util.HashSet)1 FederatedService (org.onebusaway.federations.FederatedService)1 RouteBean (org.onebusaway.transit_data.model.RouteBean)1 StopEntry (org.onebusaway.transit_data_federation.services.transit_graph.StopEntry)1