Esempio n. 1
0
 public void doWriteToBase(VcenterParam vCenter) {
   vCenter.setName(this.name);
   vCenter.setUserName(this.username);
   if (StringUtils.isNotBlank(this.password)) {
     vCenter.setPassword(StringUtils.trimToNull(this.password));
   }
   vCenter.setPortNumber(this.port);
   vCenter.setCascadeTenancy(this.cascadeTenancy);
 }
  /**
   * 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");
  }