Class ValidateActivationServiceImpl

java.lang.Object
com.skava.service.impl.ValidateActivationServiceImpl
All Implemented Interfaces:
com.skava.core.EcommService<UserActivationRequest,UserResponse>, ValidateActivationService

@Service @Transactional(noRollbackFor=java.lang.Exception.class) public class ValidateActivationServiceImpl extends Object implements ValidateActivationService
This service class implements ValidateActivationService and handles the validate activation service request, process it and save the details in DB. It also implements business logic required for user activation validation request.
Author:
Infosys Equinox
  • Constructor Details

    • ValidateActivationServiceImpl

      public ValidateActivationServiceImpl()
      Default Constructor
  • Method Details

    • methodFallback

      public UserResponse methodFallback(UserActivationRequest 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 UserActivationRequest object.
      Returns:
      The UserResponse object.
    • process

      @SendEvent(eventType="userservice/activation/patch", identifier="response_users.id") @HystrixCommand(commandKey="user-key", fallbackMethod="methodFallback", ignoreExceptions={com.skava.core.validation.ValidateException.class,java.lang.IllegalArgumentException.class,java.lang.IllegalStateException.class}) public UserResponse process(@Valid @Valid UserActivationRequest request)
      This method is used to validates the activation token of a user. On successful validation, it changes the users status from NOT ACTIVATED to ACTIVE. The activation param has an expiry constraint. The expiry constraint value has been used as a constant in the code itself. The default expiry value is 1 hour. Note: In case of activation failure, the new activation request has to be made and the activation parameter is generated by the POST - /users/activation API.
      Specified by:
      process in interface com.skava.core.EcommService<UserActivationRequest,UserResponse>
      Parameters:
      request - Holds UserActivationRequest object for validating the activation token. On successful validation, it changes the users status from NOT ACTIVATED to ACTIVE. If any validation fails, it throws the validate exception.
      Returns:
      The UserResponse which returns the success response code and message on successful validation of activation param and if any validations fails, throws an validate exception.
    • getValidator

      public List<com.skava.core.validation.ValidatorComponent> getValidator()
      This method is used to get the respective validator class for this validate activation service.
      Specified by:
      getValidator in interface com.skava.core.EcommService<UserActivationRequest,UserResponse>
      Returns:
      The list of ValidatorComponent object.
    • updatUserInformation

      public static UsersResponse updatUserInformation(UserCommonServices userCommonServices, long userId, UserActivationRequest request, long collectionId)
      This method is used to update user information in DB.
      Parameters:
      userCommonServices - Holds UserCommonServices object for updating the password.
      userId - Indicates the identifier of an user.
      request - Indicates the UserActivation Request from the input.
      collectionId - Indicates the collection id for which the limit property gets loaded.
      Returns:
      the UsersResponse object.
    • validateMFASignUpOTPAndToken

      public void validateMFASignUpOTPAndToken(String userEnteredOTP, Collection collection, long userId, String locale, boolean isResetOTP, String userOtp)
      This method used to validate login token and OTP
      Parameters:
      userEnteredOTP - user entered OTP from the request
      collection - HoldsCollection to load properties for this collection id.
      userId - Indicates the user id which is used to validate login token and OTP.
      locale - , language to display the messages.
      isResetOTP - Indicates the resetOTP.
      userOtp - The otp from the user db.
    • deleteLoginOTPAndLoginFailCountFromDBAndResendCount

      public void deleteLoginOTPAndLoginFailCountFromDBAndResendCount(long userId)
      This method used to delete user custom properties.
      Parameters:
      userId - Indicates the user id for which user the otp fail count, resend count and otp gets removed from DB.