/**
  * Returns the current {@link ToolIntegrationContext} or, if not yet set, the common version of
  * it.
  *
  * @return current {@link ToolIntegrationContext}
  */
 public ToolIntegrationContext getCurrentContext() {
   if (integrationContext == null) {
     return integrationContextRegistry.getToolIntegrationContext(
         ToolIntegrationConstants.COMMON_TOOL_INTEGRATION_CONTEXT_UID);
   }
   return integrationContext;
 }
 private void determineIntegrationContext() {
   if (configurationMap.get(ToolIntegrationConstants.INTEGRATION_TYPE) != null) {
     for (ToolIntegrationContext context :
         integrationContextRegistry.getAllIntegrationContexts()) {
       if (context
           .getContextType()
           .equals(configurationMap.get(ToolIntegrationConstants.INTEGRATION_TYPE))) {
         integrationContext = context;
       }
     }
   } else {
     integrationContext =
         integrationContextRegistry.getToolIntegrationContext(
             ToolIntegrationConstants.COMMON_TOOL_INTEGRATION_CONTEXT_UID);
   }
 }
  @Override
  public void addPages() {
    List<String> toolNames = new LinkedList<>();

    for (String id : integrationService.getIntegratedComponentIds()) {
      toolNames.add(id.substring(id.lastIndexOf(".") + 1));
    }

    List<String> groupNames = new ArrayList<>();
    LogicalNodeId localNode =
        serviceRegistryAccess.getService(PlatformService.class).getLocalDefaultLogicalNodeId();
    Collection<ComponentInstallation> installations =
        getInitialComponentKnowledge().getAllInstallations();
    installations = ComponentUtils.eliminateComponentInterfaceDuplicates(installations, localNode);
    for (ComponentInstallation ci : installations) {
      ComponentInterface componentInterface = ci.getComponentRevision().getComponentInterface();
      String groupName = componentInterface.getGroupName();
      if (!groupName.startsWith("_") && !groupNames.contains(groupName)) {
        groupNames.add(groupName);
      }
    }

    Collections.sort(groupNames, String.CASE_INSENSITIVE_ORDER);

    editConfigurationPage =
        new ChooseConfigurationPage(
            Messages.chooseConfigPageTitle,
            integrationContextRegistry.getAllIntegrationContexts(),
            this,
            wizardType);

    characteristicsPage =
        new ToolCharacteristicsPage(
            Messages.firstToolIntegrationPageTitle, configurationMap, toolNames, groupNames);

    inOutputPage = new InOutputConfigurationPage(Messages.inOuputPage, configurationMap);
    propertyPage = new PropertyConfigurationPage(Messages.propertyPage, configurationMap);
    toolPage = new ToolConfigurationPage(Messages.toolPage, configurationMap);
    scriptPage = new ScriptConfigurationPage(Messages.scriptPage, configurationMap);

    addPage(editConfigurationPage);
    addPage(characteristicsPage);
    addPage(inOutputPage);
    addPage(propertyPage);
    addPage(toolPage);
    addPage(scriptPage);

    this.getShell().setMinimumSize(MINIMUM_WIDTH, MINIMUM_HEIGHT);

    IntegrationWizardPageContributorRegistry contributorRegistry =
        serviceRegistryAccess.getService(IntegrationWizardPageContributorRegistry.class);
    for (IntegrationWizardPageContributor contributor : contributorRegistry.getAllContributors()) {
      List<ToolIntegrationWizardPage> pages = contributor.getAdditionalPagesList(configurationMap);
      additionalPages.put(contributor.getType(), pages);
      for (ToolIntegrationWizardPage page : pages) {
        addPage(page);
      }
    }
  }
示例#4
0
 protected String generateTooltipTextBase(WorkflowNode node) {
   if (node.getComponentDescription().getVersion() != null
       && toolIntegrationRegistry.hasId(node.getComponentDescription().getIdentifier())) {
     return de.rcenvironment.core.utils.common.StringUtils.format(
         "%s - %s (%s)",
         node.getName(),
         node.getComponentDescription().getName(),
         node.getComponentDescription().getVersion());
   } else {
     return de.rcenvironment.core.utils.common.StringUtils.format(
         "%s - %s", node.getName(), node.getComponentDescription().getName());
   }
 }
  /**
   * Setter for the configuration map to edit.
   *
   * @param newPreviousConfiguration loaded map
   * @param configJson where the config came from
   */
  public void setPreviousConfiguration(
      Map<String, Object> newPreviousConfiguration, File configJson) {
    Map<String, Object> configurationMapCopy = new HashMap<>();
    previousConfiguration = new HashMap<>(newPreviousConfiguration);
    if (newPreviousConfiguration != null) {
      configurationMapCopy.putAll(newPreviousConfiguration);
    }
    setConfigurationMap(configurationMapCopy);
    if (configJson != null) {
      if (newPreviousConfiguration != null
          && newPreviousConfiguration.get(ToolIntegrationConstants.INTEGRATION_TYPE) != null) {
        for (ToolIntegrationContext context :
            integrationContextRegistry.getAllIntegrationContexts()) {
          if (newPreviousConfiguration
              .get(ToolIntegrationConstants.INTEGRATION_TYPE)
              .equals(context.getContextType())) {
            integrationContext = context;
          }
        }
      } else {
        integrationContext =
            integrationContextRegistry.getToolIntegrationContext(
                ToolIntegrationConstants.COMMON_TOOL_INTEGRATION_CONTEXT_UID);
      }
    }

    updateAllPages();
    for (Entry<String, List<ToolIntegrationWizardPage>> addPages : additionalPages.entrySet()) {
      if (newPreviousConfiguration != null
          && !addPages
              .getKey()
              .equals(newPreviousConfiguration.get(ToolIntegrationConstants.INTEGRATION_TYPE))) {
        for (ToolIntegrationWizardPage page : addPages.getValue()) {
          page.setPageComplete(true);
        }
      }
    }
  }