Class DefaultProductCarouselFacade

  • All Implemented Interfaces:
    ProductCarouselFacade

    public class DefaultProductCarouselFacade
    extends java.lang.Object
    implements ProductCarouselFacade
    Facade to fetch list of products for a given product carousel component.
    • Field Detail

      • PRODUCT_OPTIONS

        protected static final java.util.List<ProductOption> PRODUCT_OPTIONS
    • Constructor Detail

      • DefaultProductCarouselFacade

        public DefaultProductCarouselFacade()
    • Method Detail

      • fetchProductsForNonPreviewMode

        protected java.util.List<ProductData> fetchProductsForNonPreviewMode​(ProductCarouselComponentModel component)
        Fetches list of products for a given product carousel component when not in preview (i.e., no cmsTicketId in present in the session).
        Parameters:
        component - The product carousel component model
        Returns:
        List list of available products
      • fetchProductsForPreviewMode

        protected java.util.List<ProductData> fetchProductsForPreviewMode​(ProductCarouselComponentModel component)
        Fetches list of products for a given product carousel component when in preview (i.e., cmsTicketId in present in the session).
        Parameters:
        component - The product carousel component model
        Returns:
        List list of available products
      • getProductForOptions

        protected ProductData getProductForOptions​(ProductModel productModel,
                                                   java.util.Collection<ProductOption> options)
        Convert from productModel to productData
        Parameters:
        productModel - The product model
        options - The product options
        Returns:
        productData The product data
      • isPreview

        protected boolean isPreview()
        Checks if we are in preview mode by checking the presence of a cmsTicketId in session.
        Returns:
        true if in preview mode
      • getDisplayableProductsForProductCarousel

        protected java.util.List<ProductModel> getDisplayableProductsForProductCarousel​(ProductCarouselComponentModel component)
        If in versioning preview then returns the products from the provided ProductCarouselComponentModel else returns the full list of products without the session catalog version filtering out the ones from different versions. This is needed when the session catalog version is not the active version. This is possible through CMS tooling.
        Parameters:
        productCarouselComponentModel - the product carousel model
        Returns:
        a list of ProductModel
      • getListOfCategoriesForProductCarousel

        protected java.util.List<CategoryModel> getListOfCategoriesForProductCarousel​(ProductCarouselComponentModel component)
        If in versioning preview then returns the categories from the provided CategoryModel else returns the full list of categories without the session catalog version filtering out the ones from different versions. This is needed when the session catalog version is not the active version. This is possible through CMS tooling
        Parameters:
        productCarouselComponentModel - the product carousel model
        Returns:
        a list of CategoryModel
      • getDisplayableProductsForCategory

        protected java.util.List<ProductModel> getDisplayableProductsForCategory​(CategoryModel component)
        If in versioning preview then returns the products from the provided CategoryModel else returns the full list of products without the session catalog version filtering out the ones from different versions. This is needed when the session catalog version is not the active version. This is possible through CMS tooling
        Parameters:
        CategoryModel - the category model
        Returns:
        a list of ProductModel
      • refreshComponent

        protected <T extends ItemModel> T refreshComponent​(T component)
        Returns the component based on the type of preview. If in versioning preview, returns the component as is, else returns component by re-fetching it again without the session catalog version.
        Parameters:
        component - the component
        Returns:
        the refreshed component
      • setProductFacade

        public void setProductFacade​(ProductFacade productFacade)
      • setSessionService

        public void setSessionService​(SessionService sessionService)
      • setProductCarouselRendererService

        public void setProductCarouselRendererService​(ProductCarouselRendererService productCarouselRendererService)
      • setSearchRestrictionService

        public void setSearchRestrictionService​(SearchRestrictionService searchRestrictionService)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)
      • setCmsPreviewService

        public void setCmsPreviewService​(CMSPreviewService cmsPreviewService)