use of org.onebusaway.transit_data_federation.services.transit_graph.TripEntry 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);
}
use of org.onebusaway.transit_data_federation.services.transit_graph.TripEntry in project onebusaway-application-modules by camsys.
the class BundleManagementServiceImpl method removeAndRebuildCache.
/**
***********************
* Private Helper Methods
************************
*/
private void removeAndRebuildCache() {
// give subclasses a chance to do work
timingHook();
_log.info("Clearing all caches...");
for (CacheManager cacheManager : CacheManager.ALL_CACHE_MANAGERS) {
_log.info("Found " + cacheManager.getName());
for (String cacheName : cacheManager.getCacheNames()) {
_log.info(" > Cache: " + cacheName);
cacheManager.getCache(cacheName).flush();
cacheManager.clearAllStartingWith(cacheName);
}
// why not?
cacheManager.clearAll();
}
// Rebuild cache
try {
List<AgencyWithCoverageBean> agenciesWithCoverage = _transitDataService.getAgenciesWithCoverage();
for (AgencyWithCoverageBean agencyWithCoverage : agenciesWithCoverage) {
AgencyBean agency = agencyWithCoverage.getAgency();
ListBean<String> stopIds = _transitDataService.getStopIdsForAgencyId(agency.getId());
for (String stopId : stopIds.getList()) {
_transitDataService.getStop(stopId);
}
ListBean<String> routeIds = _transitDataService.getRouteIdsForAgencyId(agency.getId());
for (String routeId : routeIds.getList()) {
_transitDataService.getStopsForRoute(routeId);
}
}
Set<AgencyAndId> shapeIds = new HashSet<AgencyAndId>();
for (TripEntry trip : _transitGraphDao.getAllTrips()) {
AgencyAndId shapeId = trip.getShapeId();
if (shapeId != null && shapeId.hasValues())
shapeIds.add(shapeId);
}
for (AgencyAndId shapeId : shapeIds) {
_transitDataService.getShapeForId(AgencyAndIdLibrary.convertToString(shapeId));
}
_log.info("cache clearing complete!");
} catch (Exception e) {
_log.error("Exception during cache rebuild: ", e.getMessage());
}
}
use of org.onebusaway.transit_data_federation.services.transit_graph.TripEntry in project onebusaway-application-modules by camsys.
the class NarrativeProviderImpl method getNarrativeForStopTimeEntry.
public StopTimeNarrative getNarrativeForStopTimeEntry(StopTimeEntry entry) {
TripEntry trip = entry.getTrip();
List<StopTimeNarrative> narratives = _stopTimeNarrativesByTripIdAndStopTimeSequence.get(trip.getId());
if (narratives == null)
return null;
int index = entry.getSequence();
return narratives.get(index);
}
Aggregations