Package org.hoteia.qalingo.core.domain

Examples of org.hoteia.qalingo.core.domain.Retailer


    return productService.saveOrUpdateProductMarketingAsset(asset);
  }
 
  public Retailer createOrUpdateRetailer(Retailer retailer, final RetailerForm retailerForm) throws Exception {
      if (retailer == null) {
          retailer = new Retailer();
      }
        if (StringUtils.isNotEmpty(retailerForm.getCode())) {
            retailer.setCode(retailerForm.getCode());
        }
        if (StringUtils.isNotEmpty(retailerForm.getName())) {
View Full Code Here


       
        FetchPlan fetchPlan = handleSpecificRetailerFetchMode(criteria, params);
       
        criteria.add(Restrictions.eq("id", retailerId));
       
        Retailer retailer = (Retailer) criteria.uniqueResult();
        if(retailer != null){
            retailer.setFetchPlan(fetchPlan);
        }
        return retailer;
  }
View Full Code Here

        FetchPlan fetchPlan = handleSpecificRetailerFetchMode(criteria, params);

        criteria.add(Restrictions.eq("code", handleCodeValue(retailerCode)));
       
        Retailer retailer = (Retailer) criteria.uniqueResult();
        if(retailer != null){
            retailer.setFetchPlan(fetchPlan);
        }
        return retailer;
    }
View Full Code Here

        FetchPlan fetchPlan = handleSpecificRetailerFetchMode(criteria, params);

        criteria.add(Restrictions.eq("code", handleCodeValue(retailerCode)));
       
        Retailer retailer = (Retailer) criteria.uniqueResult();
        if(retailer != null){
            retailer.setFetchPlan(fetchPlan);
        }
    return retailer;
  }
