Esempio n. 1
0
  public static void save(VCenterForm vCenter) {
    if (!vCenter.canEditVcenter()) {
      VcenterRestRep dbVCenter = VCenterUtils.getVCenter(uri(vCenter.id));
      if (dbVCenter != null) {
        vCenter.name = dbVCenter.getName();
      }
      vCenter.save(false);
      flash.success(MessagesUtils.get(SAVED, vCenter.name));
      list();
      return;
    }

    vCenter.validate("vCenter");
    if (Validation.hasErrors()) {
      edit(vCenter);
    } else {
      Boolean validateConnectionParam = params.get("validateConnection", Boolean.class);
      boolean validateConnection =
          validateConnectionParam != null ? validateConnectionParam.booleanValue() : false;

      vCenter.save(validateConnection);

      flash.success(MessagesUtils.get(SAVED, vCenter.name));
      list();
    }
  }
Esempio n. 2
0
  public static void create() {
    VCenterForm vCenter = new VCenterForm();
    vCenter.setTenantsForCreation();

    renderTenantOptions();
    render("@edit", vCenter);
  }
Esempio n. 3
0
  private static void edit(VCenterForm vcenter) {
    // Remove password/confirm from params before flashing
    params.remove("vCenter.password");
    params.remove("vCenter.passwordConfirm");

    params.flash();
    Validation.keep();
    if (vcenter.isNew()) {
      create();
    } else {
      edit(vcenter.id);
    }
  }