try {
final RequestData requestData = requestUtil.getRequestData(request);
modelAndView.getModelMap().put(ModelConstants.COMMON_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanCommon(requestData));
final MarketPlace currentMarketPlace = requestData.getMarketPlace();
final Market currentMarket = requestData.getMarket();
final MarketArea currentMarketArea = requestData.getMarketArea();
final Localization currentLocalization = requestData.getMarketAreaLocalization();
final User user = requestData.getUser();
final Company company = requestData.getCompany();
if(user != null){
modelAndView.getModelMap().put(ModelConstants.AUTHENTICATED_USER_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanUser(requestData, user));
}
modelAndView.getModelMap().put(ModelConstants.LEGAl_TERMS_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanLegalTerms(requestData));
modelAndView.getModelMap().put(ModelConstants.HEADER_CART, backofficeViewBeanFactory.buildViewBeanHeaderCart(requestData));
// ALL MARKETPLACES
modelAndView.getModelMap().put(ModelConstants.MARKET_PLACES_VIEW_BEAN, backofficeViewBeanFactory.buildListViewBeanMarketPlace(requestData));
// MARKETS FOR THE CURRENT MARKETPLACE
Set<Market> marketList = currentMarketPlace.getMarkets();
modelAndView.getModelMap().put(ModelConstants.MARKETS_VIEW_BEAN, backofficeViewBeanFactory.buildListViewBeanMarket(requestData, currentMarketPlace, new ArrayList<Market>(marketList)));
// MARKET AREAS FOR THE CURRENT MARKET
Set<MarketArea> marketAreaList = currentMarket.getMarketAreas();
modelAndView.getModelMap().put(ModelConstants.MARKET_AREAS_VIEW_BEAN, backofficeViewBeanFactory.buildListViewBeanMarketArea(requestData, currentMarket, new ArrayList<MarketArea>(marketAreaList)));
// LOCALIZATIONS FOR THE CURRENT MARKET AREA
modelAndView.getModelMap().put(ModelConstants.MARKET_AREA_LANGUAGES_VIEW_BEAN, backofficeViewBeanFactory.buildListViewBeanLocalizationByMarketArea(requestData, currentLocalization));