org.jbpm.api.activity
Interface ActivityExecution

All Superinterfaces:
Discussable, Execution, OpenExecution, java.io.Serializable

public interface ActivityExecution
extends OpenExecution

view upon an path of execution exposed to ActivityBehaviour implementations.

Author:
Tom Baeyens

Field Summary
 
Fields inherited from interface org.jbpm.api.Execution
STATE_ACTIVE_CONCURRENT, STATE_ACTIVE_ROOT, STATE_ASYNC, STATE_CREATED, STATE_ENDED, STATE_INACTIVE_CONCURRENT_ROOT, STATE_INACTIVE_JOIN, STATE_INACTIVE_SCOPE, STATE_SUSPENDED
 
Method Summary
 void end()
          ends this execution and all of its child executions.
 void end(OpenExecution executionToEnd)
          ends the given execution and all it's child executions.
 void end(OpenExecution executionToEnd, java.lang.String state)
          ends the given execution and all it's child executions with a user defined status.
 void end(java.lang.String state)
          ends this execution and all it's child executions with a user defined status.
 void execute(Activity activity)
          executes the given activity.
 void execute(java.lang.String activityName)
          executes the given nested activity.
 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.
 Activity getActivity()
          the current activity.
 java.lang.String getActivityName()
          represents the current position in the process by indicating the name of the current activity.
<T> T
getExtension(java.lang.Class<T> extensionClass)
          way to access process language extensions in the execution without having to cast.
 Transition getTransition()
          the current transition indicating the position in the process definition graph.
 void historyActivityEnd()
          marks the end of an activity for history purposes.
 void historyActivityEnd(java.lang.String transitionName)
          marks the end of an activity with a specific transitionName for history purposes.
 void historyActivityStart()
          marks the start of an activity for history purposes.
 void historyAutomatic()
          records the end of an automatic event.
 void historyDecision(java.lang.String transitionName)
          record history event that specifies for a decision activity which transition has been taken.
 void setActivity(Activity destination)
          position this execution in the destination activity.
 void setActivity(Activity destination, Execution execution)
          position the given execution in the destination activity
 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 activity until an external trigger is given with one of the #signal() methods.
 
Methods inherited from interface org.jbpm.api.model.OpenExecution
createVariable, createVariable, findActiveExecutionIn, getExecution, getParent, getProcessDefinition, getProcessInstance, getSubProcessInstance, getVariable, getVariableKeys, getVariables, hasVariable, hasVariables, removeVariable, removeVariables, setState, setVariable, setVariables
 
Methods inherited from interface org.jbpm.api.Execution
findActiveActivityNames, getExecutions, getExecutionsMap, getId, getKey, getName, getPriority, getProcessDefinitionId, getState, hasExecution, isActive, isEnded, isProcessInstance, isSuspended
 
Methods inherited from interface org.jbpm.api.model.Discussable
createComment, getComments, removeComment
 

Method Detail

getActivityName

java.lang.String getActivityName()
represents the current position in the process by indicating the name of the current activity.


getActivity

Activity getActivity()
the current activity.


waitForSignal

void waitForSignal()
makes this execution wait in the current activity 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 ExternalActivityBehaviour 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 activity (hence the process language)that will decide how to interpret the signal.

Throws:
JbpmException - in case there is no default transition in the current activity or in case this method is called from inside an ActivityBehaviour

take

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

This method can only be called from inside ExternalActivityBehaviour 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 activity (hence the process language)that will decide how to interpret the signal.

Transitions will be looked up recursively starting from the current activity and then up the activity-parent-hierarchy

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

take

void take(Transition transition)
takes the given outgoing transition.

This method can only be called from inside ExternalActivityBehaviour 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 activity (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 activity. The motivation for that is that in case of groups, that check can become too 'expensive'.


take

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

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

execute

void execute(java.lang.String activityName)
executes the given nested activity.

The activityName is looked up in the current activity's nested activities.

This method can only be called from inside ExternalActivityBehaviour 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 activity (hence the process language)that will decide how to interpret the signal.


execute

void execute(Activity activity)
executes the given activity.

This method can only be called from inside ExternalActivityBehaviour 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 activity (hence the process language)that will decide how to interpret the signal.


setActivity

void setActivity(Activity destination)
position this execution in the destination activity.


setActivity

void setActivity(Activity destination,
                 Execution execution)
position the given execution in the destination activity


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.


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 in Execution as that may case unpredictable side effects.

The execution will be removed from it's parent.


end

void end(OpenExecution executionToEnd)
ends the given execution and all it's child executions.


end

void end(OpenExecution executionToEnd,
         java.lang.String state)
ends the given execution and all it's child executions with a user defined status.


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.


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

historyDecision

void historyDecision(java.lang.String transitionName)
record history event that specifies for a decision activity which transition has been taken.


historyAutomatic

void historyAutomatic()
records the end of an automatic event. This should be called at the end of the activity. Before the activity's execute method is invoked, the start time is automatically recorded. And invocation of this historyAutomatic will capture the end time.


historyActivityStart

void historyActivityStart()
marks the start of an activity for history purposes.


historyActivityEnd

void historyActivityEnd()
marks the end of an activity for history purposes.


historyActivityEnd

void historyActivityEnd(java.lang.String transitionName)
marks the end of an activity with a specific transitionName for history purposes.



Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.