Ejemplo n.º 1
0
 public ManagerDTO getManager(String username) {
   try {
     Manager manager = new Manager();
     List<Manager> managers =
         (List<Manager>) em.createNamedQuery("getAllManagers").getResultList();
     for (Manager m : managers) {
       if (username.equals(m.getName())) {
         manager = m;
         return managerToDTO(manager);
       }
     }
   } catch (Exception e) {
     throw new EJBException(e.getMessage());
   }
   return null;
 }
Ejemplo n.º 2
0
 ManagerDTO managerToDTO(Manager manager) {
   return new ManagerDTO(
       manager.getId(), manager.getUserName(), null, manager.getName(), manager.getEmail());
 }