Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package bean;
- import adminjsf.MonitorController;
- import domain.Monitor;
- import javax.ejb.EJB;
- import javax.faces.bean.ManagedBean;
- import javax.faces.bean.SessionScoped;
- /**
- * @author
- */
- @ManagedBean
- @SessionScoped
- public class NavigationBean {
- private boolean logInFailed = false;
- private boolean loggedIn = false;
- @EJB private adminjsf.MonitorController ejbFacade;
- private Monitor currentMonitor;
- private String username;
- private String password;
- /** Creates a new instance of NavigationBean */
- public NavigationBean() {
- }
- public boolean isLoggedIn() {
- return loggedIn;
- }
- public void setLoggedIn(boolean loggedIn) {
- this.loggedIn = loggedIn;
- }
- public Monitor getCurrentMonitor() {
- return currentMonitor;
- }
- public void setCurrentMonitor(Monitor currentMonitor) {
- this.currentMonitor = currentMonitor;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public boolean isLogInFailed() {
- return logInFailed;
- }
- public void setLogInFailed(boolean logInFailed) {
- this.logInFailed = logInFailed;
- }
- public String login() {
- String output = null;
- currentMonitor = ejbFacade.getMonitorByName(username);
- if (currentMonitor == null) {
- logInFailed = true;
- output = null;
- } else {
- if (currentMonitor.getLogin().equals(password)) {
- logInFailed = false;
- output = "WEB-INF/usermanagement.xhtml";
- } else {
- logInFailed = true;
- output = null;
- }
- }
- return output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement