java.lang.Object
de.hybris.platform.acceleratorstorefrontcommons.tags.Functions

public class Functions extends Object
JSP EL Functions. This file contains static methods that are used by JSP EL.
  • Field Details

  • Constructor Details

    • Functions

      public Functions()
  • Method Details

    • getPrimaryImageForProductAndFormat

      public static ImageData getPrimaryImageForProductAndFormat(ProductData product, String format)
      JSP EL Function to get a primary Image for a Product in a specific format
      Parameters:
      product - the product
      format - the desired format
      Returns:
      the image
    • getPrimaryImageForTypeAndFormat

      protected static ImageData getPrimaryImageForTypeAndFormat(Collection<ImageData> images, String format)
    • getImageForStoreAndFormat

      public static ImageData getImageForStoreAndFormat(PointOfServiceData store, String format)
      JSP EL Function to get an Image for a Store in a specific format
      Parameters:
      store - the store
      format - the desired image format
      Returns:
      the image
    • getImageForFormat

      protected static ImageData getImageForFormat(Collection<ImageData> images, String format)
    • getUrlForCMSLinkComponent

      public static 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 String getUrlForCMSLinkComponent(CMSLinkComponentModel component, de.hybris.platform.servicelayer.dto.converter.Converter<ProductModel,ProductData> productUrlConverter, de.hybris.platform.servicelayer.dto.converter.Converter<CategoryModel,CategoryData> categoryUrlConverter)
    • getCategoryUrl

      protected static String getCategoryUrl(CMSLinkComponentModel component, de.hybris.platform.servicelayer.dto.converter.Converter<CategoryModel,CategoryData> categoryUrlConverter)
    • convertWithProperConverter

      protected static String convertWithProperConverter(de.hybris.platform.servicelayer.dto.converter.Converter<ProductModel,ProductData> productUrlConverter, ProductModel product)
    • evaluateRestrictions

      public static boolean evaluateRestrictions(AbstractCMSComponentModel model)
    • getProductUrlConverter

      protected static de.hybris.platform.servicelayer.dto.converter.Converter<ProductModel,ProductData> getProductUrlConverter(javax.servlet.http.HttpServletRequest httpRequest)
    • getCategoryUrlConverter

      protected static de.hybris.platform.servicelayer.dto.converter.Converter<CategoryModel,CategoryData> getCategoryUrlConverter(javax.servlet.http.HttpServletRequest httpRequest)
    • getCMSPageContextService

      protected static de.hybris.platform.acceleratorcms.services.CMSPageContextService getCMSPageContextService(javax.servlet.http.HttpServletRequest httpRequest)
    • getCMSPageSlotComponentService

      protected static de.hybris.platform.acceleratorcms.component.slot.CMSPageSlotComponentService getCMSPageSlotComponentService(javax.servlet.http.HttpServletRequest httpRequest)
    • getSpringBean

      public static <T> T getSpringBean(javax.servlet.http.HttpServletRequest httpRequest, String beanName, Class<T> beanClass)
      Returns the Spring bean with name beanName and of type beanClass.
      Type Parameters:
      T - type of the bean
      Parameters:
      httpRequest - the http request
      beanName - name of the bean
      beanClass - expected type of the bean
      Returns:
      the bean matching the given arguments or null if 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 cart
      entryNumber - 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 cart
      entry - 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 cart
      entryNumber - 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 cart
      entry - the entry
      Returns:
      true if there is an potential promotion for the entry or entry group
    • doesPromotionExistForOrderEntry

      public static boolean doesPromotionExistForOrderEntry(List<PromotionResultData> productPromotions, int entryNumber)
    • doesPromotionExistForOrderEntry

      protected static boolean doesPromotionExistForOrderEntry(Integer entryNumberToFind, PromotionResultData productPromotion)
    • encodeUrl

      public static String encodeUrl(String url)
      Utility method that encodes given URL
      Parameters:
      url - the url to encode
      Returns:
      encoded URL
    • encodeHTML

      public static String encodeHTML(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 String sanitizeHtmlTagName(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 String encodeJavaScript(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(String extensionName)
    • isQuoteUserSalesRep

      public static boolean isQuoteUserSalesRep()
    • isQuoteUserSellerApprover

      public static boolean isQuoteUserSellerApprover()
    • getQuoteUserTypeIdentificationStrategy

      protected static de.hybris.platform.commerceservices.order.strategies.QuoteUserTypeIdentificationStrategy getQuoteUserTypeIdentificationStrategy(javax.servlet.http.HttpServletRequest httpRequest)
    • getQuoteUserIdentificationStrategy

      protected static de.hybris.platform.commerceservices.order.strategies.QuoteUserIdentificationStrategy getQuoteUserIdentificationStrategy(javax.servlet.http.HttpServletRequest httpRequest)
    • normalizedCode

      public static String normalizedCode(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, String productCode, 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, String productCode, String format)
    • arrayContainsInstance

      public static boolean arrayContainsInstance(String[] stringArr, String string)
      Check if array contains instance.
      Parameters:
      stringArr - the string array
      string - the string instance
      Returns:
      true, if contains