/**
* Most of the code in the Qalingo project is copyrighted Hoteia and licensed
* under the Apache License Version 2.0 (release version 0.8.0)
* http://www.apache.org/licenses/LICENSE-2.0
*
* Copyright (c) Hoteia, 2012-2014
* http://www.hoteia.com - http://twitter.com/hoteia - contact@hoteia.com
*
*/
package org.hoteia.qalingo.web.mvc.controller.common;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.hoteia.qalingo.core.domain.enumtype.FoUrls;
import org.hoteia.qalingo.core.i18n.enumtype.ScopeWebMessage;
import org.hoteia.qalingo.core.pojo.RequestData;
import org.hoteia.qalingo.core.web.mvc.viewbean.BreadcrumbViewBean;
import org.hoteia.qalingo.core.web.mvc.viewbean.MenuViewBean;
import org.hoteia.qalingo.core.web.servlet.ModelAndViewThemeDevice;
import org.hoteia.qalingo.web.mvc.controller.AbstractMCommerceController;
/**
*
*/
@Controller("legalTermsController")
public class LegalTermsController extends AbstractMCommerceController {
@RequestMapping(FoUrls.LEGAL_TERMS_URL)
public ModelAndView legalTerms(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.LEGAL_TERMS.getVelocityPage());
final RequestData requestData = requestUtil.getRequestData(request);
final Locale locale = requestData.getLocale();
overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView, FoUrls.LEGAL_TERMS.getKey());
// BREADCRUMB
BreadcrumbViewBean breadcrumbViewBean = new BreadcrumbViewBean();
breadcrumbViewBean.setName(getSpecificMessage(ScopeWebMessage.HEADER_TITLE, "legal_terms", locale));
List<MenuViewBean> menuViewBeans = new ArrayList<MenuViewBean>();
MenuViewBean menu = new MenuViewBean();
menu.setName(getSpecificMessage(ScopeWebMessage.HEADER_MENU, "home", locale));
menu.setUrl(urlService.generateUrl(FoUrls.HOME, requestData));
menuViewBeans.add(menu);
menu = new MenuViewBean();
menu.setName(getSpecificMessage(ScopeWebMessage.HEADER_MENU, "legal_terms", locale));
menu.setUrl(urlService.generateUrl(FoUrls.LEGAL_TERMS, requestData));
menu.setActive(true);
menuViewBeans.add(menu);
return modelAndView;
}
}