@Override
  public Application findByNameAndUser(User user, String name) throws ServiceException {
    try {
      Application application = applicationDAO.findByNameAndUser(user.getId(), name);

      return application;

    } catch (PersistenceException e) {
      logger.error(user.toString(), e);
      throw new ServiceException(user.toString(), e);
    }
  }
Beispiel #2
0
  private void list() {

    System.out.println("The customers are");

    if (users.size() > 0) {
      for (User user : users) System.out.println("  " + user.toString());
    } else {
      System.out.println("  none");
    }
  }
 @Override
 public List<Application> findAllByUser(User user) throws ServiceException {
   try {
     List<Application> applications = applicationDAO.findAllByUser(user.getId());
     logger.debug("ApplicationService : All Applications found ");
     return applications;
   } catch (PersistenceException e) {
     logger.error("Error ApplicationService : error findById Method : " + user);
     throw new ServiceException(user.toString(), e);
   }
 }
  public void updateTicketList() {
    User user = Application.getCurrentUser();

    TicketDAO dao = TicketDAO.getInstance();
    List<Ticket> openTickets;

    boolean showAllOpenTicket = false;
    if (user.getNewUserType() != null) {
      Set<UserPermission> permissions = user.getNewUserType().getPermissions();
      if (permissions != null) {
        for (UserPermission permission : permissions) {
          if (permission.equals(UserPermission.VIEW_ALL_OPEN_TICKET)) {
            showAllOpenTicket = true;
            break;
          }
        }
      }
    }

    if (showAllOpenTicket) {
      openTickets = dao.findOpenTickets();
    } else {
      openTickets = dao.findOpenTicketsForUser(user);
    }
    openTicketList.setTickets(openTickets);

    lblUserName.setText(
        POSConstants.WELCOME
            + " "
            + user.toString()
            + ". "
            + POSConstants.YOU
            + " "
            + POSConstants.HAVE
            + " "
            + openTickets.size()
            + " "
            + POSConstants.TICKETS);
  }