コード例 #1
0
ファイル: SetPasswordJDialog.java プロジェクト: URMC/i2b2
  private void jOKButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jOKButtonActionPerformed
    String newPassword = new String(jNewPasswordField.getPassword());
    String curPassword = new String(jCurrentPasswordField.getPassword());
    String projectID = UserInfoBean.getInstance().getProjectId();
    // String user = (String) this.jUserIdComboBox.getEditor().getItem();
    // int i = UserInfoBean.getInstance().getProjectList().size();
    // String result = IMQueryClient.setKey(key, projectID);
    // String result=null;

    String retypePassword = new String(jRetypePasswordField.getPassword());
    if (!retypePassword.equals(newPassword)) {
      java.awt.EventQueue.invokeLater(
          new Runnable() {
            public void run() {
              // setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
              JOptionPane.showMessageDialog(
                  jLabel2, "The password retyped is not the same as the new password you entered.");
            }
          });
      return;
    } else if (newPassword.equals("") || newPassword.equals(" ")) {
      java.awt.EventQueue.invokeLater(
          new Runnable() {
            public void run() {
              // setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
              JOptionPane.showMessageDialog(jLabel2, "The new password can't be empty.");
            }
          });
      return;
    }

    PmServiceController pms = new PmServiceController();
    try {
      PasswordType ptype = new PasswordType();
      ptype.setIsToken(false); // UserInfoBean.getInstance().getUserPasswordIsToken());
      ptype.setTokenMsTimeout(UserInfoBean.getInstance().getUserPasswordTimeout());
      ptype.setValue(curPassword); // UserInfoBean.getInstance().getUserPassword());

      String result = null;
      // if(UserInfoBean.getInstance().isAdmin()) {
      //	result = pms.setUserPassword(UserInfoBean.getInstance().getUserName(), ptype,
      // UserInfoBean.getInstance().getSelectedProjectUrl(),
      //		UserInfoBean.getInstance().getUserDomain(), key, user);
      // }
      // else {
      result =
          pms.setUserPassword(
              UserInfoBean.getInstance().getUserName(),
              ptype,
              UserInfoBean.getInstance().getSelectedProjectUrl(),
              UserInfoBean.getInstance().getUserDomain(),
              newPassword);
      // }

      PDOResponseMessageModel pdoresponsefactory = new PDOResponseMessageModel();

      StatusType status = pdoresponsefactory.getStatusFromResponseXML(result);
      final String info = status.getValue();
      java.awt.EventQueue.invokeLater(
          new Runnable() {
            public void run() {
              // setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
              JOptionPane.showMessageDialog(jLabel2, info + ".");
            }
          });
    } catch (Exception e) {
      e.printStackTrace();
    }

    this.setVisible(false);
  } // GEN-LAST:event_jOKButtonActionPerformed
コード例 #2
0
ファイル: OntologyRequestData.java プロジェクト: URMC/i2b2
  /**
   * Function to build i2b2 message header
   *
   * @return MessageHeader object
   */
  public MessageHeaderType getMessageHeader() {
    MessageHeaderType messageHeader = new MessageHeaderType();

    messageHeader.setI2B2VersionCompatible(
        new BigDecimal(
            Messages.getString("OntologyRequestData.i2b2VersionCompatible"))); // $NON-NLS-1$

    ApplicationType appType = new ApplicationType();
    appType.setApplicationName(
        Messages.getString("OntologyRequestData.SendingApplicationName")); // $NON-NLS-1$
    appType.setApplicationVersion(
        Messages.getString("OntologyRequestData.SendingApplicationVersion")); // $NON-NLS-1$
    messageHeader.setSendingApplication(appType);

    FacilityType facility = new FacilityType();
    facility.setFacilityName(
        Messages.getString("OntologyRequestData.SendingFacilityName")); // $NON-NLS-1$
    messageHeader.setSendingFacility(facility);

    ApplicationType appType2 = new ApplicationType();
    appType2.setApplicationVersion(
        Messages.getString("OntologyRequestData.ReceivingApplicationVersion")); // $NON-NLS-1$
    appType2.setApplicationName(
        Messages.getString("OntologyRequestData.ReceivingApplicationName")); // $NON-NLS-1$
    messageHeader.setReceivingApplication(appType2);

    FacilityType facility2 = new FacilityType();
    facility2.setFacilityName(
        Messages.getString("OntologyRequestData.ReceivingFacilityName")); // $NON-NLS-1$
    messageHeader.setReceivingFacility(facility2);

    Date currentDate = new Date();
    DTOFactory factory = new DTOFactory();
    messageHeader.setDatetimeOfMessage(factory.getXMLGregorianCalendar(currentDate.getTime()));

    SecurityType secType = new SecurityType();
    secType.setDomain(UserInfoBean.getInstance().getUserDomain());
    secType.setUsername(UserInfoBean.getInstance().getUserName());
    PasswordType ptype = new PasswordType();
    ptype.setIsToken(UserInfoBean.getInstance().getUserPasswordIsToken());
    ptype.setTokenMsTimeout(UserInfoBean.getInstance().getUserPasswordTimeout());
    ptype.setValue(UserInfoBean.getInstance().getUserPassword());

    secType.setPassword(ptype);
    messageHeader.setSecurity(secType);

    MessageControlIdType mcIdType = new MessageControlIdType();
    mcIdType.setInstanceNum(0);
    mcIdType.setMessageNum(generateMessageId());
    messageHeader.setMessageControlId(mcIdType);

    ProcessingIdType proc = new ProcessingIdType();
    proc.setProcessingId(Messages.getString("OntologyRequestData.ProcessingId")); // $NON-NLS-1$
    proc.setProcessingMode(Messages.getString("OntologyRequestData.ProcessingMode")); // $NON-NLS-1$
    messageHeader.setProcessingId(proc);

    messageHeader.setAcceptAcknowledgementType(
        Messages.getString("OntologyRequestData.AcceptAcknowledgementType")); // $NON-NLS-1$
    messageHeader.setApplicationAcknowledgementType(
        Messages.getString("OntologyRequestData.ApplicationAcknowledgementType")); // $NON-NLS-1$
    messageHeader.setCountryCode(
        Messages.getString("OntologyRequestData.CountryCode")); // $NON-NLS-1$
    messageHeader.setProjectId(UserInfoBean.getInstance().getProjectId());
    return messageHeader;
  }