Class MicroWorkflowService

java.lang.Object
org.imixs.workflow.micro.MicroWorkflowService
All Implemented Interfaces:
org.imixs.workflow.WorkflowContext, org.imixs.workflow.WorkflowManager

@ApplicationScoped public class MicroWorkflowService extends Object implements org.imixs.workflow.WorkflowManager, org.imixs.workflow.WorkflowContext
The MicroWorkflowEngine implements a lightweight workflow service. It can be run on plain Java VMs.

The Service is based on the core concepts of Imixs-Workflow.

  • Field Details

  • Constructor Details

    • MicroWorkflowService

      public MicroWorkflowService() throws org.imixs.workflow.exceptions.PluginException
      Constructor creates a WorkflowContext and a WorkflowKernel
      Throws:
      org.imixs.workflow.exceptions.PluginException
  • Method Details

    • init

      @PostConstruct public void init()
    • setDevice

      public void setDevice(String device)
    • getModelManager

      public org.imixs.workflow.ModelManager getModelManager()
      Returns the ModelManager Instance
      Specified by:
      getModelManager in interface org.imixs.workflow.WorkflowContext
      Returns:
    • getSessionContext

      public Object getSessionContext()
      Specified by:
      getSessionContext in interface org.imixs.workflow.WorkflowContext
    • getDatabase

      public MemoryDB getDatabase()
    • loadBPMNModel

      public void loadBPMNModel(String modelPath)
      Loads a new model
      Parameters:
      modelPath -
    • loadBPMNModel

      public void loadBPMNModel(InputStream inputStream)
    • removeWorkItem

      public void removeWorkItem(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.AccessDeniedException
      Specified by:
      removeWorkItem in interface org.imixs.workflow.WorkflowManager
      Throws:
      org.imixs.workflow.exceptions.AccessDeniedException
    • getWorkItem

      public org.imixs.workflow.ItemCollection getWorkItem(String id)
      Specified by:
      getWorkItem in interface org.imixs.workflow.WorkflowManager
    • processWorkItem

      public org.imixs.workflow.ItemCollection processWorkItem(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException, org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException
      This method processes a workItem by the WorkflowKernel and saves the workitem after the processing was finished successful. The workitem have to provide at least the properties '$modelversion', '$taskid' and '$eventid'

      Before the method starts processing the workitem, the method load the current instance of the given workitem and compares the property $taskID. If it is not equal the method throws an ProcessingErrorException.

      After the workitem was processed successful, the method verifies the property $workitemList. If this property holds a list of entities these entities will be saved and the property will be removed automatically.

      Specified by:
      processWorkItem in interface org.imixs.workflow.WorkflowManager
      Parameters:
      workitem - - the workItem to be processed
      Returns:
      updated version of the processed workItem
      Throws:
      org.imixs.workflow.exceptions.AccessDeniedException - - thrown if the user has insufficient access to update the workItem
      org.imixs.workflow.exceptions.ProcessingErrorException - - thrown if the workitem could not be processed by the workflowKernel
      org.imixs.workflow.exceptions.PluginException - - thrown if processing by a plugin fails
      org.imixs.workflow.exceptions.ModelException
    • evalWorkflowResult

      public org.imixs.workflow.ItemCollection evalWorkflowResult(org.imixs.workflow.ItemCollection event, String xmlTag, org.imixs.workflow.ItemCollection documentContext, boolean resolveItemValues) throws org.imixs.workflow.exceptions.PluginException
      The method evaluates the WorkflowResult for a given BPMN event and returns a ItemColleciton containing all item values of a specified xml tag. Each tag definition must contain at least a name attribute and may contain an optional list of additional attributes.

      The method generates a item for each content element and attribute value. e.g.:

      <item name="comment" ignore="true">text</item>

      This example will result in an ItemCollection with the attributes 'comment' with value 'text' and 'comment.ignore' with the value 'true'

      Also embedded itemVaues can be resolved (resolveItemValues=true):

      <somedata>ABC<itemvalue>$uniqueid</itemvalue></somedata>

      This example will result in a new item 'somedata' with the $uniqueid prefixed with 'ABC'

      Parameters:
      event -
      xmlTag - - XML tag to be evaluated
      documentContext -
      resolveItemValues - - if true, itemValue tags will be resolved.
      Returns:
      eval itemCollection or null if no tags are contained in the workflow result.
      Throws:
      org.imixs.workflow.exceptions.PluginException - if the xml structure is invalid
    • registerPlugins

      protected void registerPlugins(org.imixs.workflow.WorkflowKernel workflowkernel, org.openbpmn.bpmn.BPMNModel model) throws org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException
      This method register all plugin classes listed in the model profile
      Throws:
      org.imixs.workflow.exceptions.PluginException
      org.imixs.workflow.exceptions.ModelException
    • registerAdapters

      protected void registerAdapters(org.imixs.workflow.WorkflowKernel workflowkernel)
    • updateMetadata

      protected void updateMetadata(org.imixs.workflow.ItemCollection workitem)
      This method updates the workitem metadata. The following items will be updated:
      • $creator
      • $editor
      • $lasteditor
      • $participants

      The method also migrates deprected items.

      Parameters:
      workitem -