Examples of CatalogCategoryViewBean


Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

    /**
     *
     */
    public CatalogCategoryViewBean buildViewBeanMasterCatalogCategory(final RequestData requestData, final CatalogCategoryMaster catalogCategory, final FetchPlan categoryFetchPlan, final FetchPlan productFetchPlan, final FetchPlan skuFetchPlan) throws Exception {
        final CatalogCategoryViewBean catalogCategoryViewBean = buildViewBeanCatalogCategory(requestData, (AbstractCatalogCategory) catalogCategory, categoryFetchPlan, productFetchPlan, skuFetchPlan);
        return catalogCategoryViewBean;
    }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

   
    /**
     *
     */
    public CatalogCategoryViewBean buildViewBeanVirtualCatalogCategory(final RequestData requestData, final CatalogCategoryVirtual catalogCategory, final FetchPlan categoryFetchPlan, final FetchPlan productFetchPlan, final FetchPlan skuFetchPlan) throws Exception {
        final CatalogCategoryViewBean catalogCategoryViewBean = buildViewBeanCatalogCategory(requestData, (AbstractCatalogCategory) catalogCategory, categoryFetchPlan, productFetchPlan, skuFetchPlan);
        if (catalogCategory != null && catalogCategory.getCategoryMaster() != null
                && Hibernate.isInitialized(catalogCategory.getCategoryMaster())) {
            catalogCategoryViewBean.setMasterCategory(buildViewBeanCatalogCategory(requestData, (AbstractCatalogCategory) catalogCategory.getCategoryMaster(), null, null, null));
        }
        return catalogCategoryViewBean;
    }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

     */
    protected CatalogCategoryViewBean buildViewBeanCatalogCategory(final RequestData requestData, final AbstractCatalogCategory catalogCategory, final FetchPlan categoryFetchPlan, final FetchPlan productFetchPlan, final FetchPlan skuFetchPlan) throws Exception {
        final MarketArea marketArea = requestData.getMarketArea();
        final Localization localization = requestData.getMarketAreaLocalization();
        final String localizationCode = localization.getCode();
        final CatalogCategoryViewBean catalogCategoryViewBean = new CatalogCategoryViewBean();
       
        if(catalogCategory != null){
            catalogCategoryViewBean.setCode(catalogCategory.getCode());
            catalogCategoryViewBean.setName(catalogCategory.getI18nName(localizationCode));
            catalogCategoryViewBean.setDescription(catalogCategory.getDescription());
            catalogCategoryViewBean.setRanking("" + catalogCategory.getRanking());
            catalogCategoryViewBean.setRoot(catalogCategory.isRoot());

            // ATTRIBUTES
            List<AbstractAttribute> globalAttributes = catalogCategory.getGlobalAttributes();
            if(globalAttributes != null){
                for (Iterator<AbstractAttribute> iterator = globalAttributes.iterator(); iterator.hasNext();) {
                    AbstractAttribute attribute = (AbstractAttribute) iterator.next();
                    catalogCategoryViewBean.getGlobalAttributes().put(attribute.getAttributeDefinition().getCode(), buildViewBeanAttributeValue(requestData, attribute));
                }
            }

            List<AbstractAttribute> marketAreaAttributes = catalogCategory.getMarketAreaAttributes(marketArea.getId());
            if(marketAreaAttributes != null){
                for (Iterator<AbstractAttribute> iterator = marketAreaAttributes.iterator(); iterator.hasNext();) {
                    AbstractAttribute attribute = (AbstractAttribute) iterator.next();
                    catalogCategoryViewBean.getMarketAreaAttributes().put(attribute.getAttributeDefinition().getCode(), buildViewBeanAttributeValue(requestData, attribute));
                }
            }
           
            // ASSETS
            final Asset defaultBackgroundImage = catalogCategory.getDefaultBackgroundImage();
            if (defaultBackgroundImage != null) {
                final String backgroundImage = engineSettingService.getCatalogImageWebPath(defaultBackgroundImage);
                catalogCategoryViewBean.setBackgroundImage(backgroundImage);
            } else {
                catalogCategoryViewBean.setBackgroundImage("");
            }
            final Asset defaultSlideshowImage = catalogCategory.getDefaultSlideshowImage();
            if (defaultSlideshowImage != null) {
                final String slideshowImage = engineSettingService.getCatalogImageWebPath(defaultSlideshowImage);
                catalogCategoryViewBean.setSlideshowImage(slideshowImage);
            } else {
                catalogCategoryViewBean.setBackgroundImage("");
            }

            final Asset defaultPackshotImage = catalogCategory.getDefaultPackshotImage(ImageSize.HD.getPropertyKey());
            if (defaultPackshotImage != null) {
                final String carouselImage = engineSettingService.getCatalogImageWebPath(defaultPackshotImage);
                catalogCategoryViewBean.setCarouselImage(carouselImage);
            } else {
                catalogCategoryViewBean.setCarouselImage("");
            }
            final Asset defaultIconImage = catalogCategory.getDefaultThumbnailImage();
            if (defaultIconImage != null) {
                final String iconImage = engineSettingService.getCatalogImageWebPath(defaultIconImage);
                catalogCategoryViewBean.setIconImage(iconImage);
            } else {
                catalogCategoryViewBean.setIconImage("");
            }

            if (catalogCategory.isRoot()) {
                catalogCategoryViewBean.setProductAxeUrl(urlService.generateUrl(FoUrls.CATEGORY_AS_AXE, requestData, catalogCategory));
            } else {
                catalogCategoryViewBean.setProductLineUrl(urlService.generateUrl(FoUrls.CATEGORY_AS_LINE, requestData, catalogCategory));
            }

            // PARENT CATEGORY
            if (catalogCategory != null && catalogCategory.getParentCatalogCategory() != null
                    && Hibernate.isInitialized(catalogCategory.getParentCatalogCategory())) {
                catalogCategoryViewBean.setDefaultParentCategory(buildViewBeanCatalogCategory(requestData, (AbstractCatalogCategory) catalogCategory.getParentCatalogCategory(), null, null, null));
            }
          
            // SUB CATEGORIES
            List<CatalogCategoryViewBean> subcatalogCategoryVirtualViewBeans = new ArrayList<CatalogCategoryViewBean>();
            final List<AbstractCatalogCategory> subCategories = catalogCategory.getSortedChildCatalogCategories();
            if (subCategories != null) {
                if (categoryFetchPlan != null) {
                    for (Iterator<AbstractCatalogCategory> iteratorSubcatalogCategoryVirtual = subCategories.iterator(); iteratorSubcatalogCategoryVirtual.hasNext();) {
                        final CatalogCategoryVirtual subcatalogCategoryVirtual = (CatalogCategoryVirtual) iteratorSubcatalogCategoryVirtual.next();
                        final CatalogCategoryVirtual reloadedSubCatalogCategory = catalogCategoryService.getVirtualCatalogCategoryById(subcatalogCategoryVirtual.getId(), categoryFetchPlan);
                        subcatalogCategoryVirtualViewBeans.add(buildViewBeanVirtualCatalogCategory(requestData, reloadedSubCatalogCategory, categoryFetchPlan, productFetchPlan, skuFetchPlan));
                    }
                }
                catalogCategoryViewBean.setCountSubCategories(subCategories.size());
            }
            catalogCategoryViewBean.setSubCategories(subcatalogCategoryVirtualViewBeans);

            // PRODUCTS
            List<ProductMarketingViewBean> productMarketingViewBeans = new ArrayList<ProductMarketingViewBean>();
            List<ProductMarketingViewBean> featuredProductMarketings = new ArrayList<ProductMarketingViewBean>();
            final List<ProductSku> productSkus = catalogCategory.getSortedProductSkus();
            if (productSkus != null) {
                if (productFetchPlan != null) {
                    for (Iterator<ProductSku> iteratorProductMarketing = productSkus.iterator(); iteratorProductMarketing.hasNext();) {
                        final ProductSku productSku = (ProductSku) iteratorProductMarketing.next();
                        final ProductSku reloadedProductSku = productService.getProductSkuByCode(productSku.getCode(), skuFetchPlan);
                        final ProductMarketing productMarketing = productService.getProductMarketingByCode(reloadedProductSku.getProductMarketing().getCode(), productFetchPlan);
                        ProductMarketingViewBean productMarketingViewBean = buildViewBeanProductMarketing(requestData, catalogCategory, productMarketing, reloadedProductSku);
                        productMarketingViewBeans.add(productMarketingViewBean);
                        if (productMarketing.isFeatured()) {
                            featuredProductMarketings.add(productMarketingViewBean);
                        }
                    }
                }
                catalogCategoryViewBean.setCountProductMarketings(catalogCategory.getSortedProductMarketings().size());
            }
            catalogCategoryViewBean.setProductMarketings(productMarketingViewBeans);

            // FEATURED PRODUCTS
            for (CatalogCategoryViewBean subcatalogCategoryVirtualViewBean : subcatalogCategoryVirtualViewBeans) {
                featuredProductMarketings.addAll(subcatalogCategoryVirtualViewBean.getFeaturedProductMarketings());
            }
            catalogCategoryViewBean.setFeaturedProductMarketings(featuredProductMarketings);
           
        }

        return catalogCategoryViewBean;
    }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

        final RequestData requestData = requestUtil.getRequestData(request);

        final CatalogCategoryVirtual catalogCategory = catalogCategoryService.getVirtualCatalogCategoryByCode(categoryCode, requestData.getVirtualCatalogCode(), requestData.getMasterCatalogCode(), new FetchPlan(categoryVirtualFetchPlans));

        if(catalogCategory != null){
            final CatalogCategoryViewBean catalogCategoryViewBean = frontofficeViewBeanFactory.buildViewBeanVirtualCatalogCategory(requestUtil.getRequestData(request), catalogCategory,
                    new FetchPlan(categoryVirtualFetchPlans), new FetchPlan(productMarketingFetchPlans), new FetchPlan(productSkuFetchPlans));
            model.addAttribute(ModelConstants.CATALOG_CATEGORY_VIEW_BEAN, catalogCategoryViewBean);

            // SEO
            model.addAttribute(ModelConstants.PAGE_META_OG_TITLE, catalogCategoryViewBean.getI18nName());

            model.addAttribute(ModelConstants.PAGE_META_OG_DESCRIPTION, catalogCategoryViewBean.getI18nDescription());

            model.addAttribute(ModelConstants.PAGE_META_OG_IMAGE, urlService.buildAbsoluteUrl(requestData, catalogCategoryViewBean.getCarouselImage()));

            Object[] params = { catalogCategoryViewBean.getI18nName() };
            overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.CATEGORY_AS_AXE.getKey(), params);

            return modelAndView;
        }
        final String urlRedirect = urlService.generateUrl(FoUrls.HOME, requestUtil.getRequestData(request));
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

    CatalogCategoryVirtual catalogCategory = catalogCategoryService.getVirtualCatalogCategoryByCode(categoryCode, requestData.getVirtualCatalogCode(), requestData.getMasterCatalogCode());
    ProductMarketing productMarketing = productService.getProductMarketingByCode(productMarketingCode, new FetchPlan(productMarketingFetchPlans));
        ProductSku productSku = productService.getProductSkuByCode(productSkuCode, new FetchPlan(productSkuFetchPlans));
   
    final CatalogCategoryViewBean catalogCategoryViewBean = frontofficeViewBeanFactory.buildViewBeanVirtualCatalogCategory(requestUtil.getRequestData(request), catalogCategory,
                                                                                       new FetchPlan(categoryVirtualFetchPlans), new FetchPlan(productMarketingFetchPlans), new FetchPlan(productSkuFetchPlans));
    model.addAttribute(ModelConstants.CATALOG_CATEGORY_VIEW_BEAN, catalogCategoryViewBean);

        final ProductMarketingViewBean productMarketingViewBean = frontofficeViewBeanFactory.buildViewBeanProductMarketing(requestUtil.getRequestData(request), catalogCategory, productMarketing, productSku);
        model.addAttribute(ModelConstants.PRODUCT_MARKETING_VIEW_BEAN, productMarketingViewBean);
       
        final CatalogBreadcrumbViewBean catalogBreadcrumbViewBean = frontofficeViewBeanFactory.buildViewBeanCatalogBreadcrumb(requestUtil.getRequestData(request) , catalogCategory);
    model.addAttribute(ModelConstants.CATALOG_BREADCRUMB_VIEW_BEAN, catalogBreadcrumbViewBean);

        //for now, get the featured products in same category
        //TODO: define related products
        final List<ProductMarketingViewBean> relatedProducts = catalogCategoryViewBean.getFeaturedProductMarketings();
        model.addAttribute(ModelConstants.RELATED_PPRODUCT_MARKETING_VIEW_BEAN, relatedProducts);
       
        final CustomerProductRatesViewBean customerProductRatesViewBean = productService.getProductMarketingCustomerRateDetails(productMarketing.getId());
        model.addAttribute(ModelConstants.CUSTOMER_PRODUCT_RATES_VIEW_BEAN, customerProductRatesViewBean);
       
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

        final Cart currentCart = requestData.getCart();
       
    final CatalogCategoryVirtual catalogCategory = catalogCategoryService.getVirtualCatalogCategoryByCode(categoryCode, requestData.getVirtualCatalogCode(), requestData.getMasterCatalogCode(), new FetchPlan(categoryVirtualFetchPlans));
   
    if(catalogCategory != null){
        final CatalogCategoryViewBean catalogCategoryViewBean = frontofficeViewBeanFactory.buildViewBeanVirtualCatalogCategory(requestUtil.getRequestData(request), catalogCategory,
                                                                                           new FetchPlan(categoryVirtualFetchPlans), new FetchPlan(productMarketingFetchPlans), new FetchPlan(productSkuFetchPlans));
   
        String sortBy = request.getParameter("sortBy");
            String orderBy = request.getParameter("orderBy");
            String pageSizeParameter = request.getParameter("pageSize");
            String pageParameter = request.getParameter("page");
            String mode = request.getParameter("mode");
           
        int page = NumberUtils.toInt(pageParameter, 1) - 1;
          int pageSize = NumberUtils.toInt(pageSizeParameter, 9);
       
        List<ProductMarketingViewBean> productMarketings = catalogCategoryViewBean.getProductMarketings();
        PagedListHolder<ProductMarketingViewBean> productList = new PagedListHolder<ProductMarketingViewBean>(productMarketings);
        productList.setPageSize(pageSize);
        productList.setPage(page);
       
        int pageCurrent = productList.getPage();
            if (pageCurrent < page) {
              for (int i = pageCurrent; i < page; i++) {
                productList.nextPage();
          }
            } else if (pageCurrent > page) {
              for (int i = page; i < pageCurrent; i++) {
                productList.previousPage();
          }
            }
       
        catalogCategoryViewBean.setProductMarketings(productList.getPageList());
   
        final CartViewBean cartViewBean = frontofficeViewBeanFactory.buildViewBeanCart(requestUtil.getRequestData(request), currentCart);
            modelAndView.addObject(ModelConstants.CART_VIEW_BEAN, cartViewBean);
     
        final CatalogBreadcrumbViewBean catalogBreadcrumbViewBean = frontofficeViewBeanFactory.buildViewBeanCatalogBreadcrumb(requestUtil.getRequestData(request) , catalogCategory);
        model.addAttribute(ModelConstants.CATALOG_BREADCRUMB_VIEW_BEAN, catalogBreadcrumbViewBean);
       
        model.addAttribute(ModelConstants.CATALOG_CATEGORY_VIEW_BEAN, catalogCategoryViewBean);
        model.addAttribute("sortBy", sortBy);
        model.addAttribute("pageSize", pageSize);
        model.addAttribute("orderBy", orderBy);
        model.addAttribute("currentPage", page);
        model.addAttribute("mode",mode);
        model.addAttribute("totalPage", productList.getPageCount());
       
        loadRecentProducts(request, requestData, model, new FetchPlan(categoryVirtualFetchPlans), new FetchPlan(productMarketingFetchPlans), new FetchPlan(productSkuFetchPlans));
           
            // SEO
            model.addAttribute(ModelConstants.PAGE_META_OG_TITLE, catalogCategoryViewBean.getI18nName() );
           
            model.addAttribute(ModelConstants.PAGE_META_OG_DESCRIPTION, catalogCategoryViewBean.getI18nDescription());
           
            model.addAttribute(ModelConstants.PAGE_META_OG_IMAGE, urlService.buildAbsoluteUrl(requestData, catalogCategoryViewBean.getCarouselImage()));
   
            Object[] params = { catalogCategoryViewBean.getI18nName() };
            overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.CATEGORY_AS_LINE.getKey(), params);
           
        return modelAndView;
      }
        final String urlRedirect = urlService.generateUrl(FoUrls.HOME, requestUtil.getRequestData(request));
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

    }
   
    public List<CatalogCategoryViewBean> buildListViewBeanRootCatalogCategory(final RequestData requestData, final List<CatalogCategoryVirtual> catalogCategories, final FetchPlan categoryFetchPlan, final FetchPlan productFetchPlan, final FetchPlan skuFetchPlan) throws Exception {
        final List<CatalogCategoryViewBean> catalogCategoryViewBeans = new ArrayList<CatalogCategoryViewBean>();
        for (CatalogCategoryVirtual catalogCategoryVirtual : catalogCategories) {
            CatalogCategoryViewBean catalogCategoryViewBean = buildViewBeanVirtualCatalogCategory(requestData, catalogCategoryVirtual, categoryFetchPlan, productFetchPlan, skuFetchPlan);
            catalogCategoryViewBeans.add(catalogCategoryViewBean);
        }
        return catalogCategoryViewBeans;
    }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

        catalogViewBean.setCode(catalog.getCode());

        if (catalogCategories != null) {
            final List<CatalogCategoryViewBean> catalogCategoryViewBeans = new ArrayList<CatalogCategoryViewBean>();
            for (AbstractCatalogCategory catalogCategoryVirtual : catalogCategories) {
                CatalogCategoryViewBean catalogCategoryViewBean = buildViewBeanCatalogCategory(requestData, catalogCategoryVirtual, categoryFetchPlan, null, null);
                catalogCategoryViewBeans.add(catalogCategoryViewBean);
            }
            catalogViewBean.setCategories(catalogCategoryViewBeans);
        }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

     *
     */
    @Override
    public CatalogCategoryViewBean buildViewBeanMasterCatalogCategory(final RequestData requestData, final CatalogCategoryMaster catalogCategory, final FetchPlan categoryFetchPlan, final FetchPlan productFetchPlan, final FetchPlan skuFetchPlan)
            throws Exception {
        final CatalogCategoryViewBean catalogCategoryViewBean = super.buildViewBeanMasterCatalogCategory(requestData, catalogCategory, categoryFetchPlan, productFetchPlan, skuFetchPlan);

        catalogCategoryViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.MASTER_CATEGORY_DETAILS, requestData, catalogCategory));
        catalogCategoryViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.MASTER_CATEGORY_EDIT, requestData, catalogCategory));
       
        return catalogCategoryViewBean;
    }
View Full Code Here

Examples of org.hoteia.qalingo.core.web.mvc.viewbean.CatalogCategoryViewBean

     *
     */
    @Override
    public CatalogCategoryViewBean buildViewBeanVirtualCatalogCategory(final RequestData requestData, final CatalogCategoryVirtual catalogCategory, final FetchPlan categoryFetchPlan, final FetchPlan productFetchPlan, final FetchPlan skuFetchPlan)
            throws Exception {
        final CatalogCategoryViewBean catalogCategoryViewBean = super.buildViewBeanVirtualCatalogCategory(requestData, catalogCategory, categoryFetchPlan, productFetchPlan, skuFetchPlan);

        catalogCategoryViewBean.setDetailsUrl(backofficeUrlService.generateUrl(BoUrls.VIRTUAL_CATEGORY_DETAILS, requestData, catalogCategory));
        catalogCategoryViewBean.setEditUrl(backofficeUrlService.generateUrl(BoUrls.VIRTUAL_CATEGORY_EDIT, requestData, catalogCategory));
           
        return catalogCategoryViewBean;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.