/*
 * Copyright
 *   2007 axYus - www.axyus.com
 *
 * This file is part of XEMELIOS.
 *
 * XEMELIOS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * XEMELIOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with XEMELIOS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package fr.gouv.finances.dgfip.xemelios.web;

import fr.gouv.finances.dgfip.utils.NavigationContext;
import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
import fr.gouv.finances.dgfip.xemelios.services.Menu;
import fr.gouv.finances.dgfip.xemelios.web.utils.FilAriane;
import javax.servlet.http.HttpSession;

/**
 * @author CBO
 */
public class AttributeHelper {

    static private final String USER_SAN = "xemeliosUser";
    static private final String MENU_SAN = "menu";
    static private final String FIL_ARIANE_SAN = "filAriane";
    private static final String NAV_CTX = "naivgation.context";
    private static final String PREVIOUS_VIEW = "previous.view";

    static public XemeliosUser getUser(HttpSession session) {
        return (XemeliosUser) session.getAttribute(USER_SAN);
    }

    static public void setUser(HttpSession session, XemeliosUser user) {
        session.setAttribute(USER_SAN, user);
    }

    static public Menu getMenu(HttpSession session) {
        return (Menu) session.getAttribute(MENU_SAN);
    }

    static public void setMenu(HttpSession session, Menu menu) {
        session.setAttribute(MENU_SAN, menu);
    }

    static public FilAriane getFilAriane(HttpSession session) {
        return (FilAriane) session.getAttribute(FIL_ARIANE_SAN);
    }

    static public void setFilAriane(HttpSession session, FilAriane filAriane) {
        session.setAttribute(FIL_ARIANE_SAN, filAriane);
    }
    public static void setNavigationContext(HttpSession session, NavigationContext ctx) {
        session.setAttribute(NAV_CTX,ctx);
    }
    public static NavigationContext getNavigationContext(HttpSession session) {
        return (NavigationContext)session.getAttribute(NAV_CTX);
    }
    public static void setPreviousView(HttpSession session, String previousView) {
        session.setAttribute(PREVIOUS_VIEW,previousView);
    }
    public static String getPreviousView(HttpSession session) {
        return (String)session.getAttribute(PREVIOUS_VIEW);
    }
}
