org.jbpm.process.instance.impl.demo

## Class MockDataWorkItemHandler

- java.lang.Object
- - org.jbpm.process.instance.impl.demo.MockDataWorkItemHandler

- All Implemented Interfaces:
    org.kie.api.runtime.process.WorkItemHandler

      public class MockDataWorkItemHandler
      extends Object
      implements org.kie.api.runtime.process.WorkItemHandler

  Simple work item handler that allows to provide output data or supplier that can provide data based on supplied function. It can reason on top of provided input data.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MockDataWorkItemHandler(Function<Map<String,Object>,Map<String,Object>> outputDataSupplier)` Create handler with custom function that will supply output data.
    `MockDataWorkItemHandler(Map<String,Object> outputData)` Create handler that will always complete work items with exact same map of data.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abortWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)`
    `void` | `executeWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MockDataWorkItemHandler

          public MockDataWorkItemHandler(Map<String,Object> outputData)

      Create handler that will always complete work items with exact same map of data.
      Parameters:
        `outputData` - data to be used when completing work items

    - #### MockDataWorkItemHandler

          public MockDataWorkItemHandler(Function<Map<String,Object>,Map<String,Object>> outputDataSupplier)

      Create handler with custom function that will supply output data. It can use input data to change the output data returned if needed.
      Parameters:
        `outputDataSupplier` - function responsible to provide output data

  - ### Method Detail

    - #### executeWorkItem

          public void executeWorkItem(org.kie.api.runtime.process.WorkItem workItem,
                                      org.kie.api.runtime.process.WorkItemManager manager)

      Specified by:
        `executeWorkItem` in interface `org.kie.api.runtime.process.WorkItemHandler`

    - #### abortWorkItem

          public void abortWorkItem(org.kie.api.runtime.process.WorkItem workItem,
                                    org.kie.api.runtime.process.WorkItemManager manager)

      Specified by:
        `abortWorkItem` in interface `org.kie.api.runtime.process.WorkItemHandler`

Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.