コード例 #1
0
ファイル: SuggestMeasures.java プロジェクト: striko0/isms
  public void saveAction() {
    if ((comboKontrola_.getText() != "" && comboKontrola_.getText().length() > 0)) {
      Hashtable<String, String> data = new Hashtable<String, String>();

      String temp = comboKontrola_.getText();
      int t = temp.indexOf("-");
      data.put("control_id", comboKontrola_.getText().substring(0, t));
      data.put("risk_id", m_RiskId);
      //			if(textPrimjena_.getText().equals("")){
      //				data.put("application","");
      //			}
      //			else{
      data.put("application", textPrimjena_.getText());
      //			}

      if (action == 2) {
        try {
          System.out.println("Hashtable" + data);
          dB.insertDataInDB("as_control_risk", data, "update", "SuggestMeasures", m_ControlRiskId);
        } catch (Exception e1) {
          e1.printStackTrace();
        }
      } else {

        data.put("vulnerability_id", m_VulnerabilityId);
        data.put("threat_id", m_ThreatId);

        System.out.println("Hashtable" + data);
        try {
          dB.insertDataInDB("as_control_risk", data, "insert", "SuggestMeasures", "");

        } catch (Exception e1) {
          e1.printStackTrace();
        }
      }

      Notifier.notify(
          ResourceManager.getPluginImage("hr.ante.isms", "src/icons/tick.png"),
          "Spremanje uspješno",
          "Podaci su spremljeni",
          NotifierTheme.GREEN_THEME);
      fillForm();

    } else
      Notifier.notify(
          ResourceManager.getPluginImage("hr.ante.isms", "src/icons/error.ico"),
          "Nemože se spremiti",
          "Niste unijeli sve potrebno podatke",
          NotifierTheme.RED_THEME);

    refreshTable();
  }
コード例 #2
0
ファイル: Assets.java プロジェクト: striko0/isms
  private void saveAction() {

    if (textNaziv_.getText() != ""
        && textNaziv_.getText().length() > 0
        && comboPodkateg_.getText() != ""
        && comboPodkateg_.getText().length() > 0
        && comboPovjerljivost_.getText() != ""
        && comboPovjerljivost_.getText().length() > 0
        && comboCjelovitost_.getText() != ""
        && comboCjelovitost_.getText().length() > 0
        && comboRaspolozivost_.getText() != ""
        && comboRaspolozivost_.getText().length() > 0
        && comboBi_.getText() != ""
        && comboBi_.getText().length() > 0) {

      Hashtable<String, String> data = new Hashtable<String, String>();
      data.put("assettype_id", comboKateg_.getText().substring(0, 2));
      data.put("name", textNaziv_.getText());
      data.put("category", comboPodkateg_.getText().substring(0, 4));

      if (comboNoisteljorgjed_.getText().equals("")) data.put("owner", "");
      else {
        data.put("owner", comboNoisteljorgjed_.getText().substring(0, 5));
      }

      //			if(textOpis_.getText().equals(""))
      //				data.put("description", "");
      //			else{
      data.put("description", textOpis_.getText());
      //			}

      data.put(
          "confidentiality_level",
          comboPovjerljivost_.getText() != null
              ? comboPovjerljivost_.getText().substring(0, 1)
              : "");
      data.put(
          "integrity_level",
          comboCjelovitost_.getText() != null ? comboCjelovitost_.getText().substring(0, 1) : "");
      data.put(
          "accessibility_level",
          comboRaspolozivost_.getText() != null
              ? comboRaspolozivost_.getText().substring(0, 1)
              : "");
      data.put(
          "businessimpact_level",
          comboBi_.getText() != null ? comboBi_.getText().substring(0, 1) : "");

      //			if(textObjanjenjeostalo_.getText().equals(""))
      //				data.put("bi_description", "");
      //			else{
      data.put("bi_description", textObjanjenjeostalo_.getText());
      //			}

      System.out.println("Hashtable" + data);
      try {
        if (action == 2) {
          dB.insertDataInDB("as_asset", data, "update", "Assets", m_AssetId);

        } else dB.insertDataInDB("as_asset", data, "insert", "Assets", "");

      } catch (Exception e1) {
        e1.printStackTrace();
      }
      Notifier.notify(
          ResourceManager.getPluginImage("hr.ante.isms", "src/icons/tick.png"),
          "Spremanje uspješno",
          "Podaci su spremljeni",
          NotifierTheme.GREEN_THEME);

    } else
      Notifier.notify(
          ResourceManager.getPluginImage("hr.ante.isms", "src/icons/error.ico"),
          "Nemože se spremiti",
          "Niste unijeli sve potrebno podatke",
          NotifierTheme.RED_THEME);
    action = 2;

    refreshTable();
  }