Exemplo n.º 1
0
  /**
   * Saves the components to table. <br>
   *
   * @throws InterruptedException
   */
  public void doSave() throws InterruptedException {

    final SecRole aRole = getRole();

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // force validation, if on, than execute by component.getValue()
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if (!isValidationOn()) {
      doSetValidation();
    }

    // fill the object with the components data
    doWriteComponentsToBean(aRole);

    // save it to database
    try {
      getSecurityService().saveOrUpdate(aRole);
    } catch (DataAccessException e) {
      ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString());

      // Reset to init values
      doResetInitValues();

      doReadOnly();
      btnCtrl.setBtnStatus_Save();
      return;
    }

    // now synchronize the listBox
    ListModelList lml = (ListModelList) listBoxSecRoles.getListModel();

    // Check if the object is new or updated
    // -1 means that the obj is not in the list, so it's new.
    if (lml.indexOf(aRole) == -1) {
      lml.add(aRole);
    } else {
      lml.set(lml.indexOf(aRole), aRole);
    }

    doReadOnly();
    btnCtrl.setBtnStatus_Save();

    // init the old values vars new
    doStoreInitValues();
  }
Exemplo n.º 2
0
  private void doSimpan() throws InterruptedException {

    TPermohonan tPermohonan = gettPermohonan();
    Mttr mttr = new Mttr();
    doWriteComponentsToBean(tPermohonan, mttr);

    try {
      String uploadeFileName = null;
      if (getUploadMedia() != null) {
        uploadeFileName = getUploadMedia().getName();
      }
      getPermohonanService()
          .simpanAllTPermohonan(
              uploadeFileName,
              tPermohonan,
              mttr,
              getUserWorkspace().getUserSession().getEmployeeRole());
      TVerifikasi tVerifikasi =
          getPermohonanService()
              .getTVerifikasiByTIdossVerifikasiId(gettPermohonan().getT_idoss_permohonan_id());
      doWriteComponentsToBeanVer(tVerifikasi);
      getVerifikasiService().saveOrUpdateTVerifikasi(tVerifikasi);

    } catch (DataAccessException e) {
      String message = e.getMessage();
      String title = Labels.getLabel("message_Error");
      MultiLineMessageBox.doSetTemplate();
      MultiLineMessageBox.show(message, title, MultiLineMessageBox.OK, "ERROR", true);
    }

    ListModelList lml = (ListModelList) listbox_DaftarPermohonan.getListModel();

    // Check if the object is new or updated
    // -1 means that the obj is not in the list, so it's new.
    if (lml.indexOf(tPermohonan) == -1) {
      lml.add(tPermohonan);
    } else {
      lml.set(lml.indexOf(tPermohonan), tPermohonan);
    }
    lml.sort(new TPermohonanComparator(), true);
  }