Class SearchUtility

java.lang.Object
com.skava.search.util.SearchUtility

public final class SearchUtility extends Object
The Class SearchUtility
Since:
8.0
Author:
Infosys Equinox
  • Field Details

  • Method Details

    • isValidPageAndSize

      public static boolean isValidPageAndSize(int page, int size)
      Checks whether the page and size are valid
      Parameters:
      page - Requested page no from the request
      size - Size of the page
      Returns:
      it returns boolean true/false
    • checkIfAttributeIsAvailable

      public static Attributes checkIfAttributeIsAvailable(List<Attributes> attributes, Map.Entry<String,String> entry)
    • isValidId

      public static boolean isValidId(long id)
      Converts given values to appropriate ordinal values
      Parameters:
      id - identifier of the collection to be validated
      Returns:
      returns the boolean value
    • validateCollectionName

      public static String validateCollectionName(String name)
      Checks the collection name whether its non-empty and valid
      Parameters:
      name - name of the collection to be validated
      Returns:
      returns the error code for validation.
    • validateCollectionDesc

      public static String validateCollectionDesc(String description)
      Checks the collection description whether is valid
      Parameters:
      description - name of the collection to be validated
      Returns:
      returns the error code for validation.
    • validateLocale

      public static void validateLocale(String locale)
      SkuId Validation
      Parameters:
      locale - It contains locale of the item.
    • validateParams

      public static boolean validateParams(Object[] params)
      Parameters:
      params - Object array that
      Returns:
      boolean
    • isStringValid

      public static boolean isStringValid(String str)
      Method used to verify whether the string is valid or not.
      Parameters:
      str - String
      Returns:
      boolean
    • validateAndReturnObjectStringValue

      public static String validateAndReturnObjectStringValue(Object obj)
      This method is used to verify whether the object toString value is valid or not.
      Parameters:
      obj - Object
      Returns:
      String
    • validateRequiredFacets

      public static void validateRequiredFacets(SearchDO searchDO, List<Attributes> attributes)
      This function is used to validate the required facets.
      Parameters:
      searchDO - contains the search request internal details
      attributes - contains the attributes of configuration
    • validateRequiredSorts

      public static void validateRequiredSorts(SearchDO searchDO, List<Attributes> attributes)
      This function is used to validate the required sorts.
      Parameters:
      searchDO - contains the search request internal details
      attributes - contains the config attributes.
    • convertLocalDateTimeToString

      public static String convertLocalDateTimeToString(LocalDateTime date)
      This will convert the local DateAndTime to string.
      Parameters:
      date - LocalDateAndTime
      Returns:
      String
    • isListValid

      public static boolean isListValid(List<?> products)
      This method is used to validate a List object.
      Parameters:
      products - holds list of objects
      Returns:
      boolean
    • getSort

      public static org.springframework.data.domain.Sort getSort(com.skava.core.qdsl.sort.EcomSorts sort)
      This function is used perform sort operation
      Parameters:
      sort - This param contains the fields and operations for sorting
      Returns:
      Sort.
    • mergeString

      public static String mergeString(List<String> words, Character combiner)
      To merge list of words to single string
      Parameters:
      words - List of Words to merge
      combiner - delimiter for the string, its default space
      Returns:
      combined string
    • convertStringToLocalDateTime

      public static LocalDateTime convertStringToLocalDateTime(String time, String errorCode)
      Parse the string to LocalDateTime
      Parameters:
      time - timestamp as string
      errorCode - Code will be returned if parsing fails
      Returns:
      It returns the LocalDateTime.
    • validateEntityId

      public static void validateEntityId(long entityId, String entity)
      Checks entity id whether its valid
      Parameters:
      entityId - identifier of the entity to be validated
      entity - name of the entity to be validated
    • setResponseModel

      public static com.skava.core.ResponseModel setResponseModel(String responseCode, String message)
      Sets the response model.
      Parameters:
      responseCode - the response code
      message - the message
      Returns:
      the response model