Class GetAllUserServiceImpl

java.lang.Object
com.skava.service.impl.GetAllUserServiceImpl
All Implemented Interfaces:
com.skava.core.EcommService<UserRequest,UserSearchResponse>, GetAllUserService

@Service @Transactional(propagation=REQUIRED, readOnly=true, noRollbackFor=java.lang.Exception.class) public class GetAllUserServiceImpl extends Object implements GetAllUserService
This service class implements GetAllUserService and handles the get all user service request, process it and save the details in DB. It also implements business logic required to retrieve all users present in a collection.
Author:
Infosys Equinox
  • Constructor Summary

    Constructors
    Constructor
    Description
    The class constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    checkUserSearchResponse(UserRequest request, List<UsersEntity> userListEntity, long usersCount)
    Used to load users based on search criteria.
    static jakarta.persistence.criteria.Predicate
    getCustomPropertiesSearchCriteria(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Predicate searchAllUserPropertiesPredicate, jakarta.persistence.criteria.Root<UsersEntity> root, SearchCriteria param)
    This method is used construct search predicate for custom properties search
    protected jakarta.persistence.criteria.Predicate
    getPredicateForExactSearchParams(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<UsersEntity> r, String searchValue, jakarta.persistence.criteria.Predicate currentPredicate, String key)
    This method is used add conditions based on the search parameter to predicate.
    protected jakarta.persistence.criteria.Predicate
    getPredicateForStringParam(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<UsersEntity> r, jakarta.persistence.criteria.Predicate predicate, SearchCriteria param, boolean isForNotOpertor)
    This method is used to get predicate for string parameter.
    jakarta.persistence.criteria.Predicate
    getSearchQueryCondition(List<SearchCriteria> params, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Predicate searchAllUserPropertiesPredicate, jakarta.persistence.criteria.Root<UsersEntity> root, String locale)
    This method used to get search query condition
    jakarta.persistence.criteria.Predicate
    getSearchQueryConditionForNotOperator(SearchCriteria searchParam, jakarta.persistence.criteria.Predicate searchAllUserPropertiesPredicate, jakarta.persistence.criteria.CriteriaBuilder buildr, jakarta.persistence.criteria.Root<UsersEntity> userRoot, String locale)
    This method is used to get search query condition for not operator
    getUserListSearchQuery(UserRequest request, List<SearchCriteria> params, String sortParameter, String sortOrder)
    This method is used to get list of users with search query
    List<com.skava.core.validation.ValidatorComponent>
    This method is used to get the respective validator class for this get all user service.
    Circuit breaker fall-back method monitors for failures and once failures reach certain threshold, the circuit breaker trips and returns error response accordingly - Method fallback.
    This service is used to search the user profile information of a particular collection either by applying filters or searching for all users irrespective of their status , type etc., within a range for the given page and size parameters.

    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

    • GetAllUserServiceImpl

      public GetAllUserServiceImpl()
      The class constructor.
  • Method Details

    • process

      @HystrixCommand(commandKey="user-key", fallbackMethod="methodFallback", ignoreExceptions=com.skava.core.validation.ValidateException.class) public UserSearchResponse process(UserRequest request)
      This service is used to search the user profile information of a particular collection either by applying filters or searching for all users irrespective of their status , type etc., within a range for the given page and size parameters.
      Specified by:
      process in interface com.skava.core.EcommService<UserRequest,UserSearchResponse>
      Parameters:
      request - Holds UserRequest object which is used to search the user details from database.
      Returns:
      The UserResponse object which returns the success response code and message on successful fetching of user details and if any validations fails, throws an validate exception.
    • checkUserSearchResponse

      public UserSearchResponse checkUserSearchResponse(UserRequest request, List<UsersEntity> userListEntity, long usersCount)
      Used to load users based on search criteria.
      Parameters:
      request - Holds UserRequest object which indicates the user request used for searching and sorting.
      userListEntity - Holds the List of UsersEntity object which contain list of searched user.
      usersCount - Indicates the count of users based on the search criteria.
      Returns:
      The UserSearchResponse object which returns the success response code and message. if any validations fails, throws validate exception.
    • getUserListSearchQuery

      public UserSearchModel getUserListSearchQuery(UserRequest request, List<SearchCriteria> params, String sortParameter, String sortOrder)
      This method is used to get list of users with search query
      Parameters:
      request - Holds UserRequest object which is used to load search params and collection id and user id.
      params - Holds the List of SearchCriteria object which contains the search params.
      sortParameter - a String sort parameter object.
      sortOrder - a String sort order object.
      Returns:
      The UserSearchModel object which returns the list of searched users.
    • getSearchQueryCondition

      public jakarta.persistence.criteria.Predicate getSearchQueryCondition(List<SearchCriteria> params, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Predicate searchAllUserPropertiesPredicate, jakarta.persistence.criteria.Root<UsersEntity> root, String locale)
      This method used to get search query condition
      Parameters:
      params - Holds the List of SearchCriteria object which contains the list of search criteria objects.
      builder - Holds CriteriaBuilder object used to form predicate.
      searchAllUserPropertiesPredicate - Holds Predicate object
      root - Holds Root of UsersEntity object which contains query for root entity.
      locale - a String object. API Response and error messages will be responded in the locale mentioned in this parameter.
      Returns:
      The Predicate which returns predicate object.
    • getCustomPropertiesSearchCriteria

      public static jakarta.persistence.criteria.Predicate getCustomPropertiesSearchCriteria(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Predicate searchAllUserPropertiesPredicate, jakarta.persistence.criteria.Root<UsersEntity> root, SearchCriteria param)
      This method is used construct search predicate for custom properties search
      Parameters:
      builder - - refers to the query builder
      searchAllUserPropertiesPredicate - - refers to the search criteria
      root - - root
      param - -param
      Returns:
      searchAllUserPropertiesPredicate
    • getSearchQueryConditionForNotOperator

      public jakarta.persistence.criteria.Predicate getSearchQueryConditionForNotOperator(SearchCriteria searchParam, jakarta.persistence.criteria.Predicate searchAllUserPropertiesPredicate, jakarta.persistence.criteria.CriteriaBuilder buildr, jakarta.persistence.criteria.Root<UsersEntity> userRoot, String locale)
      This method is used to get search query condition for not operator
      Parameters:
      searchParam - Holds the List of SearchCriteria object which contains the list of search criteria objects.
      searchAllUserPropertiesPredicate - Holds Predicate object
      buildr - Holds CriteriaBuilder object used to form predicate.
      userRoot - Holds Root of UsersEntity object which contains query for root entity.
      locale - a String object. API Response and error messages will be responded in the locale mentioned in this parameter.
      Returns:
      The Predicate which returns predicate object.
    • getPredicateForStringParam

      protected jakarta.persistence.criteria.Predicate getPredicateForStringParam(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<UsersEntity> r, jakarta.persistence.criteria.Predicate predicate, SearchCriteria param, boolean isForNotOpertor)
      This method is used to get predicate for string parameter.
      Parameters:
      builder - Holds CriteriaBuilder object used to form predicate.
      r - Holds the Root of UsersEntity object which contains query for root entity.
      predicate - Holds Predicate object which will generate predicate for each search params.
      param - Holds SearchCriteria object which is used to get search value.
      isForNotOpertor - Define the predicate for Not operator or else use default method
      Returns:
      The Predicate which returns predicate object.
    • getPredicateForExactSearchParams

      protected jakarta.persistence.criteria.Predicate getPredicateForExactSearchParams(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<UsersEntity> r, String searchValue, jakarta.persistence.criteria.Predicate currentPredicate, String key)
      This method is used add conditions based on the search parameter to predicate.
      Parameters:
      builder - Holds CriteriaBuilder object used to form predicate.
      r - Holds the Root of UsersEntity object which contains query for root entity.
      searchValue - Indicates the searched value.
      currentPredicate - Holds Predicate object which will generate predicate for each search params.
      key - Indicates the key value of the searched param.
      Returns:
      The Predicate which returns predicate.
    • methodFallback

      public UserSearchResponse methodFallback(UserRequest input)
      Circuit breaker fall-back method monitors for failures and once failures reach certain threshold, the circuit breaker trips and returns error response accordingly - Method fallback.
      Parameters:
      input - Holds UserRequest object.
      Returns:
      The UserSearchResponse object.
    • getValidator

      public List<com.skava.core.validation.ValidatorComponent> getValidator()
      This method is used to get the respective validator class for this get all user service.
      Specified by:
      getValidator in interface com.skava.core.EcommService<UserRequest,UserSearchResponse>
      Returns:
      The list of ValidatorComponent object.