Package com.agilebooster.view

Source Code of com.agilebooster.view.MenuBarBean

/*
* (C) Copyright 2014 Agile Booster.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     Maxime ESCOURBIAC
*/
package com.agilebooster.view;

import com.agilebooster.data.entity.Project;
import com.agilebooster.data.entity.User;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

/**
* Bean used by the menubar component.
*
* @author Maxime ESCOURBIAC
*/
@ManagedBean(name = "menuBarBean")
@RequestScoped
public class MenuBarBean implements Serializable {

    @ManagedProperty(value = "#{sessionBean}")
    private SessionBean sessionBean;

    /**
     * Creates a new instance of MenuBar
     */
    public MenuBarBean() {
    }
   
    /**
     * Logout the user.
     */
    public void logout(){
        sessionBean.logout();
    }

    /**
     * Return the list of all the projects.
     *
     * @return The list of all the projects.
     */
    public List<Project> getProjects() {
        List<Project> projects = null;
        User user = sessionBean.getUser();
        if (user != null) {
            projects = user.getAccessibleProject();
        }
        return projects;
    }

    /**
     * Session Bean.
     *
     * @return Session Bean.
     */
    public SessionBean getSessionBean() {
        return sessionBean;
    }

    /**
     * Session Bean.
     *
     * @param sessionBean Session Bean.
     */
    public void setSessionBean(SessionBean sessionBean) {
        this.sessionBean = sessionBean;
    }

}
TOP

Related Classes of com.agilebooster.view.MenuBarBean

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.