Package org.hoteia.qalingo.core.fetchplan

Examples of org.hoteia.qalingo.core.fetchplan.FetchPlan


        return criteria;
    }
   
    protected FetchPlan handleSpecificFetchMode(Criteria criteria, Object... params){
        if (params != null) {
            FetchPlan globalFetchPlan = new FetchPlan(new ArrayList<SpecificFetchMode>());
            for (Object param : params) {
                if (param instanceof FetchPlan) {
                    FetchPlan fetchPlan = (FetchPlan) param;
                    for (Iterator<SpecificFetchMode> iterator = fetchPlan.getFetchModes().iterator(); iterator.hasNext();) {
                        SpecificFetchMode specificFetchMode = (SpecificFetchMode) iterator.next();
                        if(!globalFetchPlan.getFetchModes().contains(specificFetchMode)){
                            globalFetchPlan.getFetchModes().add(specificFetchMode);
                        }
                    }
View Full Code Here


  // MASTER
 
  public CatalogCategoryMaster getMasterCatalogCategoryById(final Long catalogCategoryId, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryMaster.class);
       
        FetchPlan fetchPlan = handleSpecificFetchMasterCategoryMode(criteria, params);

        criteria.add(Restrictions.eq("id", catalogCategoryId));

        CatalogCategoryMaster catalogCategory = (CatalogCategoryMaster) criteria.uniqueResult();
        if(catalogCategory != null){
View Full Code Here

  }
 
  public CatalogCategoryMaster getMasterCatalogCategoryByCode(final String catalogCategoryCode, final String catalogMasterCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryMaster.class);
       
        FetchPlan fetchPlan = handleSpecificFetchMasterCategoryMode(criteria, params);

        criteria.add(Restrictions.eq("code", handleCodeValue(catalogCategoryCode)));
       
        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogMasterCode)));
View Full Code Here

  // VIRTUAL
 
  public CatalogCategoryVirtual getVirtualCatalogCategoryById(final Long catalogCategoryId, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryVirtual.class);
       
        FetchPlan fetchPlan = handleSpecificFetchVirtualCategoryMode(criteria, params);

        criteria.add(Restrictions.eq("id", catalogCategoryId));

        CatalogCategoryVirtual catalogCategory = (CatalogCategoryVirtual) criteria.uniqueResult();
        if(catalogCategory != null){
View Full Code Here

  }
 
  public CatalogCategoryVirtual getVirtualCatalogCategoryByVirtualCategoryCode(final String catalogCategoryCode, final String catalogVirtualCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryVirtual.class);
       
        FetchPlan fetchPlan = handleSpecificFetchVirtualCategoryMode(criteria, params);

        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogCategoryCode)));
       
        criteria.add(Restrictions.eq("code", handleCodeValue(catalogCategoryCode)));
View Full Code Here

  }
 
    public CatalogCategoryVirtual getVirtualCatalogCategoryByMasterCategoryCode(final String catalogCategoryCode, final String catalogVirtualCode, final String catalogMasterCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryVirtual.class);
       
        FetchPlan fetchPlan = handleSpecificFetchVirtualCategoryMode(criteria, params);

        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogVirtualCode)));

        criteria.createAlias("categoryMaster", "categoryMaster", JoinType.LEFT_OUTER_JOIN);
View Full Code Here

  public ModelAndView productLine(final HttpServletRequest request, final Model model, @PathVariable(RequestConstants.URL_PATTERN_CATEGORY_CODE) final String categoryCode) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.CATEGORY_AS_LINE.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        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());
View Full Code Here

    } catch (Exception e) {
      logger.error("SOLR Error", e);
      return displaySearch(request, model);
    }
   
    loadRecentProducts(request, requestData, model, new FetchPlan(categoryVirtualFetchPlans), new FetchPlan(productMarketingFetchPlans), new FetchPlan(productSkuFetchPlans));
       
        final Cart currentCart = requestData.getCart();
        final CartViewBean cartViewBean = frontofficeViewBeanFactory.buildViewBeanCart(requestUtil.getRequestData(request), currentCart);
        modelAndView.addObject(ModelConstants.CART_VIEW_BEAN, cartViewBean);
   
View Full Code Here

        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.STORE_SEARCH.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);

        modelAndView.addObject(ModelConstants.SEARCH_FORM, formFactory.buildSearchForm(requestData));

        loadRecentProducts(request, requestData, model, new FetchPlan(categoryVirtualFetchPlans), new FetchPlan(productMarketingFetchPlans), new FetchPlan(productSkuFetchPlans));

        final Cart currentCart = requestData.getCart();
        final CartViewBean cartViewBean = frontofficeViewBeanFactory.buildViewBeanCart(requestUtil.getRequestData(request), currentCart);
        modelAndView.addObject(ModelConstants.CART_VIEW_BEAN, cartViewBean);
View Full Code Here

    // MASTER CATALOG

    public CatalogMaster getMasterCatalogById(final Long masterCatalogId, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogMaster.class);

        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);
       
        criteria.add(Restrictions.eq("id", masterCatalogId));
       
        CatalogMaster catalogMaster = (CatalogMaster) criteria.uniqueResult();
        if(catalogMaster != null){
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.fetchplan.FetchPlan

Copyright © 2018 www.massapicom. 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.