View Full Code Here

    retailer.setDateUpdate(new Date());
        if (retailer.getId() != null) {
            if(em.contains(retailer)){
                em.refresh(retailer);
            }
            Retailer mergedRetailer = em.merge(retailer);
            em.flush();
            return mergedRetailer;
        } else {
            em.persist(retailer);
            return retailer;
View Full Code Here

  public ModelAndView displayContactForm(final HttpServletRequest request, @PathVariable(RequestConstants.URL_PATTERN_RETAILER_CODE) final String retailerCode,
                       Model model, @ModelAttribute("retailerContactForm") RetailerContactForm retailerContactForm) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.RETAILER_CONTACT.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea currentMarketArea = requestData.getMarketArea();
        final Retailer currentRetailer = requestData.getMarketAreaRetailer();
   
    modelAndView.addObject(ModelConstants.URL_BACK, urlService.generateUrl(FoUrls.HOME, requestUtil.getRequestData(request)));
   
    Retailer retailer = retailerService.getRetailerByCode(currentMarketArea.getId(), currentRetailer.getId(), retailerCode);

    // SANITY CHECK
    if(retailer.getDefaultAddress() == null
        || StringUtils.isEmpty(retailer.getDefaultAddress().getEmail())){
      final String url = urlService.generateUrl(FoUrls.RETAILER_DETAILS, requestUtil.getRequestData(request), retailer);
          return new ModelAndView(new RedirectView(url));
    }

    RetailerViewBean retailerViewBean = frontofficeViewBeanFactory.buildViewBeanRetailer(requestUtil.getRequestData(request), retailer);
View Full Code Here

        model.addAttribute(ModelConstants.PRICE_SCORE_MAX, 5);
        }
   
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea currentMarketArea = requestData.getMarketArea();
        final Retailer currentRetailer = requestData.getMarketAreaRetailer();
   
    Retailer retailer = retailerService.getRetailerByCode(currentMarketArea.getId(), currentRetailer.getId(), retailerCode);
   
    if(retailerCommentForm == null
          || retailerCommentForm.equals(new RetailerCommentForm())){
      retailerCommentForm = formFactory.buildRetailerCommentForm(requestData, retailer);
      model.addAttribute("retailerContactForm", retailerCommentForm);
View Full Code Here

  public ModelAndView submitRetailerComment(final HttpServletRequest request, @PathVariable(RequestConstants.URL_PATTERN_RETAILER_CODE) final String retailerCode,
                        @Valid @ModelAttribute("retailerCommentForm") RetailerCommentForm retailerCommentForm,
                BindingResult result, final Model model) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea currentMarketArea = requestData.getMarketArea();
        final Retailer currentRetailer = requestData.getMarketAreaRetailer();
        final Locale locale = requestData.getLocale();
   
    if (result.hasErrors()) {
      return displayRetailerCommentForm(request, retailerCode, model, retailerCommentForm);
    }
   
    int qualityOfService = 0;
    int ratioQualityPrice = 0;
    int priceScore = 0;
   
    try {
      qualityOfService = Integer.parseInt(retailerCommentForm.getQualityOfService());
        } catch (Exception e) {
          logger.warn("Retailer Vote qualityOfService value can't be parse: " + retailerCommentForm.getQualityOfService());
        }
   
    try {
      ratioQualityPrice = Integer.parseInt(retailerCommentForm.getRatioQualityPrice());
        } catch (Exception e) {
          logger.warn("Retailer Vote ratioQualityPrice value can't be parse: " + retailerCommentForm.getRatioQualityPrice());
        }
   
    try {
      priceScore = Integer.parseInt(retailerCommentForm.getPriceScore());
        } catch (Exception e) {
          logger.warn("Retailer Vote priceScore value can't be parse: " + retailerCommentForm.getPriceScore());
        }
   
    if (StringUtils.isEmpty(retailerCommentForm.getComment())
        && qualityOfService == 0
        && ratioQualityPrice == 0
        && priceScore == 0) {
      // WARNING
      addInfoMessage(request, getSpecificMessage(ScopeWebMessage.RETAILER, "comment_form_empty_warning_message",  locale));
      return displayRetailerCommentForm(request, retailerCode, model, retailerCommentForm);
    }
   
    final Retailer retailer = retailerService.getRetailerByCode(currentMarketArea.getId(), currentRetailer.getId(), retailerCode);
    final Customer customer = requestData.getCustomer();
   
    if (qualityOfService != 0) {
      RetailerCustomerRate retailerCustomerRate = new RetailerCustomerRate();
      retailerCustomerRate.setRate(qualityOfService);
      retailerCustomerRate.setRetailerId(retailer.getId());
      retailerCustomerRate.setCustomerId(customer.getId());
      retailerCustomerRate.setType("QUALITY_OF_SERVICE");
      retailerService.saveOrUpdateRetailerCustomerRate(retailerCustomerRate);
    }
   
    if (ratioQualityPrice != 0) {
      RetailerCustomerRate retailerCustomerRate = new RetailerCustomerRate();
      retailerCustomerRate.setRate(ratioQualityPrice);
      retailerCustomerRate.setRetailerId(retailer.getId());
      retailerCustomerRate.setCustomerId(customer.getId());
      retailerCustomerRate.setType("RATIO_QUALITY_PRICE");
      retailerService.saveOrUpdateRetailerCustomerRate(retailerCustomerRate);
    }
   
    if (priceScore != 0) {
      RetailerCustomerRate retailerCustomerRate = new RetailerCustomerRate();
      retailerCustomerRate.setRate(priceScore);
      retailerCustomerRate.setRetailerId(retailer.getId());
      retailerCustomerRate.setCustomerId(customer.getId());
      retailerCustomerRate.setType("PRICE_SCORE");
      retailerService.saveOrUpdateRetailerCustomerRate(retailerCustomerRate);
    }
   
    if (StringUtils.isNotEmpty(retailerCommentForm.getComment())) {
      RetailerCustomerComment retailerCustomerComment = new RetailerCustomerComment();
      retailerCustomerComment.setComment(retailerCommentForm.getComment());
      retailerCustomerComment.setRetailerId(retailer.getId());
      retailerCustomerComment.setCustomer(customer);
      retailerService.saveOrUpdateRetailerCustomerComment(retailerCustomerComment);
    }
   
    addSuccessMessage(request, getSpecificMessage(ScopeWebMessage.RETAILER, "comment_form_success_message",  locale));
View Full Code Here

  @RequestMapping(FoUrls.RETAILER_DETAILS_URL)
  public ModelAndView displayRetailerDetails(final HttpServletRequest request, final Model model, @PathVariable(RequestConstants.URL_PATTERN_RETAILER_CODE) final String retailerCode) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.RETAILER_DETAILS.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea currentMarketArea = requestData.getMarketArea();
        final Retailer currentRetailer = requestData.getMarketAreaRetailer();

    Retailer retailer = retailerService.getRetailerByCode(currentMarketArea.getId(), currentRetailer.getId(), retailerCode);
   
    RetailerViewBean retailerViewBean = frontofficeViewBeanFactory.buildViewBeanRetailer(requestUtil.getRequestData(request), retailer);
    model.addAttribute(ModelConstants.RETAILER_VIEW_BEAN, retailerViewBean);
   
    // STAR
View Full Code Here

  public String buildChangeLanguageUrl(final RequestData requestData) throws Exception {
    final MarketPlace marketPlace = requestData.getMarketPlace();
    final Market market = requestData.getMarket();
    final MarketArea marketArea = requestData.getMarketArea();
    final Localization localization = requestData.getMarketAreaLocalization();
    final Retailer retailer = requestData.getMarketAreaRetailer();
   
    String url = buildDefaultPrefix(requestData) + BoUrls.CHANGE_LANGUAGE.getUrlWithoutWildcard() + "?";
    url = url + RequestConstants.REQUEST_PARAMETER_MARKET_PLACE_CODE + "=" + handleParamValue(marketPlace.getCode());
    url = url + "&" + RequestConstants.REQUEST_PARAMETER_MARKET_CODE + "=" + handleParamValue(market.getCode());
    url = url + "&" + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_CODE + "=" + handleParamValue(marketArea.getCode());
    url = url + "&" + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_RETAILER_CODE + "=" + handleParamValue(retailer.getCode());
        url = url + "&" + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_LANGUAGE + "=" + handleParamValue(localization.getCode());
    return url;
  }
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.domain.Retailer

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.