public class GraphInstanceImpl extends Object implements GraphInstance
| Constructor and Description |
|---|
GraphInstanceImpl() |
GraphInstanceImpl(Graph 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.
|
EnvironmentImpl |
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.
|
int |
getTokenIdSequence() |
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.
|
void |
setEnvironment(EnvironmentImpl environment) |
void |
setExternalId(Long externalId) |
void |
setGraph(Graph graph) |
void |
setHistory(String history) |
void |
setTokenIdSquence(int tokenIdSequence) |
void |
setTokens(List<Token> tokens) |
void |
setWorkItems(List<GraphWorkItem> workItems) |
public GraphInstanceImpl()
public GraphInstanceImpl(Graph graph)
public Long getExternalId()
GraphInstanceGraphInstance may be assigned an external id to associate it
with externally persisted state, buisness data, etc.getExternalId in interface GraphInstancepublic Graph getGraph()
getGraph in interface GraphInstancepublic EnvironmentImpl getEnvironment()
getEnvironment in interface GraphInstanceEnvironmentpublic List<Token> getTokens()
getTokens in interface GraphInstancepublic List<Token> getActiveTokens()
getActiveTokens in interface GraphInstancepublic List<Token> getActiveChildTokens(Token parent)
GraphInstanceTokens 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.getActiveChildTokens in interface GraphInstancepublic void addToken(Token token)
GraphInstanceaddToken in interface GraphInstancetoken - the token to be addedpublic boolean isCompleted()
GraphInstanceGraphInstance is completed if it does not contain any active
tokens.isCompleted in interface GraphInstancepublic int nextTokenId()
GraphInstanceToken has a graph instance specific id. It is a graph
instance's task to provide a sequence for such id numbers.nextTokenId in interface GraphInstancepublic void addWorkItem(GraphWorkItem workItem)
GraphInstanceWorkItem 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.
addWorkItem in interface GraphInstanceworkItem - the work item to be added to the instancepublic GraphWorkItem getActiveWorkItem(Token token)
GraphInstanceWorkItemStatus.COMPLETED nor WorkItemStatus.CANCELLED.getActiveWorkItem in interface GraphInstancetoken - the token of which to find the active work itemnull if no such work item existspublic void setExternalId(Long externalId)
public void setGraph(Graph graph)
public void setEnvironment(EnvironmentImpl environment)
public int getTokenIdSequence()
public void setTokenIdSquence(int tokenIdSequence)
public List<GraphWorkItem> getWorkItems()
getWorkItems in interface GraphInstancepublic void setWorkItems(List<GraphWorkItem> workItems)
public void addToHistory(String event)
GraphInstanceaddToHistory in interface GraphInstanceevent - information on an execution eventpublic void setHistory(String history)
public String getHistory()
GraphInstancegetHistory in interface GraphInstancepublic Token getFirstFromExecutionQueue()
GraphInstanceGraphInstance 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.getFirstFromExecutionQueue in interface GraphInstancenull if
currently no token can be executedpublic void addToExecutionQueue(Token token)
GraphInstanceaddToExecutionQueue in interface GraphInstancetoken - the token to be addedpublic void removeFirstFromExecutionQueue()
GraphInstanceremoveFirstFromExecutionQueue in interface GraphInstanceCopyright © 2018. All rights reserved.