Class WorkflowKernel

java.lang.Object
org.imixs.workflow.WorkflowKernel

public class WorkflowKernel extends Object
The WorkflowKernel is the core component to process a workitem based on its associated BPMN Task ($taskId) and Event ($eventId) elements.

The WorkflowKernel operates on a Open BPMN model instance to navigate through a BPMN 2.0 model. The model instance is identified by the attribute $modelversion. The WorkflowKernel expects a WorkflowContext to access the ModelManager and the runtime environment.

An implementation of the WorkflowManager typical creates an instance of a WorkflowKernel and register Plugin and Adapter classes to be executed during the processing life cycle of one or many workItems.

Version:
2.0
Author:
Ralph Soika
See Also:
  • Field Details

  • Constructor Details

    • WorkflowKernel

      public WorkflowKernel(WorkflowContext ctx)
      Constructor initialize the contextObject and plugin vectors
  • Method Details

    • generateUniqueID

      public static String generateUniqueID()
      This method generates an immutable universally unique identifier (UUID). A UUID represents a 128-bit value.
      Returns:
      UUID
    • generateTransactionID

      public static String generateTransactionID()
      This method generates an secure 8 byte random secure id. The ID is returned as a hex decimal value.
      Returns:
      transactionID
    • registerPlugin

      public void registerPlugin(Plugin plugin) throws PluginException
      This method registers a new plugin class. The method throws a PluginException if the class can not be registered. If the new Plugin implements the PluginDependency interface, the method validates dependencies.
      Parameters:
      pluginClass -
      Throws:
      PluginException
    • registerAdapter

      public void registerAdapter(Adapter adapter)
      This method registers a new adapter class.
      Parameters:
      adapterClass -
    • registerPlugin

      public void registerPlugin(String pluginClass) throws PluginException
      This method registers a new plugin based on class name. The plugin will be instantiated by its name. The method throws a PluginException if the plugin class can not be created.
      Parameters:
      pluginClass -
      Throws:
      PluginException
    • unregisterPlugin

      public void unregisterPlugin(String pluginClass) throws PluginException
      This method removes a registered plugin based on its class name.
      Parameters:
      pluginClass -
      Throws:
      PluginException - if plugin not registered
    • unregisterAllPlugins

      public void unregisterAllPlugins()
      This method removes all registered plugins
      Parameters:
      pluginClass -
    • getPluginRegistry

      public List<Plugin> getPluginRegistry()
      Returns a registry containing all registered plugin instances.
      Returns:
    • getAdapterRegistry

      public Map<String,Adapter> getAdapterRegistry()
      Returns a registry containing all registered Adapter instances.
      Returns:
    • process

      public ItemCollection process(ItemCollection workitem) throws PluginException, ModelException
      This method processes a workitem (process instance) based on the current model definition. A workitem must at least provide the properties $ModelVersion, $TaskID and $EventID.

      During the processing life-cycle more than one event can be processed. This depends on the model definition which is controlled by the ModelManager. For example an event can be followed by another event in the process flow. Also conditional events can have different outcomes depending on the data of a workitem.

      The method executes all plugin and adapter classes and returns an updated instance of the workitem. The method did not persist the process instance. The persistance mechanism is covered by the WorkflowService witch is not part of this core project.

      Parameters:
      workitem - the process instance to be processed.
      Returns:
      updated workitem
      Throws:
      PluginException
      ModelException
    • eval

      Evaluates the next task BPMN element for a process instance (workitem) based on the current model definition. A Workitem must at least provide the properties $TaskID and a $EventID or $intermediateEventID.

      During the evaluation life-cycle more than one event can be evaluated. This depends on the model definition which can define follow-up-events, split-events and conditional events.

      The method did not persist the process instance or execute any plugins or adapter classes.

      Parameters:
      workitem - the process instance to be evaluated.
      Returns:
      the BPMN task element followed by the given execution flow
      Throws:
      PluginException
      ModelException
    • getSplitWorkitems

      public List<ItemCollection> getSplitWorkitems()
      This method returns new SplitWorkitems evaluated during the last processing life-cycle.
      Returns: