Class 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 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