Class UserAuthValidateNotificationServiceImpl

java.lang.Object
com.skava.service.impl.UserAuthValidateNotificationServiceImpl
All Implemented Interfaces:
com.skava.core.EcommService<UserNotificationRequest,UsersResponse>, UserAuthValidateNotificationService

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

    • UserAuthValidateNotificationServiceImpl

      public UserAuthValidateNotificationServiceImpl()
      Default Constructor
  • Method Details

    • process

      @SendEvent(eventType="userservice/usernotification/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 UsersResponse process(UserNotificationRequest request)
      This service is used to authenticate an user action like Add to cart, Checkout, Update password etc. by validating the password sent to user Email / SMS at the time of placing the request.
      Specified by:
      process in interface com.skava.core.EcommService<UserNotificationRequest,UsersResponse>
      Parameters:
      request - Holds UserNotificationRequest which is used to validate the notification param that is given from DB.
      Returns:
      The UsersResponse which returns the success response code and message and if any validations fails, throws an validate exception.
    • checkParamExpired

      public void checkParamExpired(String locale, String[] valueFromDB, long collectionId)
      Used to check whether the notification param is expired or not. If not yet matched then validate exception will be thrown.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      valueFromDB - Indicates the notification param from db used for validating the notification param.
      collectionId - Indicates the collection id for which the property gets loaded from DB within this collection id.
    • checkParamsMatched

      public void checkParamsMatched(String locale, String[] valueFromDB, String[] valueFromRequest)
      Used to check whether the notification param is matched or not. If not yet matched then validate exception will be thrown.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      valueFromDB - Indicates the notification param from db used for validating the notification param.
      valueFromRequest - Indicates the notification param from request used for validating the notification param.
    • getUserProperty

      public PropertiesEntity getUserProperty(String locale, long userId, String name)
      Used to gets the user notification property from DB for the requested user.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      userId - Indicates the user id for which user the notification param gets loaded from DB.
      name - Indicates the name of the property which needs to be loaded from DB.
      Returns:
      The PropertiesEntity object which returns the property value that gets loaded from DB.
    • getValidator

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

      public UsersResponse methodFallback(UserNotificationRequest 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 UserNotificationRequest object.
      Returns:
      The UsersResponse object.