Package com.skava.search.util
Class SearchUtility
java.lang.Object
com.skava.search.util.SearchUtility
The Class SearchUtility
- Since:
- 8.0
- Author:
- Infosys Equinox
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Attributes
checkIfAttributeIsAvailable
(List<Attributes> attributes, Map.Entry<String, String> entry) static String
This will convert the local DateAndTime to string.static LocalDateTime
convertStringToLocalDateTime
(String time, String errorCode) Parse the string to LocalDateTimestatic org.springframework.data.domain.Sort
getSort
(com.skava.core.qdsl.sort.EcomSorts sort) This function is used perform sort operationstatic boolean
isListValid
(List<?> products) This method is used to validate a List object.static boolean
isStringValid
(String str) Method used to verify whether the string is valid or not.static boolean
isValidId
(long id) Converts given values to appropriate ordinal valuesstatic boolean
isValidPageAndSize
(int page, int size) Checks whether the page and size are validstatic String
mergeString
(List<String> words, Character combiner) To merge list of words to single stringstatic com.skava.core.ResponseModel
setResponseModel
(String responseCode, String message) Sets the response model.static String
This method is used to verify whether the object toString value is valid or not.static String
validateCollectionDesc
(String description) Checks the collection description whether is validstatic String
validateCollectionName
(String name) Checks the collection name whether its non-empty and validstatic void
validateEntityId
(long entityId, String entity) Checks entity id whether its validstatic void
validateLocale
(String locale) SkuId Validationstatic boolean
validateParams
(Object[] params) static void
validateRequiredFacets
(SearchDO searchDO, List<Attributes> attributes) This function is used to validate the required facets.static void
validateRequiredSorts
(SearchDO searchDO, List<Attributes> attributes) This function is used to validate the required sorts.
-
Field Details
-
INDEX_NUMBER
- See Also:
-
INDEX_STRING
- See Also:
-
-
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 requestsize
- 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
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
Checks the collection description whether is valid- Parameters:
description
- name of the collection to be validated- Returns:
- returns the error code for validation.
-
validateLocale
SkuId Validation- Parameters:
locale
- It contains locale of the item.
-
validateParams
- Parameters:
params
- Object array that- Returns:
- boolean
-
isStringValid
Method used to verify whether the string is valid or not.- Parameters:
str
- String- Returns:
- boolean
-
validateAndReturnObjectStringValue
This method is used to verify whether the object toString value is valid or not.- Parameters:
obj
- Object- Returns:
- String
-
validateRequiredFacets
This function is used to validate the required facets.- Parameters:
searchDO
- contains the search request internal detailsattributes
- contains the attributes of configuration
-
validateRequiredSorts
This function is used to validate the required sorts.- Parameters:
searchDO
- contains the search request internal detailsattributes
- contains the config attributes.
-
convertLocalDateTimeToString
This will convert the local DateAndTime to string.- Parameters:
date
- LocalDateAndTime- Returns:
- String
-
isListValid
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
To merge list of words to single string- Parameters:
words
- List of Words to mergecombiner
- delimiter for the string, its default space- Returns:
- combined string
-
convertStringToLocalDateTime
Parse the string to LocalDateTime- Parameters:
time
- timestamp as stringerrorCode
- Code will be returned if parsing fails- Returns:
- It returns the LocalDateTime.
-
validateEntityId
Checks entity id whether its valid- Parameters:
entityId
- identifier of the entity to be validatedentity
- name of the entity to be validated
-
setResponseModel
Sets the response model.- Parameters:
responseCode
- the response codemessage
- the message- Returns:
- the response model
-