Package com.skava.merchandise.util
Class MerchandiseUtil
java.lang.Object
com.skava.merchandise.util.MerchandiseUtil
This Class is used to write common methods which are used by more than one classes in merchandise service.
- Author:
- Infosys Equinox
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic MilestonegetCurrentMileStone(Milestone[] milestoneArr) This method is used to get current milestone in a array of milestones by comparing its start time, end time, priority and updated time.getFieldsNameFromClass(Class<?> compositeIdClass) This method is used to get fields name from class.static LocalDateTimegetLocalDateTimeFromEpoc(long previewTime) static voidignoreEmptyTags(CreativeRequest creative) This method is used to Ignore the tags which are invalid(empty/contains empty space).static voidignoreInvalidWidgetProperties(CreativeRequest creative) This method is used to Ignore the widget properties which contains empty name or value.static booleanisValidIdentifier(String identifier) This method is used to ensure whether the given Identifier is in alpha numeric format.static booleanisValidPageAndSize(int page, int size) This method is used to validate the page and size used in find all calls for API's.static voidpropertyValidate(String name, String value) This method validates whether the properties name contains the valid value.static voidsetCategoryPropertyName(CategoryProperty property, CategoryAttribute attributeObj, String defaultLocale) This method set Category property name from attribute entitystatic booleanupdateProductsAndAttributes(Milestone existingMilestoneEntity, Milestone entityToBeUpdated) This function is used to update products and attributes.static voidvalidateBusinessId(long businessId) This method is used to validates the business Id and throwsValidateExceptionexception, if it is not valid.static voidvalidateCollectionId(long collectionId) This method is used to validates the collection Id and throwsValidateExceptionexception, if it is not valid.static voidvalidateLocale(String locale) This method is used to validates the locale and throwsValidateExceptionexception, if it is not valid.static voidvalidateProductsUxdataAndRulesAgainstPageType(Milestone existingMilestoneEntity, PageType pageType) To validate the products,rules and search keyword fields against the category pageType.static voidvalidatePropertiesMaxArraySize(List<CategoryProperty> categoryProperties) *This method is used to validate the maximum size of properties It will throwValidateExceptionif the maximum size is reachedstatic voidvalidatePropertiesMaxSize(List<CategoryPropertyRequest> properties) *This method is used to validate the maximum size of properties It will throwValidateExceptionif the maximum size is reachedstatic voidvalidateProperty(String name, Map<String, CategoryProperty> propertyMap) This method will validate the property whether it's exists in DB.
-
Field Details
-
MAX_PAGE_SIZE
public static final int MAX_PAGE_SIZE- See Also:
-
MACRO_REGEX
- See Also:
-
MACRO_MIN
- See Also:
-
MACRO_MAX
- See Also:
-
MACRO_MAX_DIGIT
- See Also:
-
VALIDATION_ENUMDATA_DELIMITER
- See Also:
-
IDENTIFIER
- See Also:
-
-
Method Details
-
isValidPageAndSize
public static boolean isValidPageAndSize(int page, int size) This method is used to validate the page and size used in find all calls for API's.- Parameters:
page- It holds the value of the page to be validated.size- It holds the value of the size to be validated.- Returns:
- boolean It represents the validation results. true - valid, false - not valid.
-
isValidIdentifier
This method is used to ensure whether the given Identifier is in alpha numeric format.- Parameters:
identifier- It is the identifier to be checked.- Returns:
- boolean It represents the validation results. true - valid , false - not valid.
-
validateCollectionId
public static void validateCollectionId(long collectionId) This method is used to validates the collection Id and throwsValidateExceptionexception, if it is not valid.- Parameters:
collectionId- It contains identifier of a collection to be validated.
-
validateBusinessId
public static void validateBusinessId(long businessId) This method is used to validates the business Id and throwsValidateExceptionexception, if it is not valid.- Parameters:
businessId- It contains identifier of a business to be validated.
-
validateLocale
This method is used to validates the locale and throwsValidateExceptionexception, if it is not valid.- Parameters:
locale- It contains locale to be validated.
-
validatePropertiesMaxArraySize
*This method is used to validate the maximum size of properties It will throwValidateExceptionif the maximum size is reached- Parameters:
categoryProperties- It contains the list of properties to be validated.
-
validatePropertiesMaxSize
*This method is used to validate the maximum size of properties It will throwValidateExceptionif the maximum size is reached- Parameters:
properties- It contains the list of properties to be validated.
-
propertyValidate
This method validates whether the properties name contains the valid value.- Parameters:
name- It holds the value of name which is used to validate the value.value- It holds the value to be validated.
-
ignoreInvalidWidgetProperties
This method is used to Ignore the widget properties which contains empty name or value.- Parameters:
creative- It holds the creative which contains the properties with/without empty values to be Filtered.
-
ignoreEmptyTags
This method is used to Ignore the tags which are invalid(empty/contains empty space).- Parameters:
creative- It holds the creative which contains the tags with/without empty values to be Filtered.
-
getFieldsNameFromClass
This method is used to get fields name from class.- Parameters:
compositeIdClass- compositeIdClass- Returns:
List<String>
-
getCurrentMileStone
This method is used to get current milestone in a array of milestones by comparing its start time, end time, priority and updated time.- Parameters:
milestoneArr- It contains array of milestone to get current milestone.- Returns:
Milestone
-
validateProperty
This method will validate the property whether it's exists in DB. If not it will throwCategoryPropertyNotFoundExceptionexception- Parameters:
name- It holds the property name.propertyMap- It holds map of string and CategoryProperty.
-
setCategoryPropertyName
public static void setCategoryPropertyName(CategoryProperty property, CategoryAttribute attributeObj, String defaultLocale) This method set Category property name from attribute entity- Parameters:
property- Instance ofCategoryProperty.attributeObj- Optional ofCategoryAttribute.defaultLocale- collection default locale
-
updateProductsAndAttributes
public static boolean updateProductsAndAttributes(Milestone existingMilestoneEntity, Milestone entityToBeUpdated) This function is used to update products and attributes.- Parameters:
existingMilestoneEntity- Milestone entity fromDB.entityToBeUpdated- Milestone entity from input.- Returns:
- It returns the boolean value
-
validateProductsUxdataAndRulesAgainstPageType
public static void validateProductsUxdataAndRulesAgainstPageType(Milestone existingMilestoneEntity, PageType pageType) To validate the products,rules and search keyword fields against the category pageType.- Parameters:
existingMilestoneEntity- to get values to validate.pageType- pageType to validate milestone fields.
-
getLocalDateTimeFromEpoc
-