String name = principal.getName();
String ceo = "CEO";
String pres = "PRESIDENT";
String vpres = "VICE-PRESIDENT";
InternalAccount user = intBo.findUserByusername(name);
System.out.println("User name is: "+user.getFirstname());
System.out.println("User Role is: "+user.getPosition());
ModelAndView modelAndView = new ModelAndView("internalmgmtsuccessmsg");
InternalCriticalTransaction internalCriticalTransaction = new InternalCriticalTransaction();
internalCriticalTransaction.setRequest("Delete User");
internalCriticalTransaction.setEmployeeId(userbyid.getEmployeeId());
internalCriticalTransaction.setDeptid(userbyid.getDeptid());
if(user.getPosition().equals(ceo)){
System.out.println("User Role is matched: "+user.getPosition());
internalCriticalTransaction.setCeoapp("yes");
internalCriticalTransaction.setPresapp("no");
internalCriticalTransaction.setVpresapp("no");
}
if(user.getPosition().equals(pres)){
internalCriticalTransaction.setCeoapp("no");
internalCriticalTransaction.setPresapp("yes");
internalCriticalTransaction.setVpresapp("no");
}
if(user.getPosition().equals(vpres)){
internalCriticalTransaction.setCeoapp("no");
internalCriticalTransaction.setPresapp("no");
internalCriticalTransaction.setVpresapp("yes");
}