U - as UserT - as ResetPasswordResponsepublic class UserServiceImpl<U extends User,R extends ResetPassword.ResetPasswordResponse> extends Object implements UserService<U,R>, ChangeGenerator<Object>
ChangeGenerator; it will also generate Events of TypeResetPassword.ResetPasswordResponse| Constructor and Description |
|---|
UserServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(ChangeListener changeListener)
Allow Notify all
ChangeListeners about a change |
void |
changePassword(String userNameId,
String existingPassword,
String newPassword) |
void |
changePasswordRestrictedAccess(String userChangingThePassword,
String userNameId,
String newPassword)
Whenere another user can change for the given user but the user id of the change request should be supplied to validate if the changer has authority to do sp
|
protected String |
generatePassword() |
<E> Supplier<E> |
getEnvironmentSupplier(Object... userEnvRelatedObjects)
|
List |
getListeners()
Get list directly.
|
UserDao |
getUserDao() |
void |
notifyAllListeners(Object object)
Whenever a node is selected/updated, it also notifies its listeners.
|
U |
notifyChange(String eventName,
U user)
Any change in User object, notify the change using the changed object
|
void |
onResetFail(String userNameId,
Exception e)
Due to some reason the requested action to reset password for user with ud = userNameId failed.
|
void |
onResetSuccess(String userNameId,
R passwordResetResponse)
For a valid userNameId the password was successfully reset, allow other action to be taken on success status
|
R |
resetPassword(String userNameId)
Reset the password for the User with userNameId and product a Response of type R.
Callbacks ResetPassword.onResetSuccess(java.lang.String, R) and ResetPassword.onResetFail(java.lang.String, java.lang.Exception) |
void |
save(Credentials credentials) |
U |
save(U user) |
void |
setListeners(List listeners)
Set list directly.
|
protected R |
setupResponse(String userNameId,
String newPassword)
Please note this method is called before the newPassword is persisted.
|
void |
setUserDao(UserDao userDao) |
<E> void |
updateShell(Shell<E> shell,
E environment,
U user)
Once we have a User object, update the
Shell with it with any environment or contextual details. |
void |
updateShell(Shell shell,
U user)
UserService.updateShell(Shell, Object, User) where the environment does not need to be specified and is assumed
self-dervied from the user |
@Transactional(readOnly=false) public void changePassword(String userNameId, String existingPassword, String newPassword) throws Exception
changePassword in interface ChangePasswordExceptionpublic void changePasswordRestrictedAccess(String userChangingThePassword, String userNameId, String newPassword) throws Exception
ChangePasswordchangePasswordRestrictedAccess in interface ChangePasswordException@Transactional(readOnly=false) public void save(Credentials credentials)
save in interface ChangePassword@Transactional(readOnly=false) public U save(U user)
save in interface UserService<U extends User,R extends ResetPassword.ResetPasswordResponse>public UserDao getUserDao()
getUserDao in interface UserService<U extends User,R extends ResetPassword.ResetPasswordResponse>public void setUserDao(UserDao userDao)
protected String generatePassword()
protected R setupResponse(String userNameId, String newPassword) throws Exception
ResetPassword.ResetPasswordResponse.getResponseCode()userNameId - as StringnewPassword - as StringResetPassword.ResetPasswordResponseExceptionpublic R resetPassword(String userNameId) throws Exception
ResetPasswordResetPassword.onResetSuccess(java.lang.String, R) and ResetPassword.onResetFail(java.lang.String, java.lang.Exception)resetPassword in interface ResetPassword<R extends ResetPassword.ResetPasswordResponse>Exceptionpublic void onResetSuccess(String userNameId, R passwordResetResponse)
ResetPasswordonResetSuccess in interface ResetPassword<R extends ResetPassword.ResetPasswordResponse>userNameId - as Stringpublic void onResetFail(String userNameId, Exception e)
ResetPasswordonResetFail in interface ResetPassword<R extends ResetPassword.ResetPasswordResponse>userNameId - as Stringe - as Exception detailspublic <E> Supplier<E> getEnvironmentSupplier(Object... userEnvRelatedObjects)
User.getEnvironmentSupplier() and Role.getEnvironmentSupplier().
In case of multiple Roles or names of Roles; merge and decide the final Supplier of the environment context.
This implementation assumes all user Environment Related Objects to be String names of Roles and the first as User.getEnvironmentSupplier().
getEnvironmentSupplier in interface UserService<U extends User,R extends ResetPassword.ResetPasswordResponse>userEnvRelatedObjects - can be User, Role, String (Role Name), or any Object assumed to be a context itself.Supplier of environment Objectpublic <E> void updateShell(Shell<E> shell, E environment, U user)
Shell with it with any environment or contextual details.updateShell in interface UserService<U extends User,R extends ResetPassword.ResetPasswordResponse>shell - as Shellenvironment - as Object (supplied by caller who has access to the raw environment). See example UserShell.getEnvironment().
An environment may also be derived from user or role. See UserService.getEnvironmentSupplier(Object...)user - as Userpublic void updateShell(Shell shell, U user)
UserService.updateShell(Shell, Object, User) where the environment does not need to be specified and is assumed
self-dervied from the userupdateShell in interface UserService<U extends User,R extends ResetPassword.ResetPasswordResponse>shell - as Shelluser - as Userhere varargs param = user; to derive environment by defaultpublic void addChangeListener(ChangeListener changeListener)
ChangeGeneratorChangeListeners about a changeaddChangeListener in interface ChangeGenerator<Object>public void notifyAllListeners(Object object)
ChangeGeneratornotifyAllListeners in interface ChangeGenerator<Object>public List getListeners()
ChangeGeneratorgetListeners in interface ChangeGenerator<Object>public void setListeners(List listeners)
ChangeGeneratorsetListeners in interface ChangeGenerator<Object>public U notifyChange(String eventName, U user)
UserServicenotifyChange in interface UserService<U extends User,R extends ResetPassword.ResetPasswordResponse>eventName - as Stringuser - as User type UserCopyright © 2018. All rights reserved.