示例#1
0
  public List<EventDTO> getAllEventsOfManager(Long id) {
    Manager man = em.find(Manager.class, id);

    if (man != null) {
      List<Event> events = new ArrayList<>();
      events = man.getEvents();
      return eventsToDTOs(events);
    }
    return null;
  }
示例#2
0
 public List<EventDTO> getManagerEvents(Long managerId) throws EntityDoesNotExistsException {
   try {
     Manager manager = em.find(Manager.class, managerId);
     if (manager == null) {
       throw new EntityDoesNotExistsException("Manager does not exists.");
     }
     return eventsToDTOs(manager.getEvents());
   } catch (EntityDoesNotExistsException e) {
     throw e;
   } catch (Exception e) {
     throw new EJBException(e.getMessage());
   }
 }