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();
  }
示例#2
0
  private void addUpdatePrivileges() {
    try {

      String id = Utils.clean(getIdentity().getText());
      if (id == null) {
        ErrorDialog.showError("Please enter a valid identity!!!");
      }
      boolean reload = false;
      StringBuffer sb = new StringBuffer();
      sb.append("Updating the privileges resulted in the following:\n");
      String s1 = addUpdateCreate();
      if (s1 != null) {
        reload = true;
        sb.append(s1 + "\n");
      }
      String s2 = addUpdateStem();
      if (s2 != null) {
        reload = true;
        sb.append(s2);
      }

      dispose();

      if (reload) {
        browser.loadPrivileges();
      }
      GridApplication.getContext().showMessage(sb.toString());
    } catch (Exception e) {
      ErrorDialog.showError(e);
      FaultUtil.logFault(log, e);
    }
  }
 public void setAssertingCredentialsEncryptionPassword(
     String assertingCredentialsEncryptionPassword) throws DorianInternalFault {
   if (Utils.clean(assertingCredentialsEncryptionPassword) == null) {
     DorianInternalFault f = new DorianInternalFault();
     f.setFaultString("Invalid asserting credentials password specified.");
     throw f;
   }
   this.assertingCredentialsEncryptionPassword = assertingCredentialsEncryptionPassword;
 }
 public void setAssertingCredentialsEncryptionPassword(
     String assertingCredentialsEncryptionPassword) throws DorianInternalException {
   if (Utils.clean(assertingCredentialsEncryptionPassword) == null) {
     DorianInternalException f =
         FaultHelper.createFaultException(
             DorianInternalException.class, "Invalid asserting credentials password specified.");
     throw f;
   }
   this.assertingCredentialsEncryptionPassword = assertingCredentialsEncryptionPassword;
 }
 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);
   }
 }
示例#6
0
  private String addUpdatePrivilege(boolean wasSelected, boolean selectedNow, Privilege priv)
      throws Exception {
    String id = Utils.clean(getIdentity().getText());
    Subject subj = SubjectUtils.getSubject(id);
    if (update) {
      if (!wasSelected && selectedNow) {
        try {
          targetStem.grantPriv(subj, priv);
          return "GRANTED " + priv.getName() + " privilege.";
        } catch (Exception e) {
          FaultUtil.logFault(log, e);
          throw new Exception("ERROR granting " + priv.getName() + " privilege: " + e.getMessage());
        }

      } else if (wasSelected && !selectedNow) {
        try {
          targetStem.revokePriv(subj, priv);
          return "REVOKED " + priv.getName() + " privilege.";
        } catch (Exception e) {
          FaultUtil.logFault(log, e);
          throw new Exception("ERROR revoking " + priv.getName() + " privilege: " + e.getMessage());
        }
      }
    } else {
      if (selectedNow) {
        try {
          targetStem.grantPriv(subj, priv);
          return "GRANTED " + priv.getName() + " privilege.";
        } catch (Exception e) {
          FaultUtil.logFault(log, e);
          throw new Exception("ERROR granting " + priv.getName() + " privilege: " + e.getMessage());
        }
      }
    }
    return null;
  }
 private Credential getBasicCredential(String userName, String password) {
   BasicAuthentication basicAuthentication = new BasicAuthentication();
   basicAuthentication.setUserId(Utils.clean(userName));
   basicAuthentication.setPassword(Utils.clean(password));
   return basicAuthentication;
 }
 private Credential getOnetimePasswordCredential(String userName, String onetimepassword) {
   OneTimePassword onetimePassword = new OneTimePassword();
   onetimePassword.setUserId(Utils.clean(userName));
   onetimePassword.setOneTimePassword(Utils.clean(onetimepassword));
   return onetimePassword;
 }