use of org.onebusaway.exceptions.InternalErrorServiceException in project onebusaway-application-modules by camsys.
the class RouteServiceImpl method getRouteCollectionIdsForStop.
@Override
@Cacheable
public Set<AgencyAndId> getRouteCollectionIdsForStop(AgencyAndId stopId) {
StopEntry stopEntry = _transitGraphDao.getStopEntryForId(stopId);
if (stopEntry == null)
throw new InternalErrorServiceException("no such stop: id=" + stopId);
Set<AgencyAndId> routeCollectionIds = new HashSet<AgencyAndId>();
List<BlockStopTimeIndex> indices = _blockIndexService.getStopTimeIndicesForStop(stopEntry);
for (BlockStopTimeIndex blockStopTimeIndex : indices) {
for (BlockTripEntry blockTrip : blockStopTimeIndex.getTrips()) {
TripEntry trip = blockTrip.getTrip();
routeCollectionIds.add(trip.getRouteCollection().getId());
}
}
List<FrequencyBlockStopTimeIndex> frequencyIndices = _blockIndexService.getFrequencyStopTimeIndicesForStop(stopEntry);
for (FrequencyBlockStopTimeIndex blockStopTimeIndex : frequencyIndices) {
for (BlockTripEntry blockTrip : blockStopTimeIndex.getTrips()) {
TripEntry trip = blockTrip.getTrip();
routeCollectionIds.add(trip.getRouteCollection().getId());
}
}
return routeCollectionIds;
}
Aggregations