コード例 #1
0
  protected void initSpecificSeo(
      final HttpServletRequest request,
      final ModelAndView modelAndView,
      final String titleKeyPrefixSufix,
      String productName)
      throws Exception {
    final Localization currentLocalization = requestUtil.getCurrentLocalization(request);
    final Locale locale = currentLocalization.getLocale();

    String pageTitleKey = "header.title." + titleKeyPrefixSufix;
    String appName = (String) modelAndView.getModelMap().get(Constants.APP_NAME);
    Object[] params = {productName};
    String headerTitle = coreMessageSource.getMessage(pageTitleKey, params, locale);
    modelAndView.addObject("seoPageTitle", appName + " - " + headerTitle);
    modelAndView.addObject("mainContentTitle", headerTitle);
  }
コード例 #2
0
  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();
    final CurrencyReferential currency = requestData.getMarketAreaCurrency();

    String url =
        buildDefaultPrefix(requestData) + FoUrls.CHANGE_LANGUAGE.getUrlWithoutWildcard() + "?";
    url =
        url
            + RequestConstants.REQUEST_PARAMETER_MARKET_PLACE_CODE
            + "="
            + replaceSpaceAndUnderscore(marketPlace.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_CODE
            + "="
            + replaceSpaceAndUnderscore(market.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_CODE
            + "="
            + replaceSpaceAndUnderscore(marketArea.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_LANGUAGE
            + "="
            + replaceSpaceAndUnderscore(localization.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_RETAILER_CODE
            + "="
            + replaceSpaceAndUnderscore(retailer.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_CURRENCY_CODE
            + "="
            + replaceSpaceAndUnderscore(currency.getCode());
    return url;
  }
コード例 #3
0
 public String buildChangeLanguageUrl(
     final RequestData requestData, final Localization localization) throws Exception {
   return buildDefaultPrefix(requestData)
       + FoUrls.CHANGE_LANGUAGE.getUrlWithoutWildcard()
       + "?"
       + RequestConstants.REQUEST_PARAMETER_LOCALE_CODE
       + "="
       + handleString(localization.getCode());
 }
コード例 #4
0
  public String buildChangeContextUrl(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) + FoUrls.CHANGE_CONTEXT.getUrlWithoutWildcard() + "?";
    url =
        url
            + RequestConstants.REQUEST_PARAMETER_MARKET_PLACE_CODE
            + "="
            + handleString(marketPlace.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_CODE
            + "="
            + handleString(market.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_CODE
            + "="
            + handleString(marketArea.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_MARKET_LANGUAGE
            + "="
            + handleString(localization.getCode());
    url =
        url
            + "&"
            + RequestConstants.REQUEST_PARAMETER_RETAILER_CODE
            + "="
            + handleString(retailer.getCode());
    return url;
  }
コード例 #5
0
  @Override
  public List<MenuViewBean> buildListViewBeanHeaderMenu(final RequestData requestData)
      throws Exception {
    final HttpServletRequest request = requestData.getRequest();
    final Localization localization = requestData.getMarketAreaLocalization();
    final Locale locale = localization.getLocale();
    final String currentUrl = requestUtil.getCurrentRequestUrl(request);

    final List<MenuViewBean> menuViewBeans = new ArrayList<MenuViewBean>();

    List<String> homeUrls = new ArrayList<String>();
    homeUrls.add(BoUrls.HOME.getUrlPatternKey());

    MenuViewBean menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, homeUrls));
    menu.setCssIcon("fa fa-home");
    menu.setName(getSpecificMessage(ScopeWebMessage.HEADER_MENU, "home", locale));
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.HOME, requestData));
    menuViewBeans.add(menu);

    List<String> catalogUrls = new ArrayList<String>();
    catalogUrls.add(BoUrls.CATALOG.getUrlPatternKey());

    menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, catalogUrls));
    menu.setCssIcon("fa fa-sitemap");
    menu.setName("Catalog stats");
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.CATALOG, requestData));
    menuViewBeans.add(menu);

    List<String> ruletUrls = new ArrayList<String>();
    ruletUrls.add(BoUrls.RULE_LIST.getUrlPatternKey());

    menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, ruletUrls));
    menu.setCssIcon("fa fa-money");
    menu.setName("Promotion stats");
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.RULE_LIST, requestData));
    menuViewBeans.add(menu);

    List<String> deliveryMethodsUrls = new ArrayList<String>();
    deliveryMethodsUrls.add(BoUrls.DELIVERY_METHOD_LIST.getUrlPatternKey());

    menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, deliveryMethodsUrls));
    menu.setCssIcon("fa fa-truck");
    menu.setName("Shipping stats");
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_LIST, requestData));
    menuViewBeans.add(menu);

    List<String> orderUrls = new ArrayList<String>();
    orderUrls.add(BoUrls.ORDER_LIST.getUrlPatternKey());

    menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, orderUrls));
    menu.setCssIcon("fa fa-shopping-cart");
    menu.setName("Orders stats");
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.ORDER_LIST, requestData));
    menuViewBeans.add(menu);

    List<String> customerUrls = new ArrayList<String>();
    customerUrls.add(BoUrls.CUSTOMER_LIST.getUrlPatternKey());

    menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, customerUrls));
    menu.setCssIcon("fa fa-group");
    menu.setName("Customers stats");
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.CUSTOMER_LIST, requestData));
    menuViewBeans.add(menu);

    List<String> reportingUrls = new ArrayList<String>();
    reportingUrls.add(BoUrls.REPORTING.getUrlPatternKey());

    menu = new MenuViewBean();
    menu.setActive(menuIsActive(currentUrl, reportingUrls));
    menu.setCssIcon("fa fa-bar-chart-o");
    menu.setName("Reporting");
    menu.setUrl(backofficeUrlService.generateUrl(BoUrls.REPORTING, requestData));
    menuViewBeans.add(menu);

    //		menu = new MenuViewBean();
    //		menu.setCssIcon("fa fa-paper-clip");
    //		menu.setName("FAQ");
    //		menu.setUrl(backofficeUrlService.generateUrl(BoUrls.FAQ, requestData));
    //		menuViewBeans.add(menu);

    return menuViewBeans;
  }
