org.ow2.bonita.pvm.activity
Interface ActivityExecution

All Superinterfaces:
Discussable, Execution, OpenExecution, java.io.Serializable
All Known Implementing Classes:
ExecutionImpl

public interface ActivityExecution
extends OpenExecution

view upon an path of execution exposed to Activity implementations.

Author:
Tom Baeyens

Field Summary
 
Fields inherited from interface org.ow2.bonita.pvm.Execution
STATE_ACTIVE, STATE_ASYNC, STATE_CANCELLED, STATE_CREATED, STATE_ENDED, STATE_INACTIVE, STATE_SUSPENDED
 
Method Summary
 void addLog(ProcessLog processLog)
          adds a log to this execution.
 ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition)
          creates and begins a sub process related to this path of execution.
 ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition, java.lang.String key)
          creates and begins a sub process related to this path of execution.
 void cancel()
          ends this execution and assigns the state Execution.STATE_CANCELLED.
 Execution createExecution()
          creates a child execution.
 Execution createExecution(Execution parent)
          creates a new child execution under the given parent.
 Execution createExecution(java.lang.String name)
          creates a child execution with the given name.
 Execution createExecution(java.lang.String name, Execution parent)
          creates a new child execution under the given parent with the given name.
 ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition)
          creates a sub process related to this path of execution.
 ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition, java.lang.String key)
          creates a sub process related to this path of execution.
 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 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.
<T> T
getExtension(java.lang.Class<T> extensionClass)
          way to access process language extensions in the execution without having to cast.
 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.
 Transition getTransition()
          the current transition indicating the position in the process definition graph.
 void move(Node destination)
          position this execution in the destination node.
 void move(Node destination, Execution execution)
          position the given execution in the destination node
 void removeExecution(Execution child)
          removes the child execution from this execution.
 void removeExecution(Execution child, Execution parent)
          removes the child execution from the given parent.
 void setPriority(int priority)
          setter for the priority.
 void take(java.lang.String transitionName)
          takes the outgoing transition with the given name.
 void take(Transition transition)
          takes the given outgoing transition.
 void take(Transition transition, Execution execution)
          let's the given execution take the transition.
 void takeDefaultTransition()
          takes the default transition.
 void waitForSignal()
          makes this execution wait in the current node until an external trigger is given with one of the #signal() methods.
 
Methods inherited from interface org.ow2.bonita.pvm.model.OpenExecution
createVariable, createVariable, getExecution, getExecutions, getExecutionsMap, getJobs, getNode, getParent, getProcessDefinition, getProcessInstance, getSubProcessInstance, getVariable, getVariableKeys, getVariables, hasExecution, hasVariable, hasVariables, removeVariable, removeVariables, setVariable, setVariables
 
Methods inherited from interface org.ow2.bonita.pvm.Execution
getDbid, getId, getKey, getName, getNodeName, getPriority, getState, isActive, isEnded, isFinished, isLocked, isSuspended
 
Methods inherited from interface org.ow2.bonita.pvm.model.Discussable
createComment, getComments, removeComment
 

Method Detail

waitForSignal

void waitForSignal()
makes this execution wait in the current node until an external trigger is given with one of the #signal() methods.


takeDefaultTransition

void takeDefaultTransition()
takes the default 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() method as in that case, it's the current node (hence the process language)that will decide how to interpret the signal.

Throws:
PvmException - in case there is no default transition in the current node or in case this method is called from inside an Activity

take

void take(java.lang.String transitionName)
takes the outgoing transition with the given name.

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

Parameters:
transitionName - is the name of the transition to take. A null value will match the first unnamed transition.
Throws:
PvmException - in case no such transition is found in the current node or in case this method is called from inside an Activity.

take

void take(Transition transition)
takes the given outgoing 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'.


take

void take(Transition transition,
          Execution execution)
let's the given execution take the transition.

Throws:
PvmException - if the execution is not part of this process instance.

execute

void execute(java.lang.String nodeName)
executes the given nested node.

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.


execute

void execute(Node node)
executes the given 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.


move

void move(Node destination)
position this execution in the destination node.


move

void move(Node destination,
          Execution execution)
position the given execution in the destination node


createExecution

Execution createExecution()
creates a child execution. See #createExecution(Execution, String) for more information.


createExecution

Execution createExecution(java.lang.String name)
creates a child execution with the given name. See #createExecution(Execution, String) for more information.


createExecution

Execution createExecution(Execution parent)
creates a new child execution under the given parent. See #createExecution(Execution, String) for more information.

Throws:
PvmException - if the given parent is not in this execution's process instance.

createExecution

Execution createExecution(java.lang.String name,
                          Execution parent)
creates a new child execution under the given parent with the given name. Only leaf executions can be active. So creating the first child execution will inactivate the parent execution automatically.

Throws:
PvmException - if the given parent is not in this execution's process instance.

removeExecution

void removeExecution(Execution child)
removes the child execution from this execution. Removing the last child execution of a parent will cause the parent's state to become active.


removeExecution

void removeExecution(Execution child,
                     Execution parent)
removes the child execution from the given parent. Removing the last child execution of a parent will cause the parent's state to become active.


createSubProcessInstance

ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition)
creates a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.


createSubProcessInstance

ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition,
                                               java.lang.String key)
creates a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.


beginSubProcessInstance

ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition)
creates and begins a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.


beginSubProcessInstance

ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition,
                                              java.lang.String key)
creates and begins a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.


end

void end()
ends this execution and all of its child executions.

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 Activitys. It can be called from outside the process execution and in ExternalActivitys.


cancel

void cancel()
ends this execution and assigns the state Execution.STATE_CANCELLED.

See Also:
end(String)

end

void end(java.lang.String state)
ends this execution and all it's child executions with a user defined status.

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.


fire

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. All the actions will see the given eventSource in #getEventSource(), event if the events are registered to parent's of the given eventSource.


addLog

void addLog(ProcessLog processLog)
adds a log to this execution.


getTransition

Transition getTransition()
the current transition indicating the position in the process definition graph. Can be null in case this execution is not taking a transition.


getExtension

<T> T getExtension(java.lang.Class<T> extensionClass)
way to access process language extensions in the execution without having to cast. Casting can be problematic for persistence.


setPriority

void setPriority(int priority)
setter for the priority. The default priority is 0, which means NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1), LOW (-1) and LOWEST (-2). For the rest, the user can set any other priority integer value, but then, the UI will have to display it as an integer and not the named value.

Specified by:
setPriority in interface OpenExecution

getPreviousNode

Node getPreviousNode()
returns the previously executed node only if Node.isPreviousNeeded() is set to true.


getPreviousTransition

Transition getPreviousTransition()
returns the previously taken transition only if Node.isPreviousNeeded() is set to true.



Copyright © 2009 OW2 Consortium. All Rights Reserved.