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 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 interface com.skava.core.EcommService<UserPropertiesRequest,UsersResponse>
      Parameters:
      request - Holds UserPropertiesRequest 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

      protected UsersEntity checkUserStatus(UserPropertiesRequest request)
      Loads the user from database and checks user status. If the validation of user fails, then it throw validate exceptions
      Parameters:
      request - Holds UserPropertiesRequest 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 - Holds Map which is used for updating user properties.
      usersEntity - Holds UsersEntity object which is used for updating custom properties.
      usersVO - Holds Users 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 - Holds Map which is used get updated custom properties from request.
      usersEntity - Holds UsersEntity object which is used get custom properties from request.
      Returns:
      The List of PropertiesEntity.
    • methodFallback

      public UsersResponse 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.
      Parameters:
      request - Holds UserPropertiesRequest object.
      Returns:
      The UsersResponse object .
    • getValidator

      public List<com.skava.core.validation.ValidatorComponent> getValidator()
      This method is used to get the respective validator class for this update custom property service.
      Specified by:
      getValidator in interface com.skava.core.EcommService<UserPropertiesRequest,UsersResponse>
      Returns:
      The list of ValidatorComponent object.
    • checkEmptyKeyValueCustomProperties

      public static boolean checkEmptyKeyValueCustomProperties(Map<String,String> customProperties)
      Checks for empty key value in customProperties map.
      Parameters:
      customProperties - Holds Map which is used to check empty key value.
      Returns:
      boolean a Boolean object. Returns true if the custom property value is empty.