Package com.skava.subscription.model
Class CommonUtil
java.lang.Object
com.skava.subscription.model.CommonUtil
The Class CommonUtil
- Since:
- March 2022
- Version:
- 8.11
- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetAttributeName(String attributeName) static Stringstatic com.fasterxml.jackson.databind.ObjectMapperstatic SkuPropertygetSkuPropertyObj(String keyStr, Object valueStr, String locale) static longgetTimeInMilliSeconds(String formattedDate, String dateFormatterPattern) static longgetTimeInMilliSeconds(String formattedDate, String dateFormatterPattern, String timeZone) static booleanChecks if the given user is guest or notstatic Booleanstatic booleanThis method will check the value is number or notstatic booleanisValidDecimalTypeID(Object obj, boolean isNullable) static booleanisValidFieldStr(Object strObj, int minLength, boolean isNullable) This method will check whether the field is valid string or notstatic booleanisValidFieldStr(Object strObj, int minLength, int maxLength, boolean isNullable) static booleanisValidLongTypeID(Object obj, boolean isNullable) static booleanisValidMapObject(Map<String, String> mapObject) This method will check the valid map object or notstatic booleanisValidNumericID(Object obj, boolean isNullable) This method will check valid numeric id or notstatic voidsetException(String responseCode, String responseMsg, List<CommonResponseModel> errorModel) This method is used to set exceptionstatic voidsetKafkaResponseData(org.apache.camel.Exchange exchange, String performedActionName, String partitionKey, String publishConnectionStr) This method will set the kafka response data
-
Method Details
-
setException
public static void setException(String responseCode, String responseMsg, List<CommonResponseModel> errorModel) This method is used to set exception- Parameters:
responseCode- responseCoderesponseMsg- responseMsgerrorModel- errorModel
-
isValidFieldStr
This method will check whether the field is valid string or not- Parameters:
strObj- strObjminLength- minLengthisNullable- isNullable- Returns:
- true or false
-
isValidFieldStr
public static boolean isValidFieldStr(Object strObj, int minLength, int maxLength, boolean isNullable) - Parameters:
strObj- strObjminLength- minLengthmaxLength- maxLengthisNullable- isNullable- Returns:
- true or false
-
isValidLongTypeID
- Parameters:
obj- objectisNullable- isNullable- Returns:
- true or false
-
isValidNumericID
This method will check valid numeric id or not- Parameters:
obj- objectisNullable- isNullable- Returns:
- true or false
-
isValidDecimalTypeID
- Parameters:
obj- objectisNullable- isNullable- Returns:
- true or false
-
isNumeric
This method will check the value is number or not- Parameters:
strNum- strNum- Returns:
- true or false
-
getConfiguredObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper getConfiguredObjectMapper()- Returns:
- ObjectMapper
-
getSkuPropertyObj
- Parameters:
keyStr- keyStrvalueStr- valueStrlocale- locale- Returns:
- sku property
-
setKafkaResponseData
public static void setKafkaResponseData(org.apache.camel.Exchange exchange, String performedActionName, String partitionKey, String publishConnectionStr) This method will set the kafka response data- Parameters:
exchange- exchangeperformedActionName- performedActionNamepartitionKey- partitionKeypublishConnectionStr- publishConnectionStr
-
isGuest
Checks if the given user is guest or not- Parameters:
users- describes users details- Returns:
- to return boolean values
-
isValidMapObject
This method will check the valid map object or not- Parameters:
mapObject- mapObject- Returns:
- true or false
-
isNonNullAndEmptyStr
- Parameters:
str- string- Returns:
- true or false
-
getBooleanValueAsStr
- Parameters:
obj- object- Returns:
- string
-
getAttributeName
- Parameters:
attributeName- attributeName- Returns:
- attributeName
-
getTimeInMilliSeconds
- Parameters:
formattedDate- formattedDatedateFormatterPattern- dateFormatterPattern- Returns:
- time
-
getTimeInMilliSeconds
public static long getTimeInMilliSeconds(String formattedDate, String dateFormatterPattern, String timeZone) - Parameters:
formattedDate- formattedDatedateFormatterPattern- dateFormatterPatterntimeZone- timeZone- Returns:
- time in milliseconds
-