Package org.hoteia.qalingo.core.web.servlet

Examples of org.hoteia.qalingo.core.web.servlet.ModelAndViewThemeDevice


        categoryVirtualFetchPlans.add(new SpecificFetchMode(CatalogCategoryVirtual_.catalogCategoryProductSkuRels.getName() + "." + CatalogCategoryVirtualProductSkuRel_.pk.getName() "." + org.hoteia.qalingo.core.domain.CatalogCategoryVirtualProductSkuPk_.productSku.getName()));
    }
   
  @RequestMapping(FoUrls.CATEGORY_AS_LINE_URL)
  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);
View Full Code Here


    @Autowired
    protected MarketService marketService;
   
    @RequestMapping(value = BoUrls.PAYMENT_GATEWAY_LIST_URL, method = RequestMethod.GET)
    public ModelAndView paymentGatewayList(final HttpServletRequest request, final Model model) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.PAYMENT_GATEWAY_LIST.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea marketArea = requestData.getMarketArea();
       
        displayList(request, model, requestData);
       
View Full Code Here

        return modelAndView;
    }
   
    @RequestMapping(value = BoUrls.PAYMENT_GATEWAY_DETAILS_URL, method = RequestMethod.GET)
    public ModelAndView paymentGatewayDetails(final HttpServletRequest request, final Model model) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.PAYMENT_GATEWAY_DETAILS.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String currentPaymentGatewayCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_PAYMENT_GATEWAY_CODE);
       
        // SANITY CHECK
        if(StringUtils.isEmpty(currentPaymentGatewayCode)){
            final String urlRedirect = backofficeUrlService.generateUrl(BoUrls.PAYMENT_GATEWAY_LIST, requestData);
            return new ModelAndView(new RedirectView(urlRedirect));
        }
       
        final AbstractPaymentGateway paymentGateway = paymentGatewayService.getPaymentGatewayByCode(currentPaymentGatewayCode, FetchPlanGraphCommon.fullPaymentGatewayFetchPlan());
       
        // SANITY CHECK
        if(paymentGateway != null){
            modelAndView.addObject(ModelConstants.PAYMENT_GATEWAY_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanPaymentGateway(requestData, paymentGateway));
        } else {
            final String url = requestUtil.getLastRequestUrl(request);
            return new ModelAndView(new RedirectView(url));
        }
       
        modelAndView.addObject("availablePaymentGatewayOptions", paymentGatewayService.findPaymentGatewayOptions());

        model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.PAYMENT_GATEWAY_LIST, requestData));
       
        Object[] params = {paymentGateway.getName() + " (" + paymentGateway.getCode() + ")"};
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, BoUrls.PAYMENT_GATEWAY_DETAILS.getKey(), params);
View Full Code Here

        return modelAndView;
    }
   
    @RequestMapping(value = BoUrls.PAYMENT_GATEWAY_EDIT_URL, method = RequestMethod.GET)
    public ModelAndView paymentGatewayEdit(final HttpServletRequest request, final Model model, @ModelAttribute(ModelConstants.PAYMENT_GATEWAY_FORM) PaymentGatewayForm paymentGatewayForm) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.PAYMENT_GATEWAY_EDIT.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String paymentGatewayCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_PAYMENT_GATEWAY_CODE);
        if(StringUtils.isNotEmpty(paymentGatewayCode)){
            // EDIT MODE
            final AbstractPaymentGateway paymentGateway = paymentGatewayService.getPaymentGatewayByCode(paymentGatewayCode, FetchPlanGraphCommon.defaultPaymentGatewayFetchPlan());

            PaymentGatewayViewBean paymentGatewayViewBean = backofficeViewBeanFactory.buildViewBeanPaymentGateway(requestData, paymentGateway);
            request.setAttribute(ModelConstants.PAYMENT_GATEWAY_VIEW_BEAN, paymentGatewayViewBean);

            modelAndView.addObject("availableGlobaleAttributeDefinitions", attributeService.findPaymentGatewayGlobalAttributeDefinitions());
            modelAndView.addObject("availableMarketAreaAttributeDefinitions", attributeService.findPaymentGatewayMarketAreaAttributeDefinitions());
            modelAndView.addObject("availableOptions", paymentGatewayService.findPaymentGatewayOptions());

            Object[] params = {paymentGateway.getName() + " (" + paymentGateway.getCode() + ")"};
            overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, BoUrls.PAYMENT_GATEWAY_EDIT.getKey(), params);

            model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.PAYMENT_GATEWAY_DETAILS, requestData, paymentGateway));
View Full Code Here

  @Autowired
    protected CustomerService customerService;
 
  @RequestMapping(value = FoUrls.CUSTOMER_DETAILS_URL, method = RequestMethod.GET)
  public ModelAndView customerDetails(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.CUSTOMER_DETAILS.getVelocityPage());
   
    final String permalink = request.getParameter(RequestConstants.REQUEST_PARAMETER_CUSTOMER_PERMALINK);
    final Customer customer = customerService.getCustomerByPermalink(permalink);
   
    // WE RELOAD THE CUSTOMER FOR THE PERSISTANCE PROXY FILTER
