Пример #1
0
 private void loadLdapUser() {
   try {
     LoadLdapUser loadLdapUser = new LoadLdapUser(getParameter());
     loadLdapUser = ServiceFactory.lookupCommandService().executeCommand(loadLdapUser);
     personSet.clear();
     List<PersonInfo> personList = loadLdapUser.getPersonList();
     if (personList != null) {
       List<PersonInfo> accountList = new ArrayList<PersonInfo>(personList);
       personSet.addAll(accountList);
     }
     // Get the content for the viewer, setInput will call getElements in the
     // contentProvider
     refreshTable();
   } catch (SizeLimitExceededException sizeLimitExceededException) {
     log.warn("To many results ehen searching for LDAP users."); // $NON-NLS-1$
     if (log.isDebugEnabled()) {
       log.debug("stacktrace: ", sizeLimitExceededException); // $NON-NLS-1$
     }
     personSet.clear();
     refreshTable();
     MessageDialog.openInformation(
         getShell(), Messages.LdapImportDialog_6, Messages.LdapImportDialog_7);
   } catch (Throwable t) {
     log.error("Error while setting table data", t); // $NON-NLS-1$
     personSet.clear();
     refreshTable();
     MessageDialog.openError(
         getShell(), Messages.LdapImportDialog_45, Messages.LdapImportDialog_1);
   }
 }
Пример #2
0
 @Override
 protected void okPressed() {
   SaveLdapUser saveLdapUser = new SaveLdapUser(personSet);
   try {
     saveLdapUser = ServiceFactory.lookupCommandService().executeCommand(saveLdapUser);
   } catch (UsernameExistsException e) {
     log.error(e.getMessage());
     if (log.isDebugEnabled()) {
       log.debug("Stacktrace: ", e); // $NON-NLS-1$
     }
     MessageDialog.openError(
         this.getShell(),
         Messages.LdapImportDialog_45,
         NLS.bind(Messages.LdapImportDialog_46, e.getUsername()));
     return;
   } catch (CommandException e) {
     throw new RuntimeException(e);
   }
   updateModel(saveLdapUser.getImportRootObject(), saveLdapUser.getChangedElements());
   super.okPressed();
   InfoDialogWithShowToggle.openInformation(
       Messages.LdapImportDialog_42,
       NLS.bind(Messages.LdapImportDialog_43, saveLdapUser.getChangedElements().size()),
       Messages.LdapImportDialog_44,
       PreferenceConstants.INFO_IMPORT_LDAP);
 }
Пример #3
0
  /**
   * 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());
  }
Пример #4
0
 public void removeAssociatedGefaehrdung(Gefaehrdung currentGefaehrdung) throws Exception {
   /* remove from List of Associated Gefaehrdungen */
   DisassociateGefaehrdungsUmsetzung command =
       new DisassociateGefaehrdungsUmsetzung(
           finishedRiskAnalysis, finishedRiskLists.getDbId(), currentGefaehrdung);
   command = ServiceFactory.lookupCommandService().executeCommand(command);
   finishedRiskLists = command.getFinishedRiskLists();
   finishedRiskAnalysis = command.getFinishedRiskAnalysis();
 }
 /** @return */
 private List<ITVerbund> loadITVerbuende() {
   LoadCnATreeElementTitles<ITVerbund> compoundLoader =
       new LoadCnATreeElementTitles<ITVerbund>(ITVerbund.class);
   try {
     compoundLoader = ServiceFactory.lookupCommandService().executeCommand(compoundLoader);
   } catch (Exception e) {
     ExceptionUtil.log(e, Messages.GenerateReportDialog_20);
   }
   return compoundLoader.getElements();
 }
  private List<Organization> loadScopes() {
    LoadCnATreeElementTitles<Organization> compoundLoader =
        new LoadCnATreeElementTitles<Organization>(Organization.class);
    try {
      compoundLoader = ServiceFactory.lookupCommandService().executeCommand(compoundLoader);
    } catch (Exception e) {
      ExceptionUtil.log(e, Messages.GenerateReportDialog_19);
    }

    return compoundLoader.getElements();
  }
Пример #7
0
  public RiskAnalysisWizard(CnATreeElement parent, FinishedRiskAnalysis analysis) {
    this(parent);

    try {
      LoadChildrenForExpansion command = new LoadChildrenForExpansion(analysis);
      command = ServiceFactory.lookupCommandService().executeCommand(command);
      finishedRiskAnalysis = (FinishedRiskAnalysis) command.getElementWithChildren();
    } catch (CommandException e) {
      ExceptionUtil.log(e, Messages.RiskAnalysisWizard_0);
    }
  }
Пример #8
0
 /**
  * Saves all Gefaehrdungen associated to the chosen IT-system in a List.
  *
  * @throws CommandException
  */
 private void loadAssociatedGefaehrdungen() {
   try {
     LoadAssociatedGefaehrdungen command = new LoadAssociatedGefaehrdungen(cnaElement);
     command = ServiceFactory.lookupCommandService().executeCommand(command);
     this.finishedRiskLists
         .getAssociatedGefaehrdungen()
         .addAll(command.getAssociatedGefaehrdungen());
   } catch (CommandException e) {
     ExceptionUtil.log(e, Messages.RiskAnalysisWizard_5);
   }
 }
Пример #9
0
 private String loadLogin(CnATreeElement element) {
   String login = null;
   try {
     LoadConfiguration command = new LoadConfiguration(element);
     command = ServiceFactory.lookupCommandService().executeCommand(command);
     Configuration configuration = command.getConfiguration();
     if (configuration != null) {
       login = configuration.getUser();
     }
   } catch (CommandException e) {
     LOG.error("Error while loading account data.", e); // $NON-NLS-1$
   }
   return login;
 }
  /** Marks all checkboxes of Gefaehrdungen associated to the selected Baustein. */
  private void assignBausteinGefaehrdungen() {
    try {
      LoadAssociatedGefaehrdungen command = new LoadAssociatedGefaehrdungen(wizard.getCnaElement());
      command = ServiceFactory.lookupCommandService().executeCommand(command);
      List<GefaehrdungsUmsetzung> list = command.getAssociatedGefaehrdungen();

      for (GefaehrdungsUmsetzung selectedGefaehrdung : list) {
        for (Gefaehrdung gefaehrdung : wizard.getAllGefaehrdungen()) {
          if (gefaehrdung.getId().equals(selectedGefaehrdung.getId())) {
            associateGefaehrdung(gefaehrdung, true);
          }
        }
      }
    } catch (CommandException e) {
      ExceptionUtil.log(e, ""); // $NON-NLS-1$
    }
  }
Пример #11
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$
    }
  }
Пример #12
0
 private ICommandService createCommandServive() {
   return ServiceFactory.lookupCommandService();
 }