private void findCertificates() {
    try {
      showProgess("Searching...");
      getUserCertificates().clearTable();
      UserCertificateFilter f = new UserCertificateFilter();
      f.setGridIdentity(Utils.clean(getGridIdentity().getText()));
      if (Utils.clean(getUserCertificateSerialNumber().getText()) != null) {
        try {
          f.setSerialNumber(Long.valueOf(Utils.clean(getUserCertificateSerialNumber().getText())));
        } catch (NumberFormatException e) {
          stopProgess("Error");
          enableButtons();
          ErrorDialog.showError("The serial number must be an integer.");
          return;
        }
      }
      if ((searchStartDate != null) && (searchEndDate != null)) {
        if (searchStartDate.after(searchEndDate)) {
          stopProgess("Error");
          enableButtons();
          ErrorDialog.showError("The start date cannot be after the end date.");
          return;
        } else {
          DateRange r = new DateRange();
          r.setStartDate(searchStartDate);
          r.setEndDate(searchEndDate);
          f.setDateRange(r);
        }
      } else if ((searchStartDate == null) && (searchEndDate != null)) {
        stopProgess("Error");
        enableButtons();
        ErrorDialog.showError("You must specify a start date!!!");
        return;
      } else if ((searchStartDate != null) && (searchEndDate == null)) {
        stopProgess("Error");
        enableButtons();
        ErrorDialog.showError("You must specify an end date!!!");
        return;
      }

      f.setNotes(Utils.clean(getNotes().getText()));
      if (getStatus().getSelectedUserStatus() != null) {
        f.setStatus(getStatus().getSelectedUserStatus());
      }
      GridAdministrationClient client = this.session.getAdminClient();
      List<UserCertificateRecord> records = client.findUserCertificateRecords(f);
      getUserCertificates().addUserCertificates(records);
      stopProgess(records.size() + " user certificate(s) found.");
    } catch (Exception e) {
      stopProgess("Error");
      ErrorDialog.showError(Utils.getExceptionMessage(e), e);
      log.error(Utils.getExceptionMessage(e), e);
    }
    enableButtons();
  }
 private void createGallery() {
   String name = this.getGalleryNane().getText();
   if (Utils.clean(name) == null) {
     ErrorDialog.showError("You must specify a gallery name.");
     return;
   }
   try {
     getProgress().showProgress("Creating gallery...");
     PhotoSharingHandle handle = this.root.getServiceHandle();
     handle.createGallery(name);
     this.root.refresh();
     getProgress().stopProgress();
     dispose();
   } catch (Exception e) {
     ErrorDialog.showError(Utils.getExceptionMessage(e), e);
   }
 }
 @Override
 public void runStep() throws Throwable {
   assertNotNull(this.credential);
   assertNotNull(this.credential.getGridCredential());
   assertNotNull(this.delegatedCredential);
   assertNotNull(this.delegatedCredential.getDelegatedCredentialReference());
   assertNotNull(this.expectedError);
   DelegatedCredentialUserClient client =
       new DelegatedCredentialUserClient(
           this.delegatedCredential.getDelegatedCredentialReference(),
           this.credential.getGridCredential());
   try {
     client.getDelegatedCredential();
     fail("Should not be able to get delegated credential.");
   } catch (Exception e) {
     String error = Utils.getExceptionMessage(e);
     if (error.indexOf(expectedError) == -1) {
       fail("Unexpected error encountered:\nEXPECTED:" + expectedError + "\n RECEIVED:" + error);
     }
   }
 }