Package org.hoteia.qalingo.core.web.bean.geoloc

Examples of org.hoteia.qalingo.core.web.bean.geoloc.GeolocData


   
    /**
     *
     */
    public GeolocData getGeolocData(final String remoteAddress) throws Exception {
        GeolocData geolocData = null;
        if(!remoteAddress.equals("127.0.0.1")){
            geolocData = new GeolocData();
            final Country country = geolocAndGetCountry(remoteAddress);
            geolocData.setRemoteAddress(remoteAddress);
            if(country != null
                    && StringUtils.isNotEmpty(country.getIsoCode())){
                geolocData.setCountry(country);
                final City city = geolocAndGetCity(remoteAddress);
                geolocData.setCity(city);
            }
        }
        return geolocData;
    }
View Full Code Here


        logger.debug("Found {} marketArea:", marketArea.getName());
        return dozerBeanMapper.map(marketArea, MarketAreaPojo.class);
    }
   
    public GeolocDataPojo getGeolocDataByRemoteAddress(final String remoteAddress) throws Exception {
        final GeolocData geolocData = geolocService.getGeolocData(remoteAddress);
        GeolocDataPojo geolocDataPojo = new GeolocDataPojo();
        if(geolocData != null){
            if(geolocData.getCountry() != null){
                geolocDataPojo.setCountryName(geolocData.getCountry().getName());
                geolocDataPojo.setCountryIsoCode(geolocData.getCountry().getIsoCode());
            }
            if(geolocData.getCity() != null){
                geolocDataPojo.setCityName(geolocData.getCity().getName());
                geolocDataPojo.setGeoNameId(geolocData.getCity().getGeoNameId());
            }
        }
        return dozerBeanMapper.map(geolocData, GeolocDataPojo.class);
    }
View Full Code Here

    /**
     *
     */
    protected EngineEcoSession checkGeolocData(final HttpServletRequest request, EngineEcoSession engineEcoSession) throws Exception {
        final String remoteAddress = getRemoteAddr(request);
        GeolocData geolocData = engineEcoSession.getGeolocData();
        if (geolocData == null) {
            geolocData = geolocService.getGeolocData(remoteAddress);
            handleGeolocData(request, engineEcoSession, geolocData);
        } else {
            if (StringUtils.isNotEmpty(geolocData.getRemoteAddress())
                    && !geolocData.getRemoteAddress().equals(remoteAddress)) {
                // IP ADDRESS HAS CHANGED - RELOAD
                geolocData = geolocService.getGeolocData(remoteAddress);
                handleGeolocData(request, engineEcoSession, geolocData);
            }
        }
View Full Code Here

                }
            }
        }

        // 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 {
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.web.bean.geoloc.GeolocData

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.