1 package projectmanagement.presentation; 2 3 import projectmanagement.spec.employee.Employee; 4 5 13 public class ProjectManagementSessionData implements java.io.Serializable { 14 15 18 public static final String SESSION_KEY = "ProjectManagementSessionData"; 19 20 protected Employee myUser = null; 21 protected String userMessage = null; 22 protected boolean isAdmin=false; 23 24 29 public void setUser(Employee theEmployee) { 30 this.myUser = theEmployee; 31 } 32 33 38 public Employee getUser() { 39 return this.myUser; 40 } 41 42 45 public void removeUser() { 46 this.myUser = null; 47 } 48 49 54 public void setUserMessage(String msg) { 55 this.userMessage = msg; 56 } 57 58 public void setAdmin (boolean isAdmin) { 59 this.isAdmin=isAdmin; 60 } 61 62 public int getAuthLevel() { 63 if (isAdmin) { 64 return 2; 65 } else if (myUser!=null) { 66 return myUser.getAuthLevel(); 67 } else { 68 return 0; 69 } 70 } 71 72 76 public String getAndClearUserMessage() { 77 String msg = this.userMessage; 78 this.userMessage = null; 79 return msg; 80 } 81 } 82 | Popular Tags |