Package com.skava.service.impl
Class UpdateUserServiceImpl
java.lang.Object
com.skava.service.impl.UpdateUserServiceImpl
- All Implemented Interfaces:
com.skava.core.EcommService<UserRequest,
,UsersResponse> UpdateUserService
@Service
@Transactional(propagation=REQUIRED,
readOnly=false,
noRollbackFor=java.lang.Exception.class)
public class UpdateUserServiceImpl
extends Object
implements UpdateUserService
This service class implements UpdateUserService and handles the update user service request, process it and
save the details in DB. It also implements business logic required to update user information.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckMFAEnabledForUserUpdate
(UserRequest request, Collection collection, Users user, com.skava.core.event.EventClientComponent eventClientComponent, com.skava.core.auth.AuthTokenHandler authTokenHandler) This method is used to check whether MFA and merge enabled or not and send response based on the given request.checkUserStatus
(UserRequest request) This method is used to validate user status and on successful validation return the user object else throw validate exception.List<com.skava.core.validation.ValidatorComponent>
This method is used to get the respective validator class for this update user service.loadPropertyFromDb
(String name, long collectionId, String defaultValue) This method is used to load the collection property by the name and if it is null and assigns as truemethodFallback
(UserRequest request) Circuit breaker fall-back method monitors for failures and once failures reach certain threshold, the circuit breaker trips and returns error response accordingly.void
patchCustomProperties
(Users usersVO, UsersEntity existingUser, List<PropertiesEntity> savedUserProperties) process
(@Valid UserRequest request) This service is used to update user's profile information including identities.void
putCustomProperties
(Users usersVO, UsersEntity existingUser, List<PropertiesEntity> savedUserProperties, UsersEntity user) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.skava.core.EcommService
getValidateException, getValidator
-
Constructor Details
-
UpdateUserServiceImpl
public UpdateUserServiceImpl()Default Constructor
-
-
Method Details
-
process
@HystrixCommand(commandKey="user-key", fallbackMethod="methodFallback", ignoreExceptions=com.skava.core.validation.ValidateException.class) @SendEvent(eventType="userservice/user/update", identifier="response_users.id") public UsersResponse process(@Valid @Valid UserRequest request) This service is used to update user's profile information including identities. Unique identities alone will be accepted for the user within the collection else results in validation failure. Administrators (CSR) can update other user's profile information on their behalf.- Specified by:
process
in interfacecom.skava.core.EcommService<UserRequest,
UsersResponse> - Parameters:
request
- HoldsUserRequest
object which is used to update the properties from an user.- Returns:
- The
UsersResponse
object which returns the success response code and message and if any validations fails, throws an validate exception.
-
putCustomProperties
public void putCustomProperties(Users usersVO, UsersEntity existingUser, List<PropertiesEntity> savedUserProperties, UsersEntity user) - Parameters:
usersVO
-existingUser
-user
-savedUserProperties
-
-
patchCustomProperties
public void patchCustomProperties(Users usersVO, UsersEntity existingUser, List<PropertiesEntity> savedUserProperties) - Parameters:
usersVO
-existingUser
-savedUserProperties
-
-
loadPropertyFromDb
This method is used to load the collection property by the name and if it is null and assigns as true- Parameters:
name
- Indicates the name of the property name that is used for updating the user phone and email based on collection property.collectionId
- Indicates the collection id.- Returns:
- The valid property value.
-
getValidator
@ValidatorEvent(serviceName="customer", webhookName="userservice/validator/user", actionType="update") public List<com.skava.core.validation.ValidatorComponent> getValidator()This method is used to get the respective validator class for this update user service.- Specified by:
getValidator
in interfacecom.skava.core.EcommService<UserRequest,
UsersResponse> - Returns:
- The list of
ValidatorComponent
-
methodFallback
Circuit breaker fall-back method monitors for failures and once failures reach certain threshold, the circuit breaker trips and returns error response accordingly.- Parameters:
request
- HoldsUserRequest
object.- Returns:
- The
UsersResponse
object.
-
checkUserStatus
This method is used to validate user status and on successful validation return the user object else throw validate exception.- Parameters:
request
- HoldsUserRequest
which is used to load an user with user id from request and check whether the user is present or not and checks the user's status.- Returns:
- The
UsersEntity
which returns the user entity object on successful validations.
-
checkMFAEnabledForUserUpdate
public UsersResponse checkMFAEnabledForUserUpdate(UserRequest request, Collection collection, Users user, com.skava.core.event.EventClientComponent eventClientComponent, com.skava.core.auth.AuthTokenHandler authTokenHandler) This method is used to check whether MFA and merge enabled or not and send response based on the given request.- Parameters:
request
- HoldsUserRequest
to get request.collection
- HoldsCollection
to load collection properties from DB.user
- HoldsUsers
to load userid.eventClientComponent
- HoldsEventClientComponent
to trigger an event for MFA login.authTokenHandler
- HoldsAuthTokenHandler
to check auth token userid with authenticated user id.- Returns:
- The
UsersResponse
response object.
-