if (StringUtils.isEmpty(storeCode)) {
final String urlRedirect = backofficeUrlService.generateUrl(BoUrls.STORE_LIST, requestData);
return new ModelAndView(new RedirectView(urlRedirect));
}
final Store retailer = retailerService.getStoreByCode(storeCode);
// SANITY CHECK
if (retailer != null) {
modelAndView.addObject(ModelConstants.STORE_VIEW_BEAN, backofficeViewBeanFactory.buildViewBeanStore(requestData, retailer));
} else {
final String url = requestUtil.getLastRequestUrl(request);
return new ModelAndView(new RedirectView(url));
}
model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.STORE_LIST, requestData));
model.addAttribute(ModelConstants.URL_RETAILER_VIEW, backofficeUrlService.generateUrl(BoUrls.RETAILER_DETAILS, requestData, retailer));
Object[] params = { retailer.getName() + " (" + retailer.getCode() + ")" };
overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, BoUrls.STORE_DETAILS.getKey(), params);
return modelAndView;
}