use of org.onebusaway.users.model.User in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method setLastSelectedStopIds.
@Override
public void setLastSelectedStopIds(List<String> stopIds) {
User user = _currentUserStrategy.getCurrentUser(true);
if (user == null)
return;
_userPropertiesService.setLastSelectedStopIds(user, stopIds);
}
use of org.onebusaway.users.model.User in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method setDefaultLocation.
@Override
public void setDefaultLocation(String locationName, double lat, double lon) {
User user = _currentUserStrategy.getCurrentUser(true);
if (user == null)
return;
_userPropertiesService.setDefaultLocation(user, locationName, lat, lon);
}
use of org.onebusaway.users.model.User in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method markServiceAlertAsRead.
@Override
public void markServiceAlertAsRead(String situationId, long time, boolean isRead) {
User user = _currentUserStrategy.getCurrentUser(true);
if (user == null)
return;
_userPropertiesService.markServiceAlertAsRead(user, situationId, time, isRead);
}
use of org.onebusaway.users.model.User in project onebusaway-application-modules by camsys.
the class CurrentUserServiceImpl method deleteCurrentUser.
@Override
public void deleteCurrentUser() {
User user = _currentUserStrategy.getCurrentUser(false);
if (user == null)
return;
_userService.deleteUser(user);
_currentUserStrategy.clearCurrentUser();
}
use of org.onebusaway.users.model.User in project onebusaway-application-modules by camsys.
the class UserServiceImpl method completePhoneNumberRegistration.
@Override
public UserIndex completePhoneNumberRegistration(UserIndex userIndex, String registrationCode) {
UserRegistration registration = _userIndexRegistrationService.getRegistrationForUserIndexKey(userIndex.getId());
if (registration == null)
return null;
String expectedCode = registration.getRegistrationCode();
if (!expectedCode.equals(registrationCode))
return null;
/**
* At this point, we have a valid registration code. We may safely clear the
* registration
*/
_userIndexRegistrationService.clearRegistrationForUserIndexKey(userIndex.getId());
User targetUser = _userDao.getUserForId(registration.getUserId());
if (targetUser == null)
return null;
User phoneUser = userIndex.getUser();
/**
* If the user index is already registered, our work is done
*/
if (phoneUser.equals(targetUser))
return userIndex;
/**
* If the phone user only has one index (the phoneNumber index), we merge
* the phone user with the registration target user. Otherwise, we keep the
* phone user, but just transfer the phone index
*/
if (phoneUser.getUserIndices().size() == 1) {
mergeUsers(userIndex.getUser(), targetUser);
} else {
userIndex.setUser(targetUser);
targetUser.getUserIndices().add(userIndex);
phoneUser.getUserIndices().remove(userIndex);
_userDao.saveOrUpdateUsers(phoneUser, targetUser);
}
// Refresh the user index
return getUserIndexForId(userIndex.getId());
}
Aggregations