View Full Code Here

        categoryVirtualFetchPlans.add(new SpecificFetchMode(CatalogCategoryVirtual_.assets.getName()));
    }
   
  @RequestMapping(value = FoUrls.STORE_SEARCH_URL, method = RequestMethod.GET)
  public ModelAndView search(final HttpServletRequest request, final Model model, @Valid SearchForm searchForm) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.STORE_SEARCH.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();
       
    if (StringUtils.isEmpty(searchForm.getText())
            && searchForm.getPage() == 0) {
      return displaySearch(request, model);
    }

    String url = requestUtil.getCurrentRequestUrl(request);
   
    String sessionKeyPagedListHolder = "Search_Store_PagedListHolder_" + request.getSession().getId();
        String sessionKeyFacet = "Search_Store_Facet_" + request.getSession().getId();
        int page = searchForm.getPage() - 1;
        String mode = request.getParameter(Constants.PAGE_VIEW_MODE);
        String cities = request.getParameter("cities");
        String countries = request.getParameter("countries");
       
        List<String> cityList = new ArrayList<String>();
        if (StringUtils.isEmpty(cities)) {
          cityList = null;
    } else{
      String[] arr = cities.split(",");
      cityList = Arrays.asList(arr);
    }      
        List<String> countryList = new ArrayList<String>();
        if (StringUtils.isEmpty(countries)) {
          countryList = null;
    } else{
      String[] arr = countries.split(",");
      countryList = Arrays.asList(arr);
    }
       
        String sortBy = searchForm.getSortBy();
        String order = searchForm.getOrder();
   
    try {
            PagedListHolder<SearchStoreItemViewBean> storesViewBeanPagedListHolder;
      if(searchForm.getPage() == 0){
              StoreResponseBean storeResponseBean = null;
              List<String> facetFields = Arrays.asList(StoreResponseBean.STORE_DEFAULT_FACET_FIELD,StoreResponseBean.STORE_SECOND_FACET_FIELD);
              storeResponseBean = storeSolrService.searchStore(StoreResponseBean.STORE_DEFAULT_SEARCH_FIELD, searchForm.getText(), facetFields, cityList,countryList);
              StoreResponseBean storeResponBeanNonFilter = storeSolrService.searchStore(StoreResponseBean.STORE_DEFAULT_SEARCH_FIELD, searchForm.getText(), facetFields);
                storesViewBeanPagedListHolder = initList(request, sessionKeyPagedListHolder, storeResponseBean, new PagedListHolder<SearchStoreItemViewBean>(), searchForm);
             
              // FACETS
                List<SearchFacetViewBean> facets = frontofficeViewBeanFactory.buildListViewBeanStoreSearchFacet(requestData, storeResponBeanNonFilter);
              modelAndView.addObject(AbstractSolrService.SEARCH_FACET_FIELD_LIST, facets);
              request.getSession().setAttribute(sessionKeyFacet, facets);
         
      } else {
          storesViewBeanPagedListHolder = (PagedListHolder<SearchStoreItemViewBean>) request.getSession().getAttribute(sessionKeyPagedListHolder);
         
          // FACETS
                List<SearchFacetViewBean> facets = (List<SearchFacetViewBean>) request.getSession().getAttribute(sessionKeyFacet);
                modelAndView.addObject(AbstractSolrService.SEARCH_FACET_FIELD_LIST, facets);
      }
         
          int pageCurrent = storesViewBeanPagedListHolder.getPage();
          if (pageCurrent < page) {
            for (int i = pageCurrent; i < page; i++) {
              storesViewBeanPagedListHolder.nextPage();
        }
          } else if (pageCurrent > page) {
            for (int i = page; i < pageCurrent; i++) {
              storesViewBeanPagedListHolder.previousPage();
        }
          }
         
      modelAndView.addObject(Constants.PAGINATION_PAGE_URL, url);
      modelAndView.addObject(Constants.PAGINATION_PAGE_PAGED_LIST_HOLDER, storesViewBeanPagedListHolder);
      modelAndView.addObject(Constants.SEARCH_TEXT, searchForm.getText());
      modelAndView.addObject(Constants.PAGINATION_PAGE_SIZE, storesViewBeanPagedListHolder.getPageSize());
      modelAndView.addObject(Constants.PAGINATION_SORT_BY, sortBy);
      modelAndView.addObject(Constants.PAGINATION_ORDER, order);
      modelAndView.addObject(Constants.STORE_CITY_PARAMETER, cities);
      modelAndView.addObject(Constants.STORE_COUNTRY_PARAMETER, countries);
     
    } 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);
   
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.STORE_SEARCH.getKey());

        // BREADCRUMB
        BreadcrumbViewBean breadcrumbViewBean = new BreadcrumbViewBean();
View Full Code Here

        return modelAndView;
  }
 
  @RequestMapping(value = FoUrls.PERSONAL_DETAILS_URL, method = RequestMethod.GET)
  public ModelAndView personalDetails(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_DETAILS.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
        final Customer currentCustomer = requestData.getCustomer();
   
    // Customer is already set by the abstract
View Full Code Here

        return modelAndView;
  }
 
  @RequestMapping(value = FoUrls.PERSONAL_EDIT_URL, method = RequestMethod.GET)
  public ModelAndView displayPersonalEdit(final HttpServletRequest request, final Model model, @ModelAttribute("customerEditForm") CustomerEditForm customerEditForm) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_EDIT.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
        final Customer currentCustomer = requestData.getCustomer();
   
    // WE RELOAD THE CUSTOMER FOR THE PERSISTANCE PROXY FILTER
    // IT AVOIDS LazyInitializationException: could not initialize proxy - no Session
View Full Code Here

       
        return modelAndView;
  }

    protected ModelAndView displaySearch(final HttpServletRequest request, final Model model) throws Exception {
        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);

        return modelAndView;
    }
View Full Code Here

  @Autowired
    protected MarketService marketService;
 
  @RequestMapping(value = FoUrls.FOLLOW_US_URL, method = RequestMethod.GET)
  public ModelAndView displayFollowUs(final HttpServletRequest request, final Model model, @ModelAttribute("followUsForm") FollowUsForm followUsForm) throws Exception{
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.FOLLOW_US.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final Locale locale = requestData.getLocale();
       
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.FOLLOW_US.getKey());
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.web.servlet.ModelAndViewThemeDevice

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.