/**
   * 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);
    }
  }
Пример #2
0
  public void addAssociatedGefaehrdung(Gefaehrdung currentGefaehrdung) {

    try {
      if (!GefaehrdungsUtil.listContainsById(
          finishedRiskLists.getAssociatedGefaehrdungen(), currentGefaehrdung)) {
        /* Add to List of Associated Gefaehrdungen */
        AssociateGefaehrdungsUmsetzung command =
            new AssociateGefaehrdungsUmsetzung(
                finishedRiskLists.getDbId(),
                currentGefaehrdung,
                this.finishedRiskAnalysis.getDbId());
        command = ServiceFactory.lookupCommandService().executeCommand(command);

        finishedRiskLists = command.getFinishedRiskLists();
      }
    } catch (CommandException e) {
      ExceptionUtil.log(e, ""); // $NON-NLS-1$
    }
  }