コード例 #1
0
  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);
  }
コード例 #2
0
  public void updateView() {
    User user = Application.getCurrentUser();
    UserType userType = user.getNewUserType();
    if (userType != null) {
      Set<UserPermission> permissions = userType.getPermissions();
      if (permissions != null) {
        btnNewTicket.setEnabled(false);
        btnBackOffice.setEnabled(false);
        btnEditTicket.setEnabled(false);

        if (!"false".equalsIgnoreCase(AppConfig.getFeatureGroupTicketFlag())) {
          btnGroupSettle.setEnabled(false);
        }

        if (!"false".equalsIgnoreCase(AppConfig.getManagerMenuFlag())) {
          btnManager.setEnabled(false);
        }

        if (!"false".equalsIgnoreCase(AppConfig.getFeaturePenarikanFlag())) {
          btnPayout.setEnabled(false);
        }

        btnReopenTicket.setEnabled(false);
        btnSettleTicket.setEnabled(false);

        if (!"false".equalsIgnoreCase(AppConfig.getFeatureSplitTicketFlag())) {
          btnSplitTicket.setEnabled(false);
        }

        btnTakeout.setEnabled(false);
        btnVoidTicket.setEnabled(false);

        for (UserPermission permission : permissions) {
          if (permission.equals(UserPermission.VOID_TICKET)) {
            btnVoidTicket.setEnabled(true);
          } else if (permission.equals(UserPermission.PAY_OUT)) {
            if (!"false".equalsIgnoreCase(AppConfig.getFeaturePenarikanFlag())) {
              btnPayout.setEnabled(true);
            }
          } else if (permission.equals(UserPermission.SETTLE_TICKET)) {
            btnSettleTicket.setEnabled(true);
            if (!"false".equalsIgnoreCase(AppConfig.getFeatureGroupTicketFlag())) {
              btnGroupSettle.setEnabled(true);
            }
          } else if (permission.equals(UserPermission.REOPEN_TICKET)) {
            btnReopenTicket.setEnabled(true);
          } else if (permission.equals(UserPermission.PERFORM_MANAGER_TASK)) {
            if (!"false".equalsIgnoreCase(AppConfig.getManagerMenuFlag())) {
              btnManager.setEnabled(true);
            }
          } else if (permission.equals(UserPermission.SPLIT_TICKET)) {
            if (!"false".equalsIgnoreCase(AppConfig.getFeatureSplitTicketFlag())) {
              btnSplitTicket.setEnabled(true);
            }
          } else if (permission.equals(UserPermission.TAKE_OUT)) {
            btnTakeout.setEnabled(true);
          } else if (permission.equals(UserPermission.VIEW_BACK_OFFICE)) {
            btnBackOffice.setEnabled(true);
          }
          //                    else if (permission.equals(UserPermission.PAY_OUT)) {
          //                        btnPayout.setEnabled(true);
          //                    }
          else if (permission.equals(UserPermission.EDIT_TICKET)) {
            btnEditTicket.setEnabled(true);
          } else if (permission.equals(UserPermission.CREATE_NEW_TICKET)) {
            btnNewTicket.setEnabled(true);
          }
        }
      }
    }

    updateTicketList();
  }