Package com.skava.service.impl
Class CreateAddressesServiceImpl
java.lang.Object
com.skava.service.impl.CreateAddressesServiceImpl
- All Implemented Interfaces:
com.skava.core.EcommService<UserAddressRequest,
,AddressesResponse> CreateAddressesService
@Service
@Transactional
public class CreateAddressesServiceImpl
extends Object
implements CreateAddressesService
This service class implements CreateAddressesService and handles the create address service request, process it
and save the details in DB. It also implements business logic required to create address for a user.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<com.skava.core.validation.ValidatorComponent>
This method is used to get the respective validator class for this create address service.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.process
(@Valid UserAddressRequest request) This method is used to create new address for the registered 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
-
CreateAddressesServiceImpl
public CreateAddressesServiceImpl()Default Constructor
-
-
Method Details
-
getValidator
This method is used to get the respective validator class for this create address service.- Specified by:
getValidator
in interfacecom.skava.core.EcommService<UserAddressRequest,
AddressesResponse> - Returns:
- The list of
ValidatorComponent
object.
-
process
@SendEvent(eventType="userservice/addresses/create", identifier="response_addresses.id") @HystrixCommand(commandKey="user-key", fallbackMethod="methodFallback", ignoreExceptions=com.skava.core.validation.ValidateException.class) public AddressesResponse process(@Valid @Valid UserAddressRequest request) This method is used to create new address for the registered user. Only one address can be created at a time All addresses are considered as Shipping address and maximum of 20 addresses can be added for an user. Only one address can be added for an user simultaneously and one can be marked as DEFAULT address.- Specified by:
process
in interfacecom.skava.core.EcommService<UserAddressRequest,
AddressesResponse> - Parameters:
request
- HoldsUserAddressRequest
holds user address request which is used to create address for an user.- Returns:
- Holds
AddressesResponse
which returns the success response code and message on successful validations and if any validations fails, throws an validate exception.
-
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
- HoldsUserAddressRequest
object.- Returns:
- The
UsersResponse
object.
-