public class GraphEngineImpl extends Object implements GraphEngine
| Constructor and Description |
|---|
GraphEngineImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(GraphInstance instance)
Aborts the given
GraphInstance's execution and cancels all
associated tokens and work items. |
GraphWorkItem |
addHumanTaskItem(GraphInstance instance,
Token token,
String role,
String user,
Map<String,Object> arguments)
Adds a new
HumanTaskItem to the given instance which is
associated to the given token. |
GraphWorkItem |
addSignalItem(GraphInstance instance,
Token token,
String signal)
Adds a new
SignalItem to the given instance which is associated
to the given token. |
GraphWorkItem |
addTaskItem(GraphInstance instance,
Token token,
String bean,
String method,
Object[] arguments)
Adds a new
TaskItem to the given instance which is associated to
the given token. |
GraphWorkItem |
addTimerItem(GraphInstance instance,
Token token,
Date dueDate)
Adds a new
TimerItem to the given instance which is associated to
the given token. |
TokenImpl |
addToken(GraphInstance instance,
Node node,
Token parent)
Adds a new, active token to the given instance pointing to the given node
with the given parent.
|
void |
cancel(Token token)
Cancels the given token.
|
void |
cancelWorkItem(Token token)
If existent, cancels the active work item associated with the given
token.
|
void |
complete(GraphWorkItem workItem)
Completes the executed work item and continues execution until another
wait state is reached or until the graph instance is completed.
|
void |
complete(Token token,
Object result)
A shorthand for
GraphEngine.complete(Token, Object, String) using a the
default transition name Transition.DEFAULT_TRANSITION_NAME. |
void |
complete(Token token,
Object result,
String transitionName)
|
BeanResolver |
getBeanResolver()
Returns the engine's
BeanResolver, or null
if the engine does not support to resolve beans. |
NewGraphInstanceCreator |
getNewGraphInstanceCreator()
Returns the engine's
NewGraphInstanceCreator, or null
if the engine does not support to create sub graph instances. |
GraphRepository |
getRepository()
Returns the engine's
GraphRepository. |
void |
registerInstanceEventListener(GraphInstanceEventListener listener)
Adds a
GraphInstanceEventListener to the engine. |
void |
registerNodeEventListener(NodeEventListener listener)
Adds a
NodeEventListener to the engine. |
void |
registerWorkItemEventListener(GraphWorkItemEventListener listener)
Adds a
GraphWorkItemEventListener to the engine. |
void |
setBeanResolver(BeanResolver beanResolver) |
void |
setNewGraphInstanceCreator(NewGraphInstanceCreator newGraphInstanceCreator) |
void |
setRepository(GraphRepository repository) |
GraphInstanceImpl |
start(Graph graph)
A shorthand for
#start(Graph, Environment, String) using an empty
initial environment and a null external id. |
GraphInstanceImpl |
start(Graph graph,
Environment initialEnvironment) |
GraphInstanceImpl |
start(Graph graph,
Environment initialEnvironment,
Long externalId)
|
GraphInstanceImpl |
start(String graphName)
A shorthand for
#start(String, Integer, Environment, String) using
the latest graph with the given name and an empty initial environment and
a null external id. |
GraphInstanceImpl |
start(String graphName,
Integer version)
A shorthand for
#start(String, Integer, Environment, String) using
an empty initial environment and a null external id. |
GraphInstanceImpl |
start(String graphName,
Integer version,
Environment initialEnvironment)
A shorthand for
#start(String, Integer, Environment, String) using a
null external id. |
GraphInstanceImpl |
start(String graphName,
Integer version,
Environment initialEnvironment,
Long externalId)
Starts a
GraphInstance of the Graph with the given name
and version and using the given Environment and associates the created
GraphInstance with the given external. |
void |
terminate(Token token)
Marks the given token and all direct parent tokens active that do not
have any further active child tokens.
|
public GraphInstanceImpl start(String graphName)
GraphEngineFacade#start(String, Integer, Environment, String) using
the latest graph with the given name and an empty initial environment and
a null external id.start in interface GraphEngineFacadepublic GraphInstanceImpl start(String graphName, Integer version)
GraphEngineFacade#start(String, Integer, Environment, String) using
an empty initial environment and a null external id.start in interface GraphEngineFacadepublic GraphInstanceImpl start(String graphName, Integer version, Environment initialEnvironment)
GraphEngineFacade#start(String, Integer, Environment, String) using a
null external id.start in interface GraphEngineFacadepublic GraphInstanceImpl start(String graphName, Integer version, Environment initialEnvironment, Long externalId)
GraphEngineFacadeGraphInstance of the Graph with the given name
and version and using the given Environment and associates the created
GraphInstance with the given external. Is the equivalent of doing
Graph graph = engine.getRepository().getLatestGraph(graphName);
GraphInstance graphInstance = engine.start(graph, initialEnvironment,
externalId);
If no graph is found for the given graphName, a WorkflowException
will be thrown.start in interface GraphEngineFacadegraphName - the name of the graph to executeversion - the version of the graph to execute of null for
the latest graph with the given name.initialEnvironment - A starting environment for the GraphInstance. All
attributes from this environment will be copied into the new
graph instance's environment before execution starts.externalId - the external id that the graph instance is associated withGraphInstance of the latest Graph with the
given name and using the given Environment which has
already been started (and, given that no wait states were
entered, is already completed).public GraphInstanceImpl start(Graph graph)
GraphEngineFacade#start(Graph, Environment, String) using an empty
initial environment and a null external id.start in interface GraphEngineFacadepublic GraphInstanceImpl start(Graph graph, Environment initialEnvironment)
start in interface GraphEngineFacadepublic GraphInstanceImpl start(Graph graph, Environment initialEnvironment, Long externalId)
GraphEngineFacadeGraphInstance of the given Graph using the given
Environment. A Token will be generated for the start node
(determined by Graph.getStartNode()), and this token will be
executed. If the graph does not contain nodes which go into a wait state,
the GraphInstance returned will be completed.
Before the graph instance is started, the given initial environment will be copied into the one of the new graph instance.
start in interface GraphEngineFacadegraph - the graph to create a graph instance ofinitialEnvironment - an initial environment for the graph instanceexternalId - the external id that the graph instance is associated withpublic void abort(GraphInstance instance)
GraphEngineFacadeGraphInstance's execution and cancels all
associated tokens and work items.abort in interface GraphEngineFacadeinstance - the graph instance to abortpublic void complete(GraphWorkItem workItem)
GraphEngineFacadecomplete in interface GraphEngineFacadeworkItem - the work item to completepublic GraphRepository getRepository()
GraphEngineFacadeGraphRepository.getRepository in interface GraphEngineFacadeGraphRepositorypublic void setRepository(GraphRepository repository)
public BeanResolver getBeanResolver()
GraphEngineFacadeBeanResolver, or null
if the engine does not support to resolve beans.getBeanResolver in interface GraphEngineFacadeBeanResolver, or null
if the engine does not support to resolve beans.public void setBeanResolver(BeanResolver beanResolver)
public NewGraphInstanceCreator getNewGraphInstanceCreator()
GraphEngineFacadeNewGraphInstanceCreator, or null
if the engine does not support to create sub graph instances.getNewGraphInstanceCreator in interface GraphEngineFacadeNewGraphInstanceCreator, or null
if the engine does not support to create sub graph instances.public void setNewGraphInstanceCreator(NewGraphInstanceCreator newGraphInstanceCreator)
public void registerInstanceEventListener(GraphInstanceEventListener listener)
GraphEngineFacadeGraphInstanceEventListener to the engine.registerInstanceEventListener in interface GraphEngineFacadelistener - listener to be addedpublic void registerWorkItemEventListener(GraphWorkItemEventListener listener)
GraphEngineFacadeGraphWorkItemEventListener to the engine.registerWorkItemEventListener in interface GraphEngineFacadelistener - listener to be addedpublic void registerNodeEventListener(NodeEventListener listener)
GraphEngineFacadeNodeEventListener to the engine.registerNodeEventListener in interface GraphEngineFacadelistener - listener to be addedpublic TokenImpl addToken(GraphInstance instance, Node node, Token parent)
GraphEngineaddToken in interface GraphEngineinstance - the instance to add tonode - the node that the new token will point toparent - the new token's parent tokenpublic GraphWorkItem addSignalItem(GraphInstance instance, Token token, String signal)
GraphEngineSignalItem to the given instance which is associated
to the given token. The SignalItem is awaiting a signal with the
given name.addSignalItem in interface GraphEngineinstance - the instance to add the new signal item totoken - the token to associate the signal item withsignal - the signal's name to wait forpublic GraphWorkItem addTimerItem(GraphInstance instance, Token token, Date dueDate)
GraphEngineTimerItem to the given instance which is associated to
the given token. The TimerItem is awaiting the given dueDate.addTimerItem in interface GraphEngineinstance - the instance to add the new timer item totoken - the token to associate the timer item withdueDate - the due date to wait forpublic GraphWorkItem addTaskItem(GraphInstance instance, Token token, String bean, String method, Object[] arguments)
GraphEngineTaskItem to the given instance which is associated to
the given token. The TaskItem is awaiting external execution.addTaskItem in interface GraphEngineinstance - the instance to add the new task item totoken - the token to associate the task item withbean - the bean to call a method onmethod - the method to call toarguments - the method call's argumentspublic GraphWorkItem addHumanTaskItem(GraphInstance instance, Token token, String role, String user, Map<String,Object> arguments)
GraphEngineHumanTaskItem to the given instance which is
associated to the given token. The HumanTaskItem is awaiting
external resolution.addHumanTaskItem in interface GraphEngineinstance - the instance to add the new human task item totoken - the token to associate the human task item withrole - the role a user must be assigned to resolve the given taskuser - the user the task is assigned to or null if the
assignment is role based.arguments - the task argumentspublic void cancelWorkItem(Token token)
GraphEnginecancelWorkItem in interface GraphEnginepublic void complete(Token token, Object result)
GraphEngineGraphEngine.complete(Token, Object, String) using a the
default transition name Transition.DEFAULT_TRANSITION_NAME.complete in interface GraphEnginepublic void complete(Token token, Object result, String transitionName)
GraphEngineToken's current Node
on the associated GraphInstance. The method will take the
required steps to merge the given result into the graph instance's
Environment and to continue the token's execution along the
Transition with the given name.
If a call to Node.execute(GraphEngine, Token) does not contain a
call to this method, then the token's execution halts at that point. This
is generally referred to as a wait state. This occurs, for example, if
the action represented by that node must be done by a human or some
external system.
When the external system has determined that the Node has
completed its work, it should invoke
GraphEngineFacade#complete(WorkItem) to continue executing the
graph instance.
complete in interface GraphEnginetoken - The token to continue execution onresult - The result of the node executiontransitionName - The transition's name along which to continue executionpublic void terminate(Token token)
GraphEngineterminate in interface GraphEnginepublic void cancel(Token token)
GraphEngineNode.cancel(GraphEngine, Token) on the node that this token is
currently pointing to.cancel in interface GraphEngineCopyright © 2018. All rights reserved.