public class WorkflowEngine extends java.lang.Object implements StateWorkflowSystem, WorkflowSystemEventHandler
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>
Constructor and Description |
---|
WorkflowEngine(RuleEngine engine,
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
|
WorkflowSystemEventListener |
getListener()
listener
|
RuleEngine |
getRuleEngine()
Rule engine
|
MutableStateObj |
getState()
state object
|
boolean |
isInterrupted() |
boolean |
isWorkflowEndState() |
<DAT,RES extends WorkflowSystem.OperationCompleted<DAT>,OP extends WorkflowSystem.Operation<DAT,RES>> |
processOperations(java.util.Set<OP> operations,
WorkflowSystem.SharedData<DAT> sharedData)
Process the operations and return results when all runnable operations are complete.
|
void |
setListener(WorkflowSystemEventListener listener)
set listener
|
public WorkflowEngine(RuleEngine engine, MutableStateObj state, java.util.concurrent.ExecutorService executor)
engine
- rule engine to process state changes via rulesstate
- initial stateexecutor
- executor to process operations, which should be multithreaded to process operations concurrentlypublic MutableStateObj getState()
StateWorkflowSystem
getState
in interface StateWorkflowSystem
public RuleEngine getRuleEngine()
StateWorkflowSystem
getRuleEngine
in interface StateWorkflowSystem
public <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> sharedData)
WorkflowSystem
processOperations
in interface WorkflowSystem
DAT
- shared data typeRES
- success result of an operationOP
- operation classoperations
- operationspublic 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
public WorkflowSystemEventListener getListener()
StateWorkflowSystem
getListener
in interface StateWorkflowSystem
public void setListener(WorkflowSystemEventListener listener)
StateWorkflowSystem
setListener
in interface StateWorkflowSystem
public boolean isInterrupted()
isInterrupted
in interface WorkflowSystem
WorkflowSystem.processOperations(Set, SharedData)
stopped due to interruption