public class WorkflowEngine extends java.lang.Object implements StateWorkflowSystem, WorkflowSystemEventHandler
StateWorkflowSystem.OperationCompleteEvent<D,RES extends WorkflowSystem.OperationCompleted<D>,OP extends WorkflowSystem.Operation<D,RES>>, StateWorkflowSystem.OperationEvent<D>, StateWorkflowSystem.StateChange<D>, StateWorkflowSystem.StateChangeEvent<D>, StateWorkflowSystem.StateEvent<D>
WorkflowSystem.Operation<X,T extends WorkflowSystem.OperationCompleted>, WorkflowSystem.OperationCompleted<T>, WorkflowSystem.OperationResult<D,T extends WorkflowSystem.OperationCompleted<D>,X extends WorkflowSystem.Operation<D,T>>, WorkflowSystem.SharedData<T,Y>
Constructor and Description |
---|
WorkflowEngine(RuleEngine ruleEngine,
MutableStateObj state,
java.util.concurrent.ExecutorService executor)
Create engine
|
Modifier and Type | Method and Description |
---|---|
void |
event(WorkflowSystemEvent event)
handle event
|
void |
event(WorkflowSystemEventType eventType,
java.lang.String message)
handle event with message
|
void |
event(WorkflowSystemEventType eventType,
java.lang.String message,
java.lang.Object data)
handle event with message and data
|
boolean |
isWorkflowEndState() |
<DAT,RES extends WorkflowSystem.OperationCompleted<DAT>,OP extends WorkflowSystem.Operation<DAT,RES>> |
processOperations(java.util.Set<OP> operations,
WorkflowSystem.SharedData<DAT,java.util.Map<java.lang.String,java.lang.String>> sharedData)
Process the operations and return results when all runnable operations are complete.
|
boolean |
processStateChange(StateWorkflowSystem.StateChange<?> change)
Handle the state changes for the rule engine
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getListeners, getRuleEngine, getState, operationCompleteEvent, operationEvent, setListeners, stateChange, stateChangeEvent, stateEvent
isInterrupted
public WorkflowEngine(RuleEngine ruleEngine, MutableStateObj state, java.util.concurrent.ExecutorService executor)
ruleEngine
- rule engine to process state changes via rulesstate
- initial stateexecutor
- executor to process operations, which should be multithreaded to process operations concurrentlypublic <DAT,RES extends WorkflowSystem.OperationCompleted<DAT>,OP extends WorkflowSystem.Operation<DAT,RES>> java.util.Set<WorkflowSystem.OperationResult<DAT,RES,OP>> processOperations(java.util.Set<OP> operations, WorkflowSystem.SharedData<DAT,java.util.Map<java.lang.String,java.lang.String>> sharedData)
WorkflowSystem
processOperations
in interface WorkflowSystem<java.util.Map<java.lang.String,java.lang.String>>
DAT
- shared data typeRES
- success result of an operationOP
- operation classoperations
- operationspublic boolean processStateChange(StateWorkflowSystem.StateChange<?> change)
StateWorkflowSystem
processStateChange
in interface StateWorkflowSystem
change
- public void event(WorkflowSystemEventType eventType, java.lang.String message)
WorkflowSystemEventHandler
event
in interface WorkflowSystemEventHandler
public void event(WorkflowSystemEventType eventType, java.lang.String message, java.lang.Object data)
WorkflowSystemEventHandler
event
in interface WorkflowSystemEventHandler
public void event(WorkflowSystemEvent event)
WorkflowSystemEventHandler
event
in interface WorkflowSystemEventHandler
public boolean isWorkflowEndState()
isWorkflowEndState
in interface StateWorkflowSystem