Search in sources :

Example 1 with ConfigItem

use of org.guvnor.structure.server.config.ConfigItem in project drools-wb by kiegroup.

the class ConfigWorkDefinitionsLoader method loadWorkDefinitions.

public Map<String, WorkDefinition> loadWorkDefinitions() {
    // Find all configured WIDs
    final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>();
    final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.EDITOR);
    if (configGroups == null || configGroups.isEmpty()) {
        return workDefinitions;
    }
    // Load configured WIDs
    final List<String> definitions = new ArrayList<String>();
    for (ConfigGroup configGroup : configGroups) {
        if (WorkItemsEditorService.WORK_ITEM_DEFINITION.equals(configGroup.getName())) {
            for (ConfigItem configItem : configGroup.getItems()) {
                definitions.add(configGroup.getConfigItemValue(configItem.getName()));
            }
        }
    }
    // Parse MVEL expressions into model
    workDefinitions.putAll(WorkDefinitionsParser.parse(definitions));
    return workDefinitions;
}
Also used : HashMap(java.util.HashMap) WorkDefinition(org.jbpm.process.core.WorkDefinition) ArrayList(java.util.ArrayList) ConfigItem(org.guvnor.structure.server.config.ConfigItem) ConfigGroup(org.guvnor.structure.server.config.ConfigGroup)

Example 2 with ConfigItem

use of org.guvnor.structure.server.config.ConfigItem in project drools-wb by kiegroup.

the class WorkItemsEditorServiceImpl method loadWorkItemDefinitionElements.

Map<String, String> loadWorkItemDefinitionElements() {
    final Map<String, String> workItemDefinitionElements = new HashMap<String, String>();
    final List<ConfigGroup> editorConfigGroups = configurationService.getConfiguration(ConfigType.EDITOR);
    for (ConfigGroup editorConfigGroup : editorConfigGroups) {
        if (WORK_ITEMS_EDITOR_SETTINGS.equals(editorConfigGroup.getName())) {
            for (ConfigItem item : editorConfigGroup.getItems()) {
                final String itemName = item.getName();
                final String itemValue = editorConfigGroup.getConfigItemValue(itemName);
                workItemDefinitionElements.put(itemName, itemValue);
            }
        }
    }
    return workItemDefinitionElements;
}
Also used : HashMap(java.util.HashMap) ConfigItem(org.guvnor.structure.server.config.ConfigItem) ConfigGroup(org.guvnor.structure.server.config.ConfigGroup)

Example 3 with ConfigItem

use of org.guvnor.structure.server.config.ConfigItem in project drools-wb by kiegroup.

the class AppSetup method getTestScenarioElementDefinitions.

private ConfigGroup getTestScenarioElementDefinitions() {
    final ConfigGroup group = configurationFactory.newConfigGroup(ConfigType.EDITOR, ScenarioTestEditorService.TEST_SCENARIO_EDITOR_SETTINGS, "");
    ConfigItem<Integer> configItem = new ConfigItem<Integer>();
    configItem.setName(ScenarioTestEditorService.TEST_SCENARIO_EDITOR_MAX_RULE_FIRINGS);
    configItem.setValue(10000);
    group.addConfigItem(configItem);
    return group;
}
Also used : ConfigItem(org.guvnor.structure.server.config.ConfigItem) ConfigGroup(org.guvnor.structure.server.config.ConfigGroup)

Example 4 with ConfigItem

use of org.guvnor.structure.server.config.ConfigItem in project drools-wb by kiegroup.

the class AppSetup method assertPlayground.

@PostConstruct
public void assertPlayground() {
    try {
        configurationService.startBatch();
        // Setup mandatory properties for Drools-Workbench
        final ConfigItem<String> supportRuntimeDeployConfigItem = new ConfigItem<>();
        supportRuntimeDeployConfigItem.setName("support.runtime.deploy");
        supportRuntimeDeployConfigItem.setValue("false");
        setupConfigurationGroup(ConfigType.GLOBAL, GLOBAL_SETTINGS, getGlobalConfiguration(), supportRuntimeDeployConfigItem);
        // Setup properties required by the Work Items Editor
        setupConfigurationGroup(ConfigType.EDITOR, WorkItemsEditorService.WORK_ITEMS_EDITOR_SETTINGS, workbenchConfigurationHelper.getWorkItemElementDefinitions());
        // Setup test scenario properties
        // TODO : get TEST SCENARIO ELEMENT DEFINITIONS
        setupConfigurationGroup(ConfigType.EDITOR, ScenarioTestEditorService.TEST_SCENARIO_EDITOR_SETTINGS, getTestScenarioElementDefinitions());
        // notify components that bootstrap is completed to start post setups
        applicationStartedEvent.fire(new ApplicationStarted());
    } catch (final Exception e) {
        logger.error("Error during update config", e);
        throw new RuntimeException(e);
    } finally {
        configurationService.endBatch();
    }
}
Also used : ApplicationStarted(org.uberfire.commons.services.cdi.ApplicationStarted) ConfigItem(org.guvnor.structure.server.config.ConfigItem) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ConfigItem (org.guvnor.structure.server.config.ConfigItem)4 ConfigGroup (org.guvnor.structure.server.config.ConfigGroup)3 HashMap (java.util.HashMap)2 ArrayList (java.util.ArrayList)1 PostConstruct (javax.annotation.PostConstruct)1 WorkDefinition (org.jbpm.process.core.WorkDefinition)1 ApplicationStarted (org.uberfire.commons.services.cdi.ApplicationStarted)1