Search in sources :

Example 1 with GlobalProducer

use of org.kie.internal.runtime.manager.GlobalProducer in project jbpm by kiegroup.

the class InjectableRegisterableItemsFactory method getGlobals.

@Override
public Map<String, Object> getGlobals(RuntimeEngine runtime) {
    Map<String, Object> globals = new HashMap<String, Object>();
    RuntimeManager manager = ((RuntimeEngineImpl) runtime).getManager();
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("ksession", runtime.getKieSession());
    parameters.put("taskService", runtime.getTaskService());
    parameters.put("runtimeManager", manager);
    parameters.put("kieContainer", getRuntimeManager().getKieContainer());
    try {
        parameters.put("executorService", executorService.get());
    } catch (Exception e) {
        logger.debug("Executor service not available due to {}", e.getMessage());
    }
    try {
        for (GlobalProducer producer : globalProducer) {
            globals.putAll(producer.getGlobals(manager.getIdentifier(), parameters));
        }
    } catch (Exception e) {
        // do nothing as work item handler is considered optional
        logger.warn("Exception while evalutating globals prodcuers {}", e.getMessage());
    }
    // add globals from descriptor
    globals.putAll(getGlobalsFromDescriptor(runtime));
    return globals;
}
Also used : GlobalProducer(org.kie.internal.runtime.manager.GlobalProducer) HashMap(java.util.HashMap) RuntimeManager(org.kie.api.runtime.manager.RuntimeManager) RuntimeEngineImpl(org.jbpm.runtime.manager.impl.RuntimeEngineImpl) UnsatisfiedResolutionException(javax.enterprise.inject.UnsatisfiedResolutionException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 UnsatisfiedResolutionException (javax.enterprise.inject.UnsatisfiedResolutionException)1 RuntimeEngineImpl (org.jbpm.runtime.manager.impl.RuntimeEngineImpl)1 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)1 GlobalProducer (org.kie.internal.runtime.manager.GlobalProducer)1