/**
   * Deletes a OwnGefaehrdung.
   *
   * @param delGefaehrdung the (Own)Gefaehrdung to delete
   */
  private void deleteOwnGefaehrdung(Gefaehrdung delGefaehrdung) {
    ArrayList<Gefaehrdung> arrListAllGefaehrdungen =
        ((RiskAnalysisWizard) getWizard()).getAllGefaehrdungen();
    List<GefaehrdungsUmsetzung> arrListAssociatedGefaehrdungen =
        ((RiskAnalysisWizard) getWizard()).getAssociatedGefaehrdungen();
    List<OwnGefaehrdung> arrListOwnGefaehrdungen =
        ((RiskAnalysisWizard) getWizard()).getAllOwnGefaehrdungen();

    try {
      if (arrListOwnGefaehrdungen.contains(delGefaehrdung)) {
        /* delete OwnGefaehrdung from Database */
        OwnGefaehrdungHome.getInstance().remove((OwnGefaehrdung) delGefaehrdung);

        /* delete OwnGefaehrdung from List of OwnGefaehrdungen */
        arrListOwnGefaehrdungen.remove(delGefaehrdung);

        /* delete OwnGefaehrdung from List of selected Gefaehrdungen */
        GefaehrdungsUtil.removeBySameId(arrListAssociatedGefaehrdungen, delGefaehrdung);

        /* delete OwnGefaehrdung from list of all Gefaehrdungen */
        if (arrListAllGefaehrdungen.contains(delGefaehrdung)) {
          arrListAllGefaehrdungen.remove(delGefaehrdung);
        }
      }
    } catch (Exception e) {
      ExceptionUtil.log(e, Messages.ChooseGefaehrdungPage_20);
    }
  }
Ejemplo n.º 2
0
 /** Saves all own Gefaehrdungen in a List. */
 private void loadOwnGefaehrdungen() {
   try {
     allOwnGefaehrdungen = OwnGefaehrdungHome.getInstance().loadAll();
   } catch (Exception e) {
     ExceptionUtil.log(e, Messages.RiskAnalysisWizard_6);
   }
 }