use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class AgencyBeanServiceImpl method getAgencyForId.
@Cacheable
public AgencyBean getAgencyForId(String id) {
AgencyNarrative agency = _narrativeService.getAgencyForId(id);
if (agency == null)
return null;
AgencyBean bean = new AgencyBean();
bean.setId(id);
bean.setLang(agency.getLang());
bean.setName(agency.getName());
bean.setPhone(agency.getPhone());
bean.setEmail(agency.getEmail());
bean.setTimezone(agency.getTimezone());
bean.setUrl(agency.getUrl());
bean.setDisclaimer(agency.getDisclaimer());
bean.setPrivateService(agency.isPrivateService());
bean.setFareUrl(agency.getFareUrl());
bean.setEmail(agency.getEmail());
return bean;
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class UserServiceImpl method getMinApiRequestIntervalForKey.
@Cacheable
@Transactional
@Override
public Long getMinApiRequestIntervalForKey(String key, @CacheableArgument(cacheRefreshIndicator = true) boolean forceRefresh) {
UserIndexKey indexKey = new UserIndexKey(UserIndexTypes.API_KEY, key);
UserIndex userIndex = getUserIndexForId(indexKey);
if (userIndex == null) {
return null;
}
User user = userIndex.getUser();
UserBean bean = getUserAsBean(user);
return bean.getMinApiRequestInterval();
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class ConfigurationServiceImpl method getConfiguration.
@Override
@Cacheable
public Map<String, Object> getConfiguration(@CacheableArgument(cacheRefreshIndicator = true) boolean forceRefresh, String contextPath) {
Map<String, Object> config = new HashMap<String, Object>();
for (ConfigurationSource source : _sources) {
Map<String, Object> sourceConfig = source.getConfiguration(contextPath);
config.putAll(sourceConfig);
}
return config;
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class AgencyServiceImpl method getAgencyIdsAndCoverageAreas.
@Cacheable
public Map<String, CoordinateBounds> getAgencyIdsAndCoverageAreas() {
Map<String, CoordinateBounds> boundsByAgencyId = new HashMap<String, CoordinateBounds>();
for (AgencyEntry agency : _graph.getAllAgencies()) {
CoordinateBounds bounds = new CoordinateBounds();
for (RouteCollectionEntry routeCollection : agency.getRouteCollections()) {
for (RouteEntry route : routeCollection.getChildren()) {
for (TripEntry trip : route.getTrips()) {
for (StopTimeEntry stopTime : trip.getStopTimes()) {
StopEntry stop = stopTime.getStop();
bounds.addPoint(stop.getStopLat(), stop.getStopLon());
}
}
}
}
boundsByAgencyId.put(agency.getId(), bounds);
}
return boundsByAgencyId;
}
use of org.onebusaway.container.cache.Cacheable in project onebusaway-application-modules by camsys.
the class RouteServiceImpl method getStopsForRouteCollection.
@Override
@Cacheable
public Collection<AgencyAndId> getStopsForRouteCollection(AgencyAndId id) {
Set<AgencyAndId> stopIds = new HashSet<AgencyAndId>();
RouteCollectionEntry routeCollectionEntry = _transitGraphDao.getRouteCollectionForId(id);
for (RouteEntry route : routeCollectionEntry.getChildren()) {
List<TripEntry> trips = route.getTrips();
for (TripEntry trip : trips) {
List<StopTimeEntry> stopTimes = trip.getStopTimes();
for (StopTimeEntry stopTime : stopTimes) stopIds.add(stopTime.getStop().getId());
}
}
return new ArrayList<AgencyAndId>(stopIds);
}
Aggregations