Search in sources :

Example 16 with ListBean

use of org.onebusaway.transit_data.model.ListBean 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 17 with ListBean

use of org.onebusaway.transit_data.model.ListBean in project onebusaway-application-modules by camsys.

the class ShapeBeanServiceImpl method getShapeIdsForAgencyId.

@Override
public ListBean<String> getShapeIdsForAgencyId(String agencyId) {
    Set<AgencyAndId> shapeIds = new HashSet<AgencyAndId>();
    for (TripEntry trip : _transitGraphDao.getAllTrips()) {
        AgencyAndId shapeId = trip.getShapeId();
        if (shapeId == null || !shapeId.hasValues())
            continue;
        if (!shapeId.getAgencyId().equals(agencyId))
            continue;
        shapeIds.add(shapeId);
    }
    List<String> ids = new ArrayList<String>();
    for (AgencyAndId shapeId : shapeIds) {
        String id = AgencyAndIdLibrary.convertToString(shapeId);
        ids.add(id);
    }
    Collections.sort(ids);
    return new ListBean<String>(ids, false);
}
Also used : AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) ArrayList(java.util.ArrayList) ListBean(org.onebusaway.transit_data.model.ListBean) TripEntry(org.onebusaway.transit_data_federation.services.transit_graph.TripEntry) HashSet(java.util.HashSet)

Aggregations

ArrayList (java.util.ArrayList)17 ListBean (org.onebusaway.transit_data.model.ListBean)17 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)11 VehicleStatusBean (org.onebusaway.transit_data.model.VehicleStatusBean)5 Date (java.util.Date)4 List (java.util.List)4 Test (org.junit.Test)4 RouteBean (org.onebusaway.transit_data.model.RouteBean)4 FeedEntity (com.google.transit.realtime.GtfsRealtime.FeedEntity)3 FeedMessage (com.google.transit.realtime.GtfsRealtime.FeedMessage)3 IOException (java.io.IOException)3 ResponseBean (org.onebusaway.api.model.ResponseBean)3 NoSuchAgencyServiceException (org.onebusaway.exceptions.NoSuchAgencyServiceException)3 BlockLocation (org.onebusaway.transit_data_federation.services.realtime.BlockLocation)3 Map (java.util.Map)2 T2 (org.onebusaway.collections.tuple.T2)2 Cacheable (org.onebusaway.container.cache.Cacheable)2 ServiceAlertBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)2 TripBean (org.onebusaway.transit_data.model.trips.TripBean)2 TripDetailsBean (org.onebusaway.transit_data.model.trips.TripDetailsBean)2