Package org.hoteia.qalingo.core.domain

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


    }

    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();
        final CurrencyReferential currency = requestData.getMarketAreaCurrency();
       
        String url = buildDefaultPrefix(requestData) + FoUrls.CHANGE_CONTEXT.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_LANGUAGE + "=" + handleParamValue(localization.getCode());
        url = url + "&" + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_RETAILER_CODE + "=" + handleParamValue(retailer.getCode());
        url = url + "&" + RequestConstants.REQUEST_PARAMETER_MARKET_AREA_CURRENCY_CODE + "=" + handleParamValue(currency.getCode());
        return url;
    }
View Full Code Here


    /**
     *
     */
    protected MarketArea getCurrentMarketArea(final RequestData requestData) throws Exception {
        MarketArea marketArea = null;
        final HttpServletRequest request = requestData.getRequest();
        if (requestData.isBackoffice()) {
            EngineBoSession engineBoSession = getCurrentBoSession(request);
            marketArea = engineBoSession.getCurrentMarketArea();
            if (marketArea == null) {
View Full Code Here

        engineBoSession = (EngineBoSession) setSessionMarketPlace(engineBoSession, marketPlace);

        Market market = marketPlace.getDefaultMarket();
        engineBoSession = (EngineBoSession) setSessionMarket(engineBoSession, market);

        MarketArea marketArea = market.getDefaultMarketArea();
        engineBoSession = (EngineBoSession) setSessionMarketArea(engineBoSession, marketArea);

        // DEFAULT LOCALE IS FROM THE REQUEST OR FROM THE MARKET AREA
        String requestLocale = request.getLocale().toString();
        Localization localization = marketArea.getDefaultLocalization();
        if (marketArea.getLocalization(requestLocale) != null) {
            localization = marketArea.getLocalization(requestLocale);
        } else {
            if (requestLocale.length() > 2) {
                String localeLanguage = request.getLocale().getLanguage();
                if (marketArea.getLocalization(localeLanguage) != null) {
                    localization = marketArea.getLocalization(localeLanguage);
                }
            }
        }
        engineBoSession = (EngineBoSession) setSessionMarketAreaLocalization(engineBoSession, localization);

        Retailer retailer = marketArea.getDefaultRetailer();
        engineBoSession = (EngineBoSession) setSessionMarketAreaRetailer(engineBoSession, retailer);

        final CurrencyReferential currency = marketArea.getDefaultCurrency();
        engineBoSession = (EngineBoSession) setSessionMarketAreaCurrency(engineBoSession, currency);

        updateCurrentBoSession(request, engineBoSession);
    }
View Full Code Here

     */
    protected MarketArea evaluateMarketPlace(final HttpServletRequest request) throws Exception {
        EngineEcoSession engineEcoSession = getCurrentEcoSession(request);
        MarketPlace marketPlace = null;
        Market market = null;
        MarketArea marketArea = null;
       
        if(engineEcoSession == null){
            initEcoSession(request);
        }
       
        // STEP 1 - CHECK THE URL PARAMETERS
        UrlParameterMapping urlParameterMapping = handleUrlParameters(request);
        String marketPlaceCode = urlParameterMapping.getMarketPlaceCode();
        if(StringUtils.isNotEmpty(marketPlaceCode)){
            marketPlace = marketService.getMarketPlaceByCode(marketPlaceCode);
            if(marketPlace != null){
                String marketCode = urlParameterMapping.getMarketCode();
                market = marketPlace.getMarket(marketCode);
                if(market != null){
                    String marketAreaCode = urlParameterMapping.getMarketAreaCode();
                    marketArea = market.getMarketArea(marketAreaCode);
                    return marketArea;
                }
            }
        }

        // STEP 2 - TRY TO GEOLOC THE CUSTOMER AND SET THE RIGHT MARKET AREA
        final GeolocData geolocData = engineEcoSession.getGeolocData();
        MarketArea marketAreaGeoloc = null;
        if(geolocData != null){
            final Country country = geolocData.getCountry();
            if(country != null && StringUtils.isNotEmpty(country.getIsoCode())){
                List<MarketArea> marketAreas = marketService.getMarketAreaByGeolocCountryCode(country.getIsoCode());
                if(marketAreas != null && marketAreas.size() == 1){
                    marketAreaGeoloc = marketAreas.get(0);
                } else {
                    // WE HAVE MANY MARKET AREA FOR THE CURRENT COUNTRY CODE - WE SELECT THE DEFAULT MARKET PLACE ASSOCIATE
                    for (Iterator<MarketArea> iterator = marketAreas.iterator(); iterator.hasNext();) {
                        MarketArea marketAreaIt = (MarketArea) iterator.next();
                        if(marketAreaIt.getMarket().getMarketPlace().isDefault()){
                            marketAreaGeoloc = marketAreaIt;
                        }
                    }
                }
            }
View Full Code Here

    /**
     *
     */
    protected EngineEcoSession initEcoMarketPlace(final HttpServletRequest request) throws Exception {
        EngineEcoSession engineEcoSession = getCurrentEcoSession(request);
        MarketArea marketArea = evaluateMarketPlace(request);
        Market market = marketArea.getMarket();
        MarketPlace marketPlace = market.getMarketPlace();
       
        engineEcoSession = (EngineEcoSession) setSessionMarketPlace(engineEcoSession, marketPlace);
        engineEcoSession = (EngineEcoSession) setSessionMarket(engineEcoSession, market);
        engineEcoSession = (EngineEcoSession) setSessionMarketArea(engineEcoSession, marketArea);

        // DEFAULT LOCALE IS FROM THE REQUEST OR FROM THE MARKET AREA
        marketArea = engineEcoSession.getCurrentMarketArea();
        final String requestLocale = request.getLocale().toString();
        Localization localization = marketArea.getDefaultLocalization();
        if (marketArea.getLocalization(requestLocale) != null) {
            localization = marketArea.getLocalization(requestLocale);
        } else {
            if (requestLocale.length() > 2) {
                String localeLanguage = request.getLocale().getLanguage();
                if (marketArea.getLocalization(localeLanguage) != null) {
                    localization = marketArea.getLocalization(localeLanguage);
                }
            }
        }
        engineEcoSession = (EngineEcoSession) setSessionMarketAreaLocalization(engineEcoSession, localization);

        final Retailer retailer = marketArea.getDefaultRetailer();
        engineEcoSession = (EngineEcoSession) setSessionMarketAreaRetailer(engineEcoSession, retailer);

        final CurrencyReferential currency = marketArea.getDefaultCurrency();
        engineEcoSession = (EngineEcoSession) setSessionMarketAreaCurrency(engineEcoSession, currency);

        setCurrentEcoSession(request, engineEcoSession);
       
        return engineEcoSession;
View Full Code Here

    @RequestMapping(value = BoUrls.USER_LIST_URL, method = RequestMethod.GET)
    public ModelAndView userList(final HttpServletRequest request, final Model model) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.USER_LIST.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea marketArea = requestData.getMarketArea();
       
        displayList(request, model, requestData);
       
        Object[] params = {marketArea.getName() + " (" + marketArea.getCode() + ")"};
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView,  BoUrls.USER_LIST.getKey() + "", params);

        return modelAndView;
    }
View Full Code Here

        model.addAttribute(Constants.PAGINATION_PAGE_URL, url);
        model.addAttribute(Constants.PAGINATION_PAGE_PAGED_LIST_HOLDER, userViewBeanPagedListHolder);
    }
   
    protected PagedListHolder<UserViewBean> initList(final HttpServletRequest request, String sessionKey, final RequestData requestData) throws Exception {
        final MarketArea marketArea = requestData.getMarketArea();
        List<User> users = userService.findUsers();

        PagedListHolder<UserViewBean> userViewBeanPagedListHolder = new PagedListHolder<UserViewBean>();
       
        final List<UserViewBean> userViewBeans = new ArrayList<UserViewBean>();
View Full Code Here

    @RequestMapping(value = BoUrls.ENGINE_SETTING_LIST_URL, method = RequestMethod.GET)
    public ModelAndView engineSettingList(final HttpServletRequest request, final Model model) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.ENGINE_SETTING_LIST.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea marketArea = requestData.getMarketArea();
       
        displayList(request, model, requestData);
       
        Object[] params = {marketArea.getName() + " (" + marketArea.getCode() + ")"};
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, BoUrls.ENGINE_SETTING_LIST.getKey(), params);

        return modelAndView;
    }
View Full Code Here

    private CatalogCategoryService catalogCategoryService;
   
    @RequestMapping(value = "/**/search-load-catalog-index.html", method = RequestMethod.GET)
    public ModelAndView loadIndex(final HttpServletRequest request, final HttpServletResponse response, ModelMap modelMap) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final MarketArea marketArea = requestData.getMarketArea();
        final Retailer retailer = requestData.getMarketAreaRetailer();

        List<ProductMarketing> products = productService.findProductMarketings();
        for (Iterator<ProductMarketing> iteratorProductMarketing = products.iterator(); iteratorProductMarketing.hasNext();) {
            ProductMarketing productMarketing = (ProductMarketing) iteratorProductMarketing.next();
View Full Code Here

     * @see org.hoteia.qalingo.core.service.EmailService#saveAndBuildNewsletterSubscriptionnConfirmationMail(Localization localization, Customer customer, String velocityPath, NewsletterEmailBean newsletterEmailBean)
     */
    public void saveAndBuildNewsletterSubscriptionnConfirmationMail(final RequestData requestData, final String velocityPath,
                                     final NewsletterEmailBean newsletterEmailBean) throws Exception {
        try {
          final MarketArea marketArea = requestData.getMarketArea();
          final Localization localization = requestData.getMarketAreaLocalization();
          final Locale locale = localization.getLocale();
         
          // SANITY CHECK
          checkEmailAddresses(newsletterEmailBean);
         
          Map<String, Object> model = new HashMap<String, Object>();
         
          DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.FULL, locale);
          java.sql.Timestamp currentDate = new java.sql.Timestamp((new java.util.Date()).getTime());
          model.put(CURRENT_DATE, dateFormatter.format(currentDate));
          model.put("newsletterEmailBean", newsletterEmailBean);
          model.put(WORDING, coreMessageSource.loadWording(Email.WORDING_SCOPE_EMAIL, locale));

        Map<String, String> urlParams = new HashMap<String, String>();
        urlParams.put(RequestConstants.REQUEST_PARAMETER_NEWSLETTER_EMAIL, URLEncoder.encode(newsletterEmailBean.getToEmail(), Constants.ANSI));
        urlParams.put(RequestConstants.REQUEST_PARAMETER_MARKET_AREA_CODE, marketArea.getCode());
        String unsubscribeUrl = urlService.generateUrl(FoUrls.NEWSLETTER_UNREGISTER, requestData, urlParams);
        String fullUnsubscribeUrl = urlService.buildAbsoluteUrl(requestData, unsubscribeUrl);
       
          model.put("unsubscribeUrlOrEmail", fullUnsubscribeUrl);

View Full Code Here

TOP

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

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.