Exemplo n.º 1
0
  /** ********** METHODS TO LOAD DATA AND DISPLAY SUBVIEWS ************* */
  public void fetchAndShowAllCampaigns() {
    CampaignReadParams params = new CampaignReadParams(); // empty params fetches everything
    params.outputFormat = CampaignReadParams.OutputFormat.SHORT;
    this.dataService.fetchCampaignListShort(
        params,
        new AsyncCallback<List<CampaignShortInfo>>() {
          @Override
          public void onFailure(Throwable caught) {
            _logger.severe(caught.getMessage());
            view.showList();
            view.showError("There was a problem loading the campaigns:", caught);
            AwErrorUtils.logoutIfAuthException(caught);
          }

          @Override
          public void onSuccess(List<CampaignShortInfo> result) {
            view.setCampaignList(result);
            view.showList();
          }
        });
  }
Exemplo n.º 2
0
  public void fetchAndShowCampaigns(
      final RunningState state, final RoleCampaign role, final Date fromDate, final Date toDate) {
    CampaignReadParams params = new CampaignReadParams();
    params.outputFormat = CampaignReadParams.OutputFormat.SHORT;
    if (state != null) params.runningState_opt = state;
    if (role != null) params.userRole_opt = role;
    if (fromDate != null) params.startDate_opt = fromDate;
    if (toDate != null) params.endDate_opt = toDate;
    this.dataService.fetchCampaignListShort(
        params,
        new AsyncCallback<List<CampaignShortInfo>>() {
          @Override
          public void onFailure(Throwable caught) {
            _logger.severe(caught.getMessage());
            view.showList();
            view.showError("There was a problem loading the campaigns.", caught);
            AwErrorUtils.logoutIfAuthException(caught);
          }

          @Override
          public void onSuccess(List<CampaignShortInfo> result) {
            Collections.sort(result, campaignNameComparator);
            // display result
            view.setCampaignList(result);
            // set dropdown filters to match values used in query
            view.setCampaignListFilters(state, role, fromDate, toDate);
            // make list subview visible
            view.showList();
          }
        });
  }