Exemple #1
0
  private void displayRecords(UserWeb user) {

    // Name
    userName.setValue(user.getUsername());
    firstName.setValue(user.getFirstName());
    lastName.setValue(user.getLastName());

    passwordHint.setValue(user.getPasswordHint());

    // Address
    address.setValue(user.getAddress());
    city.setValue(user.getCity());
    for (State st : states.getModels()) {
      if (st.getAbbr().equals(user.getState())) state.setValue(st);
    }
    zip.setValue(user.getPostalCode());
    for (Country co : countries.getModels()) {
      if (co.getName().equals(user.getCountry())) country.setValue(co);
    }

    // Phone
    phoneNumber.setValue(user.getPhoneNumber());

    // Other
    email.setValue(user.getEmail());
    emailConfirm.setValue(user.getEmail());
    webSite.setValue(user.getWebsite());
  }
  public Map<String, String> calculateJobProperties() throws JobCreationException {

    Map<String, String> properties = new HashMap<String, String>();

    // jobname
    String jobname = getJobnameTextField().getValue();
    properties.put(Constants.JOBNAME_KEY, jobname);

    // commandline
    String commandline = getCommandLineTextArea().getValue().trim();
    properties.put(Constants.COMMANDLINE_KEY, commandline);

    // application
    Set<String> apps = new HashSet<String>();
    for (String app : currentApplications) {
      apps.add(app.toLowerCase());
    }
    if (apps.size() > 1) {
      throw new JobCreationException(
          "More than one applications found for specified executable. This is not supported (at least not at the moment. Please contact [email protected] if you experience this problem.");
    }
    properties.put(Constants.APPLICATIONNAME_KEY, apps.iterator().next());

    // version
    String version = getVersionComboBox().getSimpleValue();
    properties.put(Constants.APPLICATIONVERSION_KEY, version);

    // walltime
    Integer walltime =
        (getDaysComboBox().getSimpleValue() * 60 * 24)
            + (getHoursComboBox().getSimpleValue() * 60)
            + getMinutesComboBox().getSimpleValue();
    properties.put(Constants.WALLTIME_IN_MINUTES_KEY, walltime.toString());

    // cpus
    Integer cpus = getCpusComboBox().getSimpleValue();
    properties.put(Constants.NO_CPUS_KEY, cpus.toString());

    // fqan
    String fqan = getVoComboBox().getSimpleValue();
    properties.put(Constants.FQAN_KEY, fqan);

    // send email
    Boolean sendEmail = getCheckBox().getValue();
    if (sendEmail) {
      properties.put(Constants.EMAIL_ON_FINISH_KEY, "true");
      String emailAddress = getEmailTextField().getValue();
      properties.put(Constants.EMAIL_ADDRESS_KEY, emailAddress);
    }

    // input files
    StringBuffer inputFiles = new StringBuffer();
    for (GrisuFileObject file : inputFileStore.getModels()) {
      inputFiles.append(file.getUrl() + ",");
    }
    properties.put(Constants.INPUT_FILE_URLS_KEY, inputFiles.toString());

    return properties;
  }
 private boolean checkStartFieldValue() {
   boolean condition = false;
   //        System.out.println("Start store size: " + startStore.getModels().size());
   if (startFilterNumberField.getValue() != null) {
     int fromFilter = startFilterNumberField.getValue().intValue();
     //            System.out.println("From filter: " + fromFilter);
     if (fromFilter >= 0 && fromFilter <= startStore.getModels().size() - 1) {
       condition = true;
     }
   }
   return condition;
 }
Exemple #4
0
  /** {@inheritDoc} */
  @Override
  public void setValue(final Paragraph para) {

    final ComboBox<BaseModelData> cb = _combobox;
    final String value = para.getText();

    final ListStore<BaseModelData> store = cb.getStore();
    for (final BaseModelData model : store.getModels()) {
      if (model.get("value").equals(value)) {
        cb.setValue(model);
      }
    }
  }
  private void doSave() {
    if (validateFields()) {
      user.setUsername(Utils.safeString(usernameTextBox.getValue()));
      user.setFullname(Utils.safeString(fullnameTextBox.getValue()));
      user.setEmail(Utils.safeString(emailTextBox.getValue()));
      user.setActiveFlag(enabledCheckBox.getValue());
      user.updateAuthnPasswordValue(Utils.safeString(password1TextBox.getValue()));
      user.removeGroups();
      for (GroupData groupData : toGroupStore.getModels()) {
        Group group = (Group) groupData.get(Constants.GROUP);
        user.addGroup(group);
      }

      final AsyncCallback<Void> callback =
          new AsyncCallback<Void>() {
            @Override
            public void onFailure(Throwable caught) {
              WebPasswordSafe.handleServerFailure(caught);
            }

            @Override
            public void onSuccess(Void result) {
              Info.display(textMessages.status(), textMessages.userSaved());
              hide();
            }
          };
      if (user.getId() == 0) {
        final AsyncCallback<Boolean> callbackCheck =
            new AsyncCallback<Boolean>() {
              @Override
              public void onFailure(Throwable caught) {
                WebPasswordSafe.handleServerFailure(caught);
              }

              @Override
              public void onSuccess(Boolean result) {
                // true => username already taken, else go ahead and save
                if (result) {
                  MessageBox.alert(
                      textMessages.error(), textMessages.usernameAlreadyExists(), null);
                } else {
                  UserService.Util.getInstance().addUser(user, callback);
                }
              }
            };
        UserService.Util.getInstance().isUserTaken(user.getUsername(), callbackCheck);
      } else {
        UserService.Util.getInstance().updateUser(user, callback);
      }
    }
  }
  private void doSave() {
    if (validateFields()) {
      group.setName(Utils.safeString(nameTextBox.getValue()));
      group.removeUsers();
      for (UserData userData : toUserStore.getModels()) {
        group.addUser((User) userData.get(Constants.USER));
      }

      final AsyncCallback<Boolean> callbackCheck =
          new AsyncCallback<Boolean>() {
            @Override
            public void onFailure(Throwable caught) {
              WebPasswordSafe.handleServerFailure(caught);
            }

            @Override
            public void onSuccess(Boolean result) {
              // true => group name already taken, else go ahead and save
              if (result) {
                MessageBox.alert(textMessages.error(), textMessages.groupNameAlreadyExists(), null);
              } else {
                AsyncCallback<Void> callback =
                    new AsyncCallback<Void>() {
                      @Override
                      public void onFailure(Throwable caught) {
                        WebPasswordSafe.handleServerFailure(caught);
                      }

                      @Override
                      public void onSuccess(Void result) {
                        Info.display(textMessages.status(), textMessages.groupSaved());
                        hide();
                      }
                    };
                if (group.getId() == 0) {
                  UserService.Util.getInstance().addGroup(group, callback);
                } else {
                  UserService.Util.getInstance().updateGroup(group, callback);
                }
              }
            }
          };
      UserService.Util.getInstance().isGroupTaken(group.getName(), group.getId(), callbackCheck);
    }
  }