Class UpdateAddressServiceImpl

java.lang.Object
com.skava.service.impl.UpdateAddressServiceImpl
All Implemented Interfaces:
com.skava.core.EcommService<UserAddressRequest,AddressesResponse>, UpdateAddressService

@Service @Transactional public class UpdateAddressServiceImpl extends Object implements UpdateAddressService
This service class implements UpdateAddressService and handles the update address service request, process it and save the details in DB. It also implements business logic required to update user address.
Author:
Infosys Equinox
  • Constructor Details

    • UpdateAddressServiceImpl

      public UpdateAddressServiceImpl()
      Default Constructor
  • Method Details

    • getValidator

      public List<com.skava.core.validation.ValidatorComponent> getValidator()
      This method is used to get the respective validator class for this update address service.
      Specified by:
      getValidator in interface com.skava.core.EcommService<UserAddressRequest,AddressesResponse>
      Returns:
      The List of ValidatorComponent object.
    • process

      @HystrixCommand(commandKey="user-key", fallbackMethod="methodFallback", ignoreExceptions=com.skava.core.validation.ValidateException.class) @SendEvent(eventType="userservice/address/update", identifier="response_addresses.id") public AddressesResponse process(UserAddressRequest request)
      This method is used to update an address for registered user. Only one address can be updated at a time Only one address can be marked as DEFAULT address.
      Specified by:
      process in interface com.skava.core.EcommService<UserAddressRequest,AddressesResponse>
      Parameters:
      request - Holds UserAddressRequest object which holds user address request for updating address for an user.
      Returns:
      The AddressesResponse which returns the success response code and message and if any validations fails, throws an validate exception.
    • methodFallback

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