コード例 #6
0
 @ModelAttribute(ModelConstants.COUNTRIES)
 public List<ValueBean> getCountries(HttpServletRequest request) throws Exception {
   Localization currentMarketAreaLocalization =
       requestUtil.getCurrentMarketAreaLocalization(request);
   return getCountries(currentMarketAreaLocalization.getLocale());
 }
コード例 #7
0
  public void generateOrderConfirmation(final OrderCustomer order) {
    try {
      final MarketArea marketArea = marketService.getMarketAreaById(order.getMarketAreaId());
      final Localization localization =
          localizationService.getLocalizationById(order.getLocalizationId());
      final Locale locale = localization.getLocale();

      // WE SET TO NULL USELESS DATA - BETTER WAY SHOULD BE TO USE A SPECIFIC DOZER RULE
      for (Iterator<OrderItem> iterator = order.getOrderItems().iterator(); iterator.hasNext(); ) {
        OrderItem orderItem = (OrderItem) iterator.next();
        orderItem.getProductSku().setPrices(null);
        orderItem.getProductSku().setStocks(null);
        orderItem.getProductSku().setProductMarketing(null);
        orderItem.getProductSku().setRetailers(null);
      }

      final OrderCustomerPojo orderCustomerPojo = orderPojoService.handleOrderMapping(order);

      final String jrxml = getOrderConfirmationTemplateByMarketArea(marketArea);
      File fileJrxml = new File(jrxml);
      final String resourcePath = jrxml.replace(fileJrxml.getName(), "");
      final JasperReport jasperReport = JasperCompileManager.compileReport(jrxml);

      Map<String, Object> parameters = new HashMap<String, Object>();
      parameters.put("RESOURCE_PATH", resourcePath);
      parameters.put("RECORD_DELIMITER", "\r\n");
      parameters.put("order", orderCustomerPojo);
      Object[] orderInformationsParams = {orderCustomerPojo.getOrderNum()};
      parameters.put(
          "orderInformations",
          coreMessageSource.getDocumentMessage(
              ScopeDocumentMessage.ORDER_CONFIRMATION,
              "header_order_informations",
              orderInformationsParams,
              locale));
      parameters.put("date", orderCustomerPojo.getDateUpdate().toString());
      parameters.put("billingAddress", orderCustomerPojo.getBillingAddress());
      parameters.put("shippingAddress", orderCustomerPojo.getShippingAddress());

      Map<String, String> wording =
          coreMessageSource.loadWording(I18nKeyValueUniverse.DOCUMENT.getPropertyKey(), locale);
      parameters.put("wording", wording);

      List<OrderItem> orderItems = new ArrayList<OrderItem>();
      Set<OrderShipment> orderShipments = orderCustomerPojo.getOrderShipments();
      for (Iterator<OrderShipment> iterator = orderShipments.iterator(); iterator.hasNext(); ) {
        OrderShipment orderShipment = (OrderShipment) iterator.next();
        orderItems.addAll(orderShipment.getOrderItems());
      }

      // TODO : denis : one page/table by OrderShipment

      JRDataSource datasource = new JRBeanCollectionDataSource(orderItems, true);

      final JasperPrint jasperPrint =
          JasperFillManager.fillReport(jasperReport, parameters, datasource);

      String fullFilePath = getOrderConfirmationFilePath(order);
      JasperExportManager.exportReportToPdfFile(jasperPrint, fullFilePath);

    } catch (Exception e) {
      logger.error("", e);
    }
  }