|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Execution
a runtime path of execution.
The state of an execution is either active or locked. An active execution is either
executing or waiting for an external trigger. If an execution is not in STATE_ACTIVE
,
then it is locked. A locked execution is read only.
When a new execution is created, it is in STATE_ACTIVE
. To change
the state to a locked state, use lock(String)
.
Some STATE_* constants
are provided that represent the
most commonly used locked states. But the state '...' in the picture indicates
that any string can be provided as the state in the lock method.
If an execution is locked, methods that change the execution will throw
a PvmException
and the message will reference the actual locking state.
Firing events
,
updating variables
,
updating priority
and
adding comments
are not considered to change an
execution. Also creation
and
removal
of child executions are unchecked,
which means that those methods can be invoked by external API clients and
node behaviour methods, even while the execution is in a locked state.
Make sure that comparisons between getState()
and the
STATE_* constants
are
done with .equals and not with '==' because if executions are
loaded from persistent storage, a new string is created instead
of the constants.
Field Summary | |
---|---|
static java.lang.String |
STATE_ACTIVE
either executing or in a wait state waiting for a signal. |
static java.lang.String |
STATE_CANCELLED
this execution was cancelled with the cancel()
method before normal execution ended. |
static java.lang.String |
STATE_ENDED
this execution has ended normally. |
static java.lang.String |
STATE_INACTIVE
parents with concurrent child executions are inactive. |
static java.lang.String |
STATE_SUSPENDED
indicates that this execution is temporary suspended with the suspend() method. |
Method Summary | ||
---|---|---|
void |
addLog(ProcessLog processLog)
adds a log to this execution. |
|
void |
cancel()
ends this execution and assigns the state STATE_CANCELLED . |
|
Comment |
createComment(java.lang.String message)
adding a comment. |
|
Execution |
createExecution()
creates a child path of execution. |
|
Execution |
createExecution(java.lang.String name)
creates a child path of execution with the given name. |
|
VariableScope |
createVariableScope()
creates a new variable scope. |
|
VariableScope |
createVariableScope(java.util.List<VariableDefinition> variableDefinitions)
creates a new variable scope and initialize it according to the given variable definitions. |
|
void |
destroyVariableScope()
removes the most inner variableScope. |
|
void |
end()
ends this execution and all of its child executions. |
|
void |
end(java.lang.String state)
ends this execution and all it's child executions with a user defined status. |
|
void |
end(java.lang.String state,
boolean remove)
ends this execution and all it's child executions with a user defined status. |
|
void |
execute(Node node)
executes the given node. |
|
void |
execute(java.lang.String nodeName)
executes the given nested node. |
|
void |
fire(java.lang.String eventName,
ObservableElement eventSource)
fires the event on the given eventSource and then propagates the event up to the eventSource's parent chain. |
|
java.util.List<Comment> |
getComments()
the list of comments made on this execution. |
|
long |
getDbid()
the meaningless database primary key |
|
Event |
getEvent()
the event that is being fired, part of the current position in the process graph. |
|
ObservableElement |
getEventSource()
the original object that fired the event, part of the current position in the process graph. |
|
java.lang.Exception |
getException()
the exception in case an exception handler is handling an exception. |
|
Execution |
getExecution(java.lang.String name)
the child execution for the given name or null in case such execution doesn't exist. |
|
java.util.Collection<Execution> |
getExecutions()
the child executions in the execution structure. |
|
java.util.Map<java.lang.String,Execution> |
getExecutionsMap()
maps child execution names to execution objects. |
|
|
getExtension(java.lang.Class<T> extensionClass)
way to access process language extensions in the execution without having to cast. |
|
java.lang.String |
getKey()
the meaningful but optional business key that is unique within one process definition. |
|
java.lang.String |
getName()
the name of this execution. |
|
Node |
getNode()
the current node indicating the position in the process definition graph. |
|
Execution |
getParent()
the parent execution in the execution structure. |
|
Node |
getPreviousNode()
returns the previously executed node only if Node.isPreviousNeeded()
is set to true. |
|
Transition |
getPreviousTransition()
returns the previously taken transition only if Node.isPreviousNeeded()
is set to true. |
|
int |
getPriority()
indicates low priorities with negative values and high priorities with positive values. |
|
ProcessDefinition |
getProcessDefinition()
the process definition for this execution. |
|
Execution |
getProcessInstance()
the main path of execution in the execution structure. |
|
java.lang.String |
getState()
the state of this execution. |
|
Transition |
getTransition()
the current transition indicating the position in the process definition graph. |
|
java.lang.Object |
getVariable(java.lang.String key)
retrieves the variable value for the given key. |
|
java.util.Set<java.lang.String> |
getVariableKeys()
the variable keys for this execution in all visible scopes. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getVariables()
retrieves all variables, CAUTION : this might be a very costly operation in case you're using database persistence and many variables have to be fetched from the database. |
|
java.util.Iterator<VariableScope> |
getVariableScopeIterator()
iterates over all variable scopes from inner to outer, including executionScopes on the parent execution chain. |
|
boolean |
hasExecution(java.lang.String executionName)
indicates if this execution has a child execution with the given executionName |
|
boolean |
hasVariable(java.lang.String key)
checks presence of the given variable key. |
|
boolean |
isActive()
is this execution active ? |
|
boolean |
isEnded()
is this execution ended normally ? |
|
boolean |
isFinished()
is this execution ended or cancelled ? |
|
boolean |
isLocked()
is this execution locked ? |
|
boolean |
isSuspended()
is this execution suspended ? |
|
void |
lock(java.lang.String state)
makes this execution read-only. |
|
void |
move(Node destination)
reposition this execution in the destination node. |
|
void |
removeExecution(Execution execution)
removes the child execution. |
|
void |
removeVariable(java.lang.String key)
removes the variable with the given key. |
|
void |
resume()
resumes an execution. |
|
void |
setPriority(int priority)
setter for the priority. |
|
void |
setVariable(java.lang.String key,
java.lang.Object value)
sets the variable into the most inner matching variable scope. |
|
void |
setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
sets all the variable into the most inner matching variable scope. |
|
void |
signal()
feeds a external trigger into this execution. |
|
void |
signal(java.util.Map<java.lang.String,java.lang.Object> parameters)
feeds an external trigger into the execution with parameters. |
|
void |
signal(java.lang.String signalName)
feeds a named external trigger into the execution. |
|
void |
signal(java.lang.String signalName,
java.util.Map<java.lang.String,java.lang.Object> parameters)
feeds a named external trigger into the execution with parameters. |
|
void |
suspend()
suspends this execution and all it's child executions. |
|
void |
take(java.lang.String transitionName)
takes the outgoing transition with the given name. |
|
void |
take(Transition transition)
takes the given outgoing transition. |
|
void |
takeDefaultTransition()
takes the default transition. |
|
void |
unlock()
unlocks a locked execution. |
|
void |
waitForSignal()
makes this execution wait in the current node until an external trigger is given with one of the signal() methods. |
Field Detail |
---|
static final java.lang.String STATE_ACTIVE
static final java.lang.String STATE_INACTIVE
static final java.lang.String STATE_ENDED
static final java.lang.String STATE_CANCELLED
cancel()
method before normal execution ended. Make sure that comparisons are
done with .equals and not with '==' because if executions are
loaded from persistent storage, a new string is created instead
of the constants.
static final java.lang.String STATE_SUSPENDED
suspend()
method. Human tasks of a suspended execution
shouldn't show up in people's task list and timers of suspended
executions shouldn't fire and the execution is locked. Make sure that comparisons are
done with .equals and not with '==' because if executions are
loaded from persistent storage, a new string is created instead
of the constants.
Method Detail |
---|
long getDbid()
java.lang.String getKey()
java.lang.String getName()
java.lang.String getState()
boolean isActive()
isLocked()
.
boolean isLocked()
locked
? This is the inverse of isActive()
.
boolean isFinished()
boolean isEnded()
boolean isSuspended()
void lock(java.lang.String state)
unlock()
.
PvmException
- when this execution is already locked.void unlock()
locked
execution.
int getPriority()
void setPriority(int priority)
Execution getProcessInstance()
Execution getParent()
java.util.Collection<Execution> getExecutions()
java.util.Map<java.lang.String,Execution> getExecutionsMap()
Execution getExecution(java.lang.String name)
ProcessDefinition getProcessDefinition()
Node getNode()
Transition getTransition()
ObservableElement getEventSource()
Activity
, but the eventSource can also
be a child of the object to which is listened in case of event propagation.
Event getEvent()
Node getPreviousNode()
Node.isPreviousNeeded()
is set to true.
Transition getPreviousTransition()
Node.isPreviousNeeded()
is set to true.
void setVariable(java.lang.String key, java.lang.Object value)
removeVariable(String)
,
getVariableKeys()
void setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
setVariable(String, Object)
for each entry in the given map. For more
about variables and their scopes,
see section
variables in the package description.
setVariable(String,Object)
,
removeVariable(String)
,
getVariableKeys()
java.lang.Object getVariable(java.lang.String key)
boolean hasVariable(java.lang.String key)
void removeVariable(java.lang.String key)
getVariable(String)
method. More can be found in
section variables in the package
description.
setVariable(String, Object)
java.util.Set<java.lang.String> getVariableKeys()
setVariable(String, Object)
,
removeVariable(String)
java.util.Map<java.lang.String,java.lang.Object> getVariables()
void signal()
Typically a signal causes the execution to proceed, but that doesn't necessarily
has to be the case . The ExternalActivity
is responsible for interpreting
the signal and acting upon it.
A signal can optionally be given a signal name
,
a map of parameters
or both
.
Since it's an external trigger, this method requires that this execution is
waiting for an external trigger. So this method must be called as an external client
and can not be called while this execution is executing. In an Activity
for
example you're not allowed to call the signal on the execution cause it is executing.
But you are allowed to invoke this method on any other execution (at least, if that
one is waiting for an external trigger).
Typically a signal will cause the execution to start executing, but that is
not a must. What happens with this signal is defined in the
ExternalActivity.signal(Execution, String, Map)
of
the current node
.
signal(String)
void signal(java.lang.String signalName)
external trigger
into the execution.
In each state, a number of things can happen. The signal parameter specifies which of these things is happening. It's somewhat similar to a method name in the invocation of an object.
See the unnamed signal for more information
void signal(java.util.Map<java.lang.String,java.lang.Object> parameters)
an external trigger
into the execution with parameters.
See the unnamed signal for more information
void signal(java.lang.String signalName, java.util.Map<java.lang.String,java.lang.Object> parameters)
external trigger
into the execution with parameters.
In each state, a number of things can happen. The signal parameter specifies which of these things is happening. It's somewhat similar to a method name in the invocation of an object.
The parameters parameter provide extra information to the signal.
Typically, the parameters are set as variables but
the process language can overwrite that behaviour in the current node.
See ExternalActivity.signal(Execution, String, Map)
for more information.
See the unnamed signal for more information
void end()
The execution will be removed from it's parent. Potentially this can cause a parent execution to start executing in case this is the last concurrent execution for which the parent is waiting.
This method should not be called in Activity
s. It can be called from
outside the process execution and in ExternalActivity
s.
void end(java.lang.String state)
It is not recommended to use any of
the defined statuses
as that may case unpredictable
side effects.
The execution will be removed from it's parent.
void end(java.lang.String state, boolean remove)
It is not recommended to use any of
the defined statuses
as that may case unpredictable
side effects.
remove
- indicates whether the execution must be removed from its parent.void cancel()
STATE_CANCELLED
.
end(String)
void suspend()
PvmException
- if this execution is already suspended.void resume()
suspend()
.
PvmException
- if this execution is not suspended.VariableScope createVariableScope()
VariableScope createVariableScope(java.util.List<VariableDefinition> variableDefinitions)
void destroyVariableScope()
java.util.Iterator<VariableScope> getVariableScopeIterator()
void fire(java.lang.String eventName, ObservableElement eventSource)
getEventSource()
, event if the events are
registered to parent's of the given eventSource.
Execution createExecution()
STATE_INACTIVE
when this method is invoked.
Execution createExecution(java.lang.String name)
end()
or end(String)
, then it
will be automatically removed from this parent execution. Creating a child execution
implies that this execution will no longer be a leaf in the execution tree.
So the state of this execution will automatically set to STATE_INACTIVE
when this method is invoked.
void removeExecution(Execution execution)
boolean hasExecution(java.lang.String executionName)
void addLog(ProcessLog processLog)
<T> T getExtension(java.lang.Class<T> extensionClass)
void takeDefaultTransition()
This method can only be called from inside
ExternalActivity
implementations and in rare occasions also from outside
of the execution (from an external client while the process is in a wait state).
For external clients, it is more normal to use the signal()
method as in that case, it's the current node (hence the process language)that
will decide how to interpret the signal.
PvmException
- in case there is no default transition in the current node
or in case this method is called from inside an Activity
void take(java.lang.String transitionName)
This method can only be called
from inside ExternalActivity
implementations and in rare occasions also from
outside of the execution (from an external client while the process is in a wait state).
For external clients, it is more normal to use the signal(String)
method as in that case, it's the current node (hence the process language)that
will decide how to interpret the signal.
Transitions will be looked up recursively starting from the
current node
and then up the node-parent-hierarchy
transitionName
- is the name of the transition to take. A null value will
match the first unnamed transition.
PvmException
- in case no such transition is found in the current node
or in case this method is called from inside an Activity
.void take(Transition transition)
This method can only be called
from inside ExternalActivity
implementations and in rare occasions also from
outside of the execution (from an external client while the process is in a wait state).
For external clients, it is more normal to use the signal(String)
method as in that case, it's the current node (hence the process language)that
will decide how to interpret the signal.
CAUTION: It's up to the client to make sure that this transition makes sense as there is no check whether the given transition is an outgoing transition of the current node. The motivation for that is that in case of superstates, that check can become too 'expensive'.
void execute(java.lang.String nodeName)
The nodeName is looked up in the current node's nested nodes.
This method can only be called
from inside ExternalActivity
implementations and in rare occasions also from
outside of the execution (from an external client while the process is in a wait state).
For external clients, it is more normal to use the signal(String)
method as in that case, it's the current node (hence the process language)that
will decide how to interpret the signal.
void execute(Node node)
This method can only be called
from inside ExternalActivity
implementations and in rare occasions also from
outside of the execution (from an external client while the process is in a wait state).
For external clients, it is more normal to use the signal(String)
method as in that case, it's the current node (hence the process language)that
will decide how to interpret the signal.
void waitForSignal()
signal()
methods.
void move(Node destination)
Comment createComment(java.lang.String message)
Environment.getUserId()
.
java.util.List<Comment> getComments()
java.lang.Exception getException()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |