Ejemplo n.º 1
0
 /** @return true if is an user that try to log in is a manager */
 public boolean isManager() {
   try {
     return userData.getLoggedUser() instanceof ManagerEntity;
   } catch (UserNotFoundException | UserGuideException | NoResultException ex) {
     Logger.getLogger(UserControllerBB.class.getName()).log(Level.SEVERE, null, ex);
     JSFUtil.addErrorMessage(ex.getMessage());
   }
   return false;
 }
Ejemplo n.º 2
0
 /**
  * @return name of logged in user
  * @throws UserNotFoundException
  */
 public String getName() throws UserNotFoundException {
   try {
     return userData.getLoggedUser().getUsername();
   } catch (NoResultException ex) {
     errorMessage = ex.getMessage();
     Logger.getLogger(UserControllerBB.class.getName()).log(Level.SEVERE, null, ex);
     return "/faces/login.xhtml?faces-redirect=true";
   } catch (UserGuideException ex) {
     Logger.getLogger(UserControllerBB.class.getName()).log(Level.SEVERE, null, ex);
   }
   return null;
 }