use of org.onebusaway.transit_data.model.AgencyBean in project onebusaway-application-modules by camsys.
the class RouteBeanServiceImpl method getRouteBeanForRouteCollection.
/**
**
* Private Methods
***
*/
private RouteBean getRouteBeanForRouteCollection(AgencyAndId id, RouteCollectionNarrative rc) {
RouteBean.Builder bean = RouteBean.builder();
bean.setId(ApplicationBeanLibrary.getId(id));
bean.setShortName(rc.getShortName());
bean.setLongName(rc.getLongName());
bean.setColor(rc.getColor());
bean.setDescription(rc.getDescription());
bean.setTextColor(rc.getTextColor());
bean.setType(rc.getType());
bean.setUrl(rc.getUrl());
AgencyBean agency = _agencyBeanService.getAgencyForId(id.getAgencyId());
bean.setAgency(agency);
return bean.create();
}
use of org.onebusaway.transit_data.model.AgencyBean 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());
}
}
Aggregations