/** * Needs to be implemented because of IExportWizard/IWorkbenchWizard. Entry point. * * @param workbench the current workbench * @param selection the current object selection */ public void init(IWorkbench workbench, IStructuredSelection selection) { try { if (finishedRiskAnalysis == null) { StartNewRiskAnalysis command = new StartNewRiskAnalysis(cnaElement); command = ServiceFactory.lookupCommandService().executeCommand(command); finishedRiskAnalysis = command.getFinishedRiskAnalysis(); finishedRiskLists = command.getFinishedRiskLists(); } else { finishedRiskLists = FinishedRiskAnalysisListsHome.getInstance().loadById(finishedRiskAnalysis.getDbId()); previousAnalysis = true; } } catch (CommandException e) { ExceptionUtil.log(e, Messages.RiskAnalysisWizard_1); } loadAllGefaehrdungen(); loadAllMassnahmen(); loadAssociatedGefaehrdungen(); loadOwnGefaehrdungen(); addOwnGefaehrdungen(); addRisikoMassnahmenUmsetzungen(loadRisikomassnahmen()); }
/* * (non-Javadoc) * * @see sernet.gs.ui.rcp.main.service.commands.ICommand#execute() */ @Override public void execute() { FinishedRiskAnalysis riskAnalysis = getDaoFactory().getDAO(FinishedRiskAnalysis.class).findById(riskAnalysisDbId); finishedRiskLists = getDaoFactory().getDAO(FinishedRiskAnalysisLists.class).findById(listDbId); gefaehrdungsUmsetzung = GefaehrdungsUmsetzungFactory.build(null, currentGefaehrdung, language); getDaoFactory().getDAO(GefaehrdungsUmsetzung.class).saveOrUpdate(gefaehrdungsUmsetzung); if (authService.isPermissionHandlingNeeded()) { gefaehrdungsUmsetzung.setPermissions( Permission.clonePermissionSet(gefaehrdungsUmsetzung, riskAnalysis.getPermissions())); } finishedRiskLists.getAssociatedGefaehrdungen().add(gefaehrdungsUmsetzung); }