Example #1
0
  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();
  }
Example #2
0
  private void initialSettings() {

    btnBrisi_.setEnabled(false);
    btnNovo_.setEnabled(false);
    comboKontrola_.setItems(dB.getControlItemsFromDB("as_control", ""));
    textPrimjena_.setText("");
    comboKontrola_.setText("");
  }
Example #3
0
  private void initialSettings() {
    action = 1;
    comboKateg_.setItems(dB.getComboItemsFromDB("as_asset_type"));
    comboKateg_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            //				System.out.println(comboKateg_.getSelectionIndex());
            int index = comboKateg_.getSelectionIndex() + 1;
            comboPodkateg_.setEnabled(true);
            //				if(comboKateg_.getText()!="")
            //					comboPodkateg_.setText(getTextFromDB("as_subcateg", "WHERE assubcateg_id
            // ="+comboKateg_.getText().substring(0,2)+10+""));
            comboPodkateg_.setItems(
                dB.getComboItemsFromDB("as_subcateg", "WHERE assubcateg_id LIKE '" + index + "%'"));
          }
        });

    comboNoisteljorgjed_.setItems(dB.getComboItemsFromDB("as_owner"));
    comboPovjerljivost_.setItems(dB.getComboItemsFromDB("as_confidentiality"));
    comboCjelovitost_.setItems(dB.getComboItemsFromDB("as_integrity"));
    comboRaspolozivost_.setItems(dB.getComboItemsFromDB("as_accessibility", "Combo"));
    comboBi_.setItems(dB.getComboItemsFromDB("as_business_impact"));
  }
Example #4
0
  @PostConstruct
  public void createComposite(final Composite parent) {

    final ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrollBox.setLocation(0, 0);
    scrollBox.setMinHeight(300);
    scrollBox.setMinWidth(700);

    scrollBox.setExpandHorizontal(true);
    scrollBox.setExpandVertical(true);

    mParent = new Composite(scrollBox, SWT.NONE);
    mParent.getShell().setSize(760, 360);

    m_RiskModel = DataFromServer.listRiskASKTableModel;
    m_Model = DataFromServer.listControlRiskASKTableModel;
    m_Row = NewASKTable1.clickedRiskRow;
    dB = new DataFromDatabase();

    m_RiskId = m_RiskModel.getContentAt(1, m_Row).toString();

    riskName = dB.getDesiredColumnFromDB("view_risk", "name", "WHERE risk_id='" + m_RiskId + "'");

    m_AssetId =
        dB.getDesiredColumnFromDB("view_risk", "asset_id", "WHERE risk_id='" + m_RiskId + "'");
    m_VulnerabilityId =
        dB.getDesiredColumnFromDB(
            "view_risk", "vulnerability_id", "WHERE risk_id='" + m_RiskId + "'");
    m_ThreatId =
        dB.getDesiredColumnFromDB("view_risk", "threat_id", "WHERE risk_id='" + m_RiskId + "'");

    mParent.getShell().setText("Analiza mjera(kontrola) za rizik: " + riskName.toUpperCase() + "");
    mParent.setLayout(new GridLayout(1, false));

    Composite composite = new Composite(mParent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblKontrola_ = new Label(composite, SWT.NONE);
    lblKontrola_.setText("Kontrola:");

    comboKontrola_ = new Combo(composite, SWT.READ_ONLY);
    comboKontrola_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblPrijedlog_ = new Label(composite, SWT.NONE);
    lblPrijedlog_.setText("Prijedlog:");
    new Label(composite, SWT.NONE);

    textPrimjena_ = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
    GridData gd_Primjena_ = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 2);
    gd_Primjena_.heightHint = 50;
    textPrimjena_.setLayoutData(gd_Primjena_);

    Composite compositeASKTtable = new Composite(mParent, SWT.NONE);
    compositeASKTtable.setLayout(new FillLayout(SWT.HORIZONTAL));
    GridData gd_compositeASKTtable = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd_compositeASKTtable.minimumHeight = 150;
    gd_compositeASKTtable.heightHint = 107;
    compositeASKTtable.setLayoutData(gd_compositeASKTtable);

    table =
        new NewASKTable1(
            this, compositeASKTtable, new ListControlRiskASKTableModel(m_RiskId), 717, 200);
    //		new ASKTable(compositeASKTtable, new ControlsAnalysisASKTableModel(),
    // 717,compositeASKTtable.getBounds().height );

    Composite compositeButtons_ = new Composite(mParent, SWT.NONE);
    GridData gd_compositeButtons_ = new GridData(SWT.RIGHT, SWT.FILL, true, false, 2, 1);
    gd_compositeButtons_.heightHint = 42;
    gd_compositeButtons_.horizontalIndent = 10;
    gd_compositeButtons_.widthHint = 530;
    compositeButtons_.setLayoutData(gd_compositeButtons_);
    compositeButtons_.setLayout(new GridLayout(5, false));

    Button btnSpremi_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnSpremi_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnSpremi_.widthHint = 100;
    btnSpremi_.setLayoutData(gd_btnSpremi_);
    btnSpremi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            saveAction();
            // action=1;
          }
        });
    btnSpremi_.setText("Spremi");

    Button btnEvidKontrola_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnEvidKontrola_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnEvidKontrola_.widthHint = 100;
    btnEvidKontrola_.setLayoutData(gd_btnEvidKontrola_);
    btnEvidKontrola_.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final MWindow window = MBasicFactory.INSTANCE.createWindow();
            MPart part = MBasicFactory.INSTANCE.createPart();
            part.setContributionURI("bundleclass://hr.ante.isms/hr.ante.isms.parts.Controls");
            part.setCloseable(true);
            window.getChildren().add(part);

            app.getChildren().add(window);
          }
        });
    btnEvidKontrola_.setText("Evid. Kontrola");

    btnNovo_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnNovo_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnNovo_.widthHint = 100;
    btnNovo_.setLayoutData(gd_btnNovo_);
    btnNovo_.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            m_ControlRiskId = null;
            fillForm();
          }
        });
    btnNovo_.setText("Novo");

    btnBrisi_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnBrisi_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnBrisi_.widthHint = 100;
    btnBrisi_.setLayoutData(gd_btnBrisi_);
    btnBrisi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            boolean confirm =
                Dialog.isConfirmed(
                    "Je ste li sigurni da želite obrisati podatak?", "Podatak æe biti obrisan");

            if (confirm) {
              try {
                dB.deleteDataFromDB("as_control_risk", "ascontrolrisk_id", m_ControlRiskId);
                fillForm();
                refreshTable();

              } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              }
            }
          }
        });
    btnBrisi_.setText("Briši");

    Button btnIzlaz_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnIzlaz_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnIzlaz_.widthHint = 100;
    btnIzlaz_.setLayoutData(gd_btnIzlaz_);
    btnIzlaz_.setText("Izlaz");
    btnIzlaz_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            mParent.getShell().close();
          }
        });

    fillForm();
    scrollBox.setContent(mParent);
    mParent.getShell().setDefaultButton(btnSpremi_);
  }
