コード例 #1
0
  /**
   * Validates vCenter user credentials from create or update parameters.
   *
   * @param param either vCenter create or update param.
   * @param vcenter vCenter object.
   */
  private void validateVcenterCredentials(VcenterParam param, Vcenter vcenter) {
    if (StringUtils.isBlank(param.getPassword()) && vcenter != null) {
      param.setPassword(StringUtils.trimToNull(vcenter.getPassword()));
    }

    if (StringUtils.isBlank(param.getUserName()) && vcenter != null) {
      param.setUserName(StringUtils.trimToNull(vcenter.getUsername()));
    }

    ArgValidator.checkFieldNotNull(param.getUserName(), "username");
    ArgValidator.checkFieldNotNull(param.getPassword(), "password");
  }
コード例 #2
0
 /**
  * Populate an instance of vcenter with the provided vcenter parameter
  *
  * @param vcenter the vcenter to be populated
  * @param param the parameter that contains the attributes.
  */
 protected void populateVcenterData(Vcenter vcenter, VcenterParam param) {
   vcenter.setLabel(param.getName());
   vcenter.setOsVersion(param.getOsVersion());
   vcenter.setUsername(param.getUserName());
   vcenter.setPassword(param.getPassword());
   vcenter.setIpAddress(param.findIpAddress());
   vcenter.setPortNumber(param.getPortNumber());
   vcenter.setUseSSL(param.getUseSsl());
 }