public interface GraphInstance
GraphInstance represents an executing instance of a Graph.| Modifier and Type | Method and Description |
|---|---|
void |
addToExecutionQueue(Token token)
Adds a token to the execution queue.
|
void |
addToHistory(String event)
Adds the given event into the instance's history log.
|
void |
addToken(Token token)
Adds a token to the graph instance.
|
void |
addWorkItem(GraphWorkItem workItem)
When a token execution reaches a wait state, it produces a
WorkItem which describes the work that needs to be completed in
order to continue the token's execution. |
List<Token> |
getActiveChildTokens(Token parent)
Tokens are created with a tree-like parent-child relation-ship. |
List<Token> |
getActiveTokens() |
GraphWorkItem |
getActiveWorkItem(Token token)
A token can be associated with 0 or 1 active work items.
|
Environment |
getEnvironment() |
Long |
getExternalId()
A
GraphInstance may be assigned an external id to associate it
with externally persisted state, buisness data, etc. |
Token |
getFirstFromExecutionQueue()
A
GraphInstance keeps a queue of tokens for which the engine
should attempt to proceed execution. |
Graph |
getGraph() |
String |
getHistory()
Returns the instance's history log.
|
List<Token> |
getTokens() |
List<GraphWorkItem> |
getWorkItems() |
boolean |
isCompleted()
A
GraphInstance is completed if it does not contain any active
tokens. |
int |
nextTokenId()
A
Token has a graph instance specific id. |
void |
removeFirstFromExecutionQueue()
Removes the head of the execution queue.
|
Long getExternalId()
GraphInstance may be assigned an external id to associate it
with externally persisted state, buisness data, etc.Graph getGraph()
Environment getEnvironment()
EnvironmentList<Token> getTokens()
List<Token> getActiveTokens()
List<Token> getActiveChildTokens(Token parent)
Tokens are created with a tree-like parent-child relation-ship.
Each token has exactly one parent and may have zero to many child tokens.
Child tokens are mainly created at fork nodes which produce 1-N outgoing
tokens. When a token is cancelled, all it's child tokens are cancelled as
well.void addToken(Token token)
token - the token to be addedboolean isCompleted()
GraphInstance is completed if it does not contain any active
tokens.int nextTokenId()
Token has a graph instance specific id. It is a graph
instance's task to provide a sequence for such id numbers.void addWorkItem(GraphWorkItem workItem)
WorkItem which describes the work that needs to be completed in
order to continue the token's execution.
This node is not intended to be called directly from a node's
Node.execute(GraphEngine, Token) method. They should rather call
methods such as
GraphEngine.addSignalItem(GraphInstance, Token, String) which
also notify GraphWorkItemEventListeners in addition to calling this
method.
workItem - the work item to be added to the instanceGraphWorkItem getActiveWorkItem(Token token)
WorkItemStatus.COMPLETED nor WorkItemStatus.CANCELLED.token - the token of which to find the active work itemnull if no such work item existsList<GraphWorkItem> getWorkItems()
void addToHistory(String event)
event - information on an execution eventString getHistory()
Token getFirstFromExecutionQueue()
GraphInstance keeps a queue of tokens for which the engine
should attempt to proceed execution. This method peeks the top of this
queue, i.e. it returns the queue's head but does not remove it.null if
currently no token can be executedvoid addToExecutionQueue(Token token)
token - the token to be addedvoid removeFirstFromExecutionQueue()
Copyright © 2018. All rights reserved.