/**
*
*/
protected EngineEcoSession initEcoSession(final HttpServletRequest request) throws Exception {
EngineEcoSession engineEcoSession = new EngineEcoSession();
EngineSetting engineSettingEnvironmentStagingModeEnabled = engineSettingService.getSettingEnvironmentStagingModeEnabled();
if (engineSettingEnvironmentStagingModeEnabled != null) {
engineEcoSession.setEnvironmentStagingModeEnabled(BooleanUtils.toBoolean(engineSettingEnvironmentStagingModeEnabled.getDefaultValue()));
} else {
engineEcoSession.setEnvironmentStagingModeEnabled(false);
logger.warn("Environment Type is not define in your database. Check the " + EngineSettingService.ENGINE_SETTING_ENVIRONMENT_STAGING_MODE_ENABLED + " value in settings table.");
}
EngineSetting engineSettingEnvironmentType = engineSettingService.getSettingEnvironmentType();
if (engineSettingEnvironmentType != null) {
String environmentType = engineSettingEnvironmentType.getDefaultValue();
try {
engineEcoSession.setEnvironmentType(EnvironmentType.valueOf(environmentType));
} catch (Exception e) {
logger.error("Environment Type has wrong value define in your database. Check the " + EngineSettingService.ENGINE_SETTING_ENVIRONMENT_TYPE + " value in settings table.");
}
} else {
engineEcoSession.setEnvironmentType(EnvironmentType.REEL);
logger.warn("Environment Type is not define in your database. Check the " + EngineSettingService.ENGINE_SETTING_ENVIRONMENT_TYPE + " value in settings table.");
}
// INIT STAGING OR REEL ENVIRONMENT
setCurrentEcoSession(request, engineEcoSession);
String jSessionId = request.getSession().getId();
engineEcoSession.setjSessionId(jSessionId);
// STEP 2 - TRY TO GEOLOC THE CUSTOMER AND SET THE RIGHT MARKET AREA
engineEcoSession = checkGeolocData(request, engineEcoSession);
engineEcoSession = initEcoMarketPlace(request);