Example #5
0
  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();
  }
Example #6
0
  private void fillForm() {
    // TODO Auto-generated method stub

    initialSettings();

    if (m_Row != 0 /* && !m_Table.m_Selection.isEmpty()*/) {

      action = 2;
      comboPodkateg_.setEnabled(true);
      m_AssetId = m_Model.getContentAt(10, m_Row).toString();

      textNaziv_.setText(m_Model.getContentAt(2, m_Row).toString());

      String subcategoryId = m_Model.getContentAt(3, m_Row).toString();
      String ownerId = m_Model.getContentAt(4, m_Row).toString();
      String confId = m_Model.getContentAt(5, m_Row).toString();
      String integId = m_Model.getContentAt(6, m_Row).toString();
      String accessId = m_Model.getContentAt(7, m_Row).toString();
      String bimpactId = m_Model.getContentAt(8, m_Row).toString();

      String subcategory =
          dB.getDesiredColumnFromDB(
              "view_asset", "category_name", "WHERE asset_id=" + m_AssetId + "");
      String owner =
          dB.getDesiredColumnFromDB("view_asset", "owner_name", "WHERE asset_id=" + m_AssetId + "");

      String confidentiality =
          dB.getDesiredColumnFromDB(
              "view_asset", "confidentiality", "WHERE asset_id=" + m_AssetId + "");
      String integrity =
          dB.getDesiredColumnFromDB("view_asset", "integrity", "WHERE asset_id=" + m_AssetId + "");
      String accessibility =
          dB.getDesiredColumnFromDB(
              "view_asset", "accessibility", "WHERE asset_id=" + m_AssetId + "");
      String businessImpact =
          dB.getDesiredColumnFromDB(
              "view_asset", "businessimpact", "WHERE asset_id=" + m_AssetId + "");

      comboPodkateg_.setItems(
          dB.getComboItemsFromDB(
              "as_subcateg", "WHERE assubcateg_id LIKE '" + subcategoryId.substring(0, 2) + "%'"));

      comboPodkateg_.setText(subcategoryId + "-" + subcategory);

      String categoryId = subcategoryId.substring(0, 2);
      String category =
          dB.getDesiredColumnFromDB(
              "as_asset_type", "name", "WHERE assettype_id=" + categoryId + "");

      comboKateg_.setText(categoryId + "-" + category);
      if (owner == null) comboNoisteljorgjed_.setText("");
      else comboNoisteljorgjed_.setText(ownerId + "-" + owner);
      comboPovjerljivost_.setText(confId + "-" + confidentiality);
      comboCjelovitost_.setText(integId + "-" + integrity);
      comboRaspolozivost_.setText(accessId + "-" + accessibility);
      comboBi_.setText(bimpactId + "-" + businessImpact);

      String Opis_ =
          dB.getDesiredColumnFromDB(
              "view_asset", "description", "WHERE asset_id=" + m_AssetId + "");
      if (Opis_ == null) Opis_ = "";
      else textOpis_.setText(Opis_);

      Objanjenjeostalo_ =
          dB.getDesiredColumnFromDB(
              "view_asset", "bi_description", "WHERE asset_id=" + m_AssetId + "");
      if (Objanjenjeostalo_ == null) Objanjenjeostalo_ = "";
      else textObjanjenjeostalo_.setText(Objanjenjeostalo_);

    } else {
      action = 1;
      assetPartVisible = 0;
    }
  }