Class Functions
- java.lang.Object
-
- de.hybris.platform.acceleratorstorefrontcommons.tags.Functions
-
public class Functions extends java.lang.ObjectJSP EL Functions. This file contains static methods that are used by JSP EL.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_HOMEPAGE_URL
-
Constructor Summary
Constructors Constructor Description Functions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanarrayContainsInstance(java.lang.String[] stringArr, java.lang.String string)Check if array contains instance.static booleancheckIfPickupEnabledForStore()Utility tag function to check if Pickup mode is enabled for the current base store.protected static java.lang.StringconvertWithProperConverter(Converter<ProductModel,ProductData> productUrlConverter, ProductModel product)static booleandoesAppliedPromotionExistForOrderEntry(CartData cart, int entryNumber)Test if a cart has an applied promotion for the specified entry number.static booleandoesAppliedPromotionExistForOrderEntryOrOrderEntryGroup(CartData cart, OrderEntryData entry)Test if a cart has an applied promotion for the specified entry or grouped entry.static booleandoesPotentialPromotionExistForOrderEntry(CartData cart, int entryNumber)Test if a cart has an potential promotion for the specified entry number.static booleandoesPotentialPromotionExistForOrderEntryOrOrderEntryGroup(CartData cart, OrderEntryData entry)Test if a cart has an potential promotion for the specified entry or entry group.protected static booleandoesPromotionExistForOrderEntry(java.lang.Integer entryNumberToFind, PromotionResultData productPromotion)static booleandoesPromotionExistForOrderEntry(java.util.List<PromotionResultData> productPromotions, int entryNumber)static java.lang.StringencodeHTML(java.lang.String valueToBeEncoded)Utility method that encodes the given input as HTMLstatic java.lang.StringencodeJavaScript(java.lang.String valueToBeEncoded)Utility method that encodes the given input as HTMLstatic java.lang.StringencodeUrl(java.lang.String url)Utility method that encodes given URLstatic booleanevaluateRestrictions(AbstractCMSComponentModel model)protected static java.lang.StringgetCategoryUrl(CMSLinkComponentModel component, Converter<CategoryModel,CategoryData> categoryUrlConverter)protected static Converter<CategoryModel,CategoryData>getCategoryUrlConverter(javax.servlet.http.HttpServletRequest httpRequest)protected static CMSPageContextServicegetCMSPageContextService(javax.servlet.http.HttpServletRequest httpRequest)protected static CMSPageSlotComponentServicegetCMSPageSlotComponentService(javax.servlet.http.HttpServletRequest httpRequest)protected static javax.servlet.http.HttpServletRequestgetCurrentRequest()protected static ImageDatagetImageData(ProductData product, java.lang.String productCode, java.lang.String format)protected static ImageDatagetImageForFormat(java.util.Collection<ImageData> images, java.lang.String format)static ImageDatagetImageForProductCode(ProductData product, java.lang.String productCode, java.lang.String format)JSP EL Function to get an image for a Product in a specific format based on the product code.static ImageDatagetImageForStoreAndFormat(PointOfServiceData store, java.lang.String format)JSP EL Function to get an Image for a Store in a specific formatstatic ImageDatagetPrimaryImageForProductAndFormat(ProductData product, java.lang.String format)JSP EL Function to get a primary Image for a Product in a specific formatprotected static ImageDatagetPrimaryImageForTypeAndFormat(java.util.Collection<ImageData> images, java.lang.String format)protected static Converter<ProductModel,ProductData>getProductUrlConverter(javax.servlet.http.HttpServletRequest httpRequest)protected static QuoteUserIdentificationStrategygetQuoteUserIdentificationStrategy(javax.servlet.http.HttpServletRequest httpRequest)protected static QuoteUserTypeIdentificationStrategygetQuoteUserTypeIdentificationStrategy(javax.servlet.http.HttpServletRequest httpRequest)static <T> TgetSpringBean(javax.servlet.http.HttpServletRequest httpRequest, java.lang.String beanName, java.lang.Class<T> beanClass)Returns the Spring bean with namebeanNameand of typebeanClass.static java.lang.StringgetUrlForCMSLinkComponent(CMSLinkComponentModel component)JSP EL Function to get the URL for a CMSLinkComponentstatic java.lang.StringgetUrlForCMSLinkComponent(CMSLinkComponentModel component, Converter<ProductModel,ProductData> productUrlConverter, Converter<CategoryModel,CategoryData> categoryUrlConverter)static booleanisConsumedByEntry(PromotionOrderEntryConsumedData consumed, OrderEntryData entry)Test if entry or grouped entry belongs to consumed entrystatic booleanisExtensionInstalled(java.lang.String extensionName)static booleanisQuoteUserSalesRep()static booleanisQuoteUserSellerApprover()static java.lang.StringnormalizedCode(java.lang.String code)Returns normalized code for selection data codestatic java.lang.StringsanitizeHtmlTagName(java.lang.String tag)Validates that tag is a valid HTML tag name
-
-
-
Field Detail
-
DEFAULT_HOMEPAGE_URL
public static final java.lang.String DEFAULT_HOMEPAGE_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPrimaryImageForProductAndFormat
public static ImageData getPrimaryImageForProductAndFormat(ProductData product, java.lang.String format)
JSP EL Function to get a primary Image for a Product in a specific format- Parameters:
product- the productformat- the desired format- Returns:
- the image
-
getPrimaryImageForTypeAndFormat
protected static ImageData getPrimaryImageForTypeAndFormat(java.util.Collection<ImageData> images, java.lang.String format)
-
getImageForStoreAndFormat
public static ImageData getImageForStoreAndFormat(PointOfServiceData store, java.lang.String format)
JSP EL Function to get an Image for a Store in a specific format- Parameters:
store- the storeformat- the desired image format- Returns:
- the image
-
getImageForFormat
protected static ImageData getImageForFormat(java.util.Collection<ImageData> images, java.lang.String format)
-
getUrlForCMSLinkComponent
public static java.lang.String getUrlForCMSLinkComponent(CMSLinkComponentModel component)
JSP EL Function to get the URL for a CMSLinkComponent- Parameters:
component- The Link Component- Returns:
- The URL
-
getUrlForCMSLinkComponent
public static java.lang.String getUrlForCMSLinkComponent(CMSLinkComponentModel component, Converter<ProductModel,ProductData> productUrlConverter, Converter<CategoryModel,CategoryData> categoryUrlConverter)
-
getCategoryUrl
protected static java.lang.String getCategoryUrl(CMSLinkComponentModel component, Converter<CategoryModel,CategoryData> categoryUrlConverter)
-
convertWithProperConverter
protected static java.lang.String convertWithProperConverter(Converter<ProductModel,ProductData> productUrlConverter, ProductModel product)
-
evaluateRestrictions
public static boolean evaluateRestrictions(AbstractCMSComponentModel model)
-
getProductUrlConverter
protected static Converter<ProductModel,ProductData> getProductUrlConverter(javax.servlet.http.HttpServletRequest httpRequest)
-
getCategoryUrlConverter
protected static Converter<CategoryModel,CategoryData> getCategoryUrlConverter(javax.servlet.http.HttpServletRequest httpRequest)
-
getCMSPageContextService
protected static CMSPageContextService getCMSPageContextService(javax.servlet.http.HttpServletRequest httpRequest)
-
getCMSPageSlotComponentService
protected static CMSPageSlotComponentService getCMSPageSlotComponentService(javax.servlet.http.HttpServletRequest httpRequest)
-
getSpringBean
public static <T> T getSpringBean(javax.servlet.http.HttpServletRequest httpRequest, java.lang.String beanName, java.lang.Class<T> beanClass)Returns the Spring bean with namebeanNameand of typebeanClass.- Type Parameters:
T- type of the bean- Parameters:
httpRequest- the http requestbeanName- name of the beanbeanClass- expected type of the bean- Returns:
- the bean matching the given arguments or
nullif no bean could be resolved
-
isConsumedByEntry
public static boolean isConsumedByEntry(PromotionOrderEntryConsumedData consumed, OrderEntryData entry)
Test if entry or grouped entry belongs to consumed entry- Parameters:
consumed-entry-- Returns:
- true if consumed entry and entry/grouped entry corresponds to each other otherwise false
-
doesAppliedPromotionExistForOrderEntry
public static boolean doesAppliedPromotionExistForOrderEntry(CartData cart, int entryNumber)
Test if a cart has an applied promotion for the specified entry number.- Parameters:
cart- the cartentryNumber- the entry number- Returns:
- true if there is an applied promotion for the entry number
-
doesAppliedPromotionExistForOrderEntryOrOrderEntryGroup
public static boolean doesAppliedPromotionExistForOrderEntryOrOrderEntryGroup(CartData cart, OrderEntryData entry)
Test if a cart has an applied promotion for the specified entry or grouped entry.- Parameters:
cart- the cartentry- the order entry- Returns:
- true if there is an applied promotion for the entry number
-
doesPotentialPromotionExistForOrderEntry
public static boolean doesPotentialPromotionExistForOrderEntry(CartData cart, int entryNumber)
Test if a cart has an potential promotion for the specified entry number.- Parameters:
cart- the cartentryNumber- the entry number- Returns:
- true if there is an potential promotion for the entry number
-
doesPotentialPromotionExistForOrderEntryOrOrderEntryGroup
public static boolean doesPotentialPromotionExistForOrderEntryOrOrderEntryGroup(CartData cart, OrderEntryData entry)
Test if a cart has an potential promotion for the specified entry or entry group.- Parameters:
cart- the cartentry- the entry- Returns:
- true if there is an potential promotion for the entry or entry group
-
doesPromotionExistForOrderEntry
public static boolean doesPromotionExistForOrderEntry(java.util.List<PromotionResultData> productPromotions, int entryNumber)
-
doesPromotionExistForOrderEntry
protected static boolean doesPromotionExistForOrderEntry(java.lang.Integer entryNumberToFind, PromotionResultData productPromotion)
-
encodeUrl
public static java.lang.String encodeUrl(java.lang.String url)
Utility method that encodes given URL- Parameters:
url- the url to encode- Returns:
- encoded URL
-
encodeHTML
public static java.lang.String encodeHTML(java.lang.String valueToBeEncoded)
Utility method that encodes the given input as HTML- Parameters:
valueToBeEncoded- the value to encode- Returns:
- value encoded as HTML
-
sanitizeHtmlTagName
public static java.lang.String sanitizeHtmlTagName(java.lang.String tag)
Validates that tag is a valid HTML tag name- Parameters:
tag- HTML tag name- Returns:
- tag if valid, div if it is not valid.
-
encodeJavaScript
public static java.lang.String encodeJavaScript(java.lang.String valueToBeEncoded)
Utility method that encodes the given input as HTML- Parameters:
valueToBeEncoded- the value to encode- Returns:
- value encoded as JavaScript
-
checkIfPickupEnabledForStore
public static boolean checkIfPickupEnabledForStore()
Utility tag function to check if Pickup mode is enabled for the current base store.- Returns:
- boolean
-
getCurrentRequest
protected static javax.servlet.http.HttpServletRequest getCurrentRequest()
-
isExtensionInstalled
public static boolean isExtensionInstalled(java.lang.String extensionName)
-
isQuoteUserSalesRep
public static boolean isQuoteUserSalesRep()
-
isQuoteUserSellerApprover
public static boolean isQuoteUserSellerApprover()
-
getQuoteUserTypeIdentificationStrategy
protected static QuoteUserTypeIdentificationStrategy getQuoteUserTypeIdentificationStrategy(javax.servlet.http.HttpServletRequest httpRequest)
-
getQuoteUserIdentificationStrategy
protected static QuoteUserIdentificationStrategy getQuoteUserIdentificationStrategy(javax.servlet.http.HttpServletRequest httpRequest)
-
normalizedCode
public static java.lang.String normalizedCode(java.lang.String code)
Returns normalized code for selection data code- Parameters:
code-- Returns:
- code normalized according to replace condition
-
getImageForProductCode
public static ImageData getImageForProductCode(ProductData product, java.lang.String productCode, java.lang.String format)
JSP EL Function to get an image for a Product in a specific format based on the product code.- Parameters:
product- The product.productCode- The desired product code.format- The desired format.- Returns:
- The image.
-
getImageData
protected static ImageData getImageData(ProductData product, java.lang.String productCode, java.lang.String format)
-
arrayContainsInstance
public static boolean arrayContainsInstance(java.lang.String[] stringArr, java.lang.String string)Check if array contains instance.- Parameters:
stringArr- the string arraystring- the string instance- Returns:
- true, if contains
-
-