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 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 interface com.skava.core.EcommService<UserRequest,UsersResponse>
      Parameters:
      request - Holds UserRequest 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

      public String 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 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 interface com.skava.core.EcommService<UserRequest,UsersResponse>
      Returns:
      The list of ValidatorComponent
    • methodFallback

      public UsersResponse methodFallback(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.
      Parameters:
      request - Holds UserRequest object.
      Returns:
      The UsersResponse object.
    • checkUserStatus

      public UsersEntity checkUserStatus(UserRequest request)
      This method is used to validate user status and on successful validation return the user object else throw validate exception.
      Parameters:
      request - Holds UserRequest 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 - Holds UserRequest to get request.
      collection - Holds Collection to load collection properties from DB.
      user - Holds Users to load userid.
      eventClientComponent - Holds EventClientComponent to trigger an event for MFA login.
      authTokenHandler - Holds AuthTokenHandler to check auth token userid with authenticated user id.
      Returns:
      The UsersResponse response object.