use of org.onebusaway.presentation.model.DefaultSearchLocation in project onebusaway-application-modules by camsys.
the class DefaultSearchLocationServiceImpl method getDefaultSearchLocationForCurrentUser.
@Override
public DefaultSearchLocation getDefaultSearchLocationForCurrentUser() {
UserBean user = _currentUserService.getCurrentUser();
if (user != null && user.hasDefaultLocation()) {
return new DefaultSearchLocation(user.getDefaultLocationName(), user.getDefaultLocationLat(), user.getDefaultLocationLon(), false);
}
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
DefaultSearchLocation location = (DefaultSearchLocation) attributes.getAttribute(KEY_DEFAULT_SEARCH_LOCATION_FOR_SESSSION, RequestAttributes.SCOPE_SESSION);
return location;
}
use of org.onebusaway.presentation.model.DefaultSearchLocation in project onebusaway-application-modules by camsys.
the class ServiceAreaServiceImpl method getServiceArea.
@Override
public CoordinateBounds getServiceArea() {
DefaultSearchLocation location = _defaultSearchLocationService.getDefaultSearchLocationForCurrentUser();
if (location != null) {
double lat = location.getLat();
double lon = location.getLon();
return SphericalGeometryLibrary.bounds(lat, lon, _searchRadius);
}
return _defaultBounds;
}
use of org.onebusaway.presentation.model.DefaultSearchLocation in project onebusaway-application-modules by camsys.
the class DefaultSearchLocationServiceImpl method setDefaultLocationForCurrentUser.
@Override
public void setDefaultLocationForCurrentUser(String locationName, double lat, double lon) {
_currentUserService.setDefaultLocation(locationName, lat, lon);
DefaultSearchLocation location = new DefaultSearchLocation(locationName, lat, lon, true);
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
attributes.setAttribute(KEY_DEFAULT_SEARCH_LOCATION_FOR_SESSSION, location, RequestAttributes.SCOPE_SESSION);
}
Aggregations