Package com.skava.service.impl
Class UpdateCustomPropertyServiceImpl
java.lang.Object
com.skava.service.impl.UpdateCustomPropertyServiceImpl
- All Implemented Interfaces:
com.skava.core.EcommService<UserPropertiesRequest,
,UsersResponse> UpdateCustomPropertyService
@Service
@Transactional
public class UpdateCustomPropertyServiceImpl
extends Object
implements UpdateCustomPropertyService
This service class implements UpdateCustomPropertyService and handles the update custom property service request,
process it and save the details in DB. It also implements business logic required to update user custom property.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkEmptyKeyValueCustomProperties
(Map<String, String> customProperties) Checks for empty key value in customProperties map.protected UsersEntity
checkUserStatus
(UserPropertiesRequest request) Loads the user from database and checks user status.static List<PropertiesEntity>
getUpdatedProperties
(Map<String, String> propertiesToUpdate, UsersEntity usersEntity) Used to get updated properties from the request.List<com.skava.core.validation.ValidatorComponent>
This method is used to get the respective validator class for this update custom property service.methodFallback
(UserPropertiesRequest 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 UserPropertiesRequest request) This method is used to update custom property for a user.protected void
updateCustomProperty
(Map<String, String> propertiesToUpdate, UsersEntity usersEntity, Users usersVO) This method is used to update the custom property based on the given user properties request and users entity.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
-
UpdateCustomPropertyServiceImpl
public UpdateCustomPropertyServiceImpl()Default Constructor
-
-
Method Details
-
process
@SendEvent(eventType="userservice/customproperty/patch", identifier="response_users.id") @HystrixCommand(commandKey="user-key", fallbackMethod="methodFallback", ignoreExceptions=com.skava.core.validation.ValidateException.class) public UsersResponse process(@Valid @Valid UserPropertiesRequest request) This method is used to update custom property for a user.- Specified by:
process
in interfacecom.skava.core.EcommService<UserPropertiesRequest,
UsersResponse> - Parameters:
request
- HoldsUserPropertiesRequest
object which contains custom property request that needs to be updated.- Returns:
- The
UsersResponse
object which returns the success response code and message and if any validations fails, throws an validate exception.
-
checkUserStatus
Loads the user from database and checks user status. If the validation of user fails, then it throw validate exceptions- Parameters:
request
- HoldsUserPropertiesRequest
object which is used to load user from DB and checks users status.- Returns:
- The
UsersEntity
object on successful validations, if any validations fails it throw validate exceptions
-
updateCustomProperty
protected void updateCustomProperty(Map<String, String> propertiesToUpdate, UsersEntity usersEntity, Users usersVO) This method is used to update the custom property based on the given user properties request and users entity.- Parameters:
propertiesToUpdate
- HoldsMap
which is used for updating user properties.usersEntity
- HoldsUsersEntity
object which is used for updating custom properties.usersVO
- HoldsUsers
object which is used for updating users custom properties.
-
getUpdatedProperties
public static List<PropertiesEntity> getUpdatedProperties(Map<String, String> propertiesToUpdate, UsersEntity usersEntity) Used to get updated properties from the request.- Parameters:
propertiesToUpdate
- HoldsMap
which is used get updated custom properties from request.usersEntity
- HoldsUsersEntity
object which is used get custom properties from request.- Returns:
- The
List
ofPropertiesEntity
.
-
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
- HoldsUserPropertiesRequest
object.- Returns:
- The
UsersResponse
object .
-
getValidator
This method is used to get the respective validator class for this update custom property service.- Specified by:
getValidator
in interfacecom.skava.core.EcommService<UserPropertiesRequest,
UsersResponse> - Returns:
- The list of
ValidatorComponent
object.
-
checkEmptyKeyValueCustomProperties
Checks for empty key value in customProperties map.
-