Package jadex.bpmn.runtime.impl
Class ProcessThread
java.lang.Object
jadex.bpmn.runtime.impl.ProcessThread
- All Implemented Interfaces:
ITaskContext
Representation of a single control flow in a BPMN process instance,
i.e. an instance of a sequence flow.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MActivityThe next activity.protected booleanIs the task canceled.protected ICancelableThe wait info.The data of the current or last activity.The data of the current data edges.protected MSequenceEdgeThe last edge (if any).static final StringThe user result parameter name.protected ExceptionThe exception that has just occurred in the process (if any).protected StringThe thread id.intThe id counter for sub processes.protected jadex.core.IComponentThe Bpmn instance.The loop command.protected ProcessThreadThe parent process thread.The subprocess intermediate result received command.The split infos.protected List<ProcessThread> The subthreads.protected ITaskThe current task.static final StringThe future result parameter name.protected jadex.common.IFilter<Object> The wait filter.protected booleanIs the process in a waiting state. -
Constructor Summary
ConstructorsConstructorDescriptionProcessThread(MActivity activity, ProcessThread parent, jadex.core.IComponent instance) Create a new process instance.ProcessThread(MActivity activity, ProcessThread parent, jadex.core.IComponent instance, boolean passive) Create a new process instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalThread(ProcessThread thread) Add an external thread to this context.voidaddSplitInfo(SplitInfo spi) Add a split info.voidaddThread(ProcessThread thread) Add a thread to this context.booleanTest if the thread belongs to the given pool and/or lane.voidcopy(ProcessThread ret) Create a copy of this thread (e.g.Create a copy of this thread (e.g.Get the activity.Get the name of all parameters.Get all threads of the context and all subcontexts.protected IInternalBpmnComponentFeaturegetBpmnFeature(jadex.core.IComponent ia) Get the bpmn feature.Get the model.getData()Get the data.Get the data edges.Get the exception (if any).getExecutableThread(String pool, String lane) Get an executable thread in the context or its sub contexts.getId()Get the id.jadex.core.IComponentGet the instance.Get the last edge (if any).Get the loopcmd.Get the model element.protected StringGet a cnt for subprocesses.String[]Get the name of all parameters.Get the parameters.getParameterValue(String name) Get the value of a parameter.Get the parent.getPropertyValue(String name) Get the value of a property.getPropertyValue(String name, MActivity activity) Hack: method is necessary because thread.activity is not always the activity to execute in case of multiple event.getSplitInfo(String id) Get a specific split info, if available.Get the split infos.Get the subthreads.getTask()Gets the current task.Get a thread per id.Get the top level thread.jadex.common.IFilter<Object> Get the wait filter.Get the waitinfo.booleanhasOwnParameterValue(String name) Test if a parameter has been set on activity.booleanhasParameterValue(String name) Test if a parameter has been set on activity.booleanhasPropertyValue(String name) Test, if a property is declared.booleanTest if thread has subthreads.protected voidinternalSetParameterValue(String name, Object key, Object value, ProcessThread start) Set the value of a parameter.booleanIs the current task canceled?booleanisFinished(String pool, String lane) The context is finished, when there are no (more) threads to execute.booleanIs the process in a waiting state (i.e.voidMethod that can be used to determine (override) that the thread is finished.voidremoveParameterValue(String name) Remove the value of a parameter.voidremoveSplitInfo(SplitInfo spi) Remove the split info.voidRemove a sub context but keep the corresponding thread.voidremoveThread(ProcessThread thread) Remove a thread from this context.protected voidSchedule notification of this thread.voidsetActivity(MActivity activity) Set the next activity.voidsetCanceled(boolean canceled) Set the canceled state.voidsetDataEdgeValue(String name, Object value) Set the value of a parameter.voidsetException(Exception exception) Set the exception.voidsetLastEdge(MSequenceEdge edge) Set the last edge.voidsetLoopCommand(jadex.common.IResultCommand<Boolean, Void> loopcmd) Set the loopcmd.voidSet to non waiting.voidsetOrCreateParameterValue(String name, Object value) Set or create a parameter value directly in this thread.voidsetOrCreateParameterValue(String name, Object key, Object value) Set or create a parameter value directly in this thread.voidsetParameterValue(String name, Object value) Set the value of a parameter.voidsetParameterValue(String name, Object key, Object value) Set the value of a parameter.voidsetParent(ProcessThread parent) Set the parent.voidSets the current task.voidsetWaitFilter(jadex.common.IFilter<Object> waitfilter) Set the wait filter.voidsetWaitInfo(ICancelable cancelinfo) Set the process waiting info.voidsetWaiting(boolean waiting) Set the waiting state.voidTerminate the component when no process thread is active any more.toString()Create a string representation of this process thread.voidupdateParametersAfterStep(MActivity activity, jadex.core.IComponent instance) Remove in parameters after step.voidupdateParametersBeforeStep(jadex.core.IComponent instance) Update parameters based on edge inscriptions and initial values.
-
Field Details
-
THREAD_PARAMETER_SERVICE_RESULT
The future result parameter name.- See Also:
-
EVENT_PARAMETER_SERVICE_RESULT
The user result parameter name.- See Also:
-
id
The thread id. -
activity
The next activity. -
edge
The last edge (if any). -
data
The data of the current or last activity. -
dataedges
The data of the current data edges. -
parent
The parent process thread. -
subthreads
The subthreads. -
instance
protected jadex.core.IComponent instanceThe Bpmn instance. -
exception
The exception that has just occurred in the process (if any). -
waiting
protected boolean waitingIs the process in a waiting state. -
cancelinfo
The wait info. -
waitfilter
The wait filter. -
task
The current task. -
canceled
protected boolean canceledIs the task canceled. -
idcnt
public int idcntThe id counter for sub processes. -
splitinfos
The split infos. -
loopcmd
The loop command. -
resulthandler
The subprocess intermediate result received command.
-
-
Constructor Details
-
ProcessThread
Create a new process instance.- Parameters:
activity- The current activity.
-
ProcessThread
public ProcessThread(MActivity activity, ProcessThread parent, jadex.core.IComponent instance, boolean passive) Create a new process instance.- Parameters:
activity- The current activity.
-
-
Method Details
-
getBpmnModel
Get the model.- Specified by:
getBpmnModelin interfaceITaskContext- Returns:
- The bpmn model.
-
getId
Get the id.- Returns:
- The id.
-
getActivity
Get the activity.- Specified by:
getActivityin interfaceITaskContext- Returns:
- The activity.
-
setActivity
Set the next activity. Sets the last edge to null. Should only be used, when no edge available (e.g. start events or event handlers of subprocesses). -
isCanceled
public boolean isCanceled()Is the current task canceled?- Returns:
- The canceled flag.
-
setCanceled
public void setCanceled(boolean canceled) Set the canceled state.- Parameters:
canceled- True, if canceled.
-
getTask
Gets the current task.- Returns:
- The current task.
-
setTask
Sets the current task.- Parameters:
task- The current task.
-
getLastEdge
Get the last edge (if any).- Returns:
- The edge.
-
setLastEdge
Set the last edge. Also sets the next activity.- Parameters:
edge- The edge.
-
isWaiting
public boolean isWaiting()Is the process in a waiting state (i.e. blocked)?- Returns:
- The waiting flag.
-
setWaiting
public void setWaiting(boolean waiting) Set the waiting state. -
setNonWaiting
public void setNonWaiting()Set to non waiting. -
scheduleExecution
protected void scheduleExecution()Schedule notification of this thread. -
setWaitInfo
Set the process waiting info.- Parameters:
waiting- The waiting info.
-
getWaitInfo
Get the waitinfo.- Returns:
- The waitinfo.
-
getWaitFilter
Get the wait filter.- Returns:
- The waitfilter.
-
setWaitFilter
Set the wait filter.- Parameters:
waitfilter- The waitfilter to set.
-
createCopy
Create a copy of this thread (e.g. for a parallel split). -
copy
Create a copy of this thread (e.g. for a parallel split). -
hasOwnParameterValue
Test if a parameter has been set on activity.- Parameters:
name- The parameter name.- Returns:
- True if parameter is known.
-
hasParameterValue
Test if a parameter has been set on activity.- Specified by:
hasParameterValuein interfaceITaskContext- Parameters:
name- The parameter name.- Returns:
- True if parameter is known.
-
getModelElement
Get the model element.- Specified by:
getModelElementin interfaceITaskContext- Returns:
- The model of the task.
-
getParameterValue
Get the value of a parameter.- Specified by:
getParameterValuein interfaceITaskContext- Parameters:
name- The parameter name.- Returns:
- The parameter value.
-
getParameters
Get the parameters.- Returns:
- The parameters.
-
setDataEdgeValue
Set the value of a parameter.- Parameters:
name- The parameter name.value- The parameter value.
-
setParameterValue
Set the value of a parameter.- Specified by:
setParameterValuein interfaceITaskContext- Parameters:
name- The parameter name.value- The parameter value.
-
setParameterValue
Set the value of a parameter.- Specified by:
setParameterValuein interfaceITaskContext- Parameters:
name- The parameter name.key- An optional helper (index, key etc.)value- The parameter value.
-
internalSetParameterValue
protected void internalSetParameterValue(String name, Object key, Object value, ProcessThread start) Set the value of a parameter.- Parameters:
name- The parameter name.value- The parameter value.
-
setOrCreateParameterValue
Set or create a parameter value directly in this thread.- Specified by:
setOrCreateParameterValuein interfaceITaskContext- Parameters:
name- The parameter name.value- The parameter value.
-
setOrCreateParameterValue
Set or create a parameter value directly in this thread.- Specified by:
setOrCreateParameterValuein interfaceITaskContext- Parameters:
name- The parameter name.key- An optional helper (index, key etc.)value- The parameter value.
-
removeParameterValue
Remove the value of a parameter.- Parameters:
name- The parameter name.
-
getParameterNames
Get the name of all parameters.- Returns:
- The parameter names.
-
getAllParameterNames
Get the name of all parameters.- Returns:
- The parameter names.
-
getPropertyValue
Get the value of a property.- Specified by:
getPropertyValuein interfaceITaskContext- Parameters:
name- The property name.- Returns:
- The property value.
-
getPropertyValue
Hack: method is necessary because thread.activity is not always the activity to execute in case of multiple event. Get the value of a property.- Parameters:
name- The property name.- Returns:
- The property value.
-
hasPropertyValue
Test, if a property is declared.- Parameters:
name- The property name.- Returns:
- True, if the property is declared.
-
getException
Get the exception (if any).- Returns:
- The exception (if any).
-
setException
Set the exception.- Parameters:
exception- The exception.
-
getInstance
public jadex.core.IComponent getInstance()Get the instance.- Returns:
- The instance.
-
getDataEdges
Get the data edges.- Returns:
- The data edges.
-
getData
Get the data.- Returns:
- The data.
-
belongsTo
Test if the thread belongs to the given pool and/or lane.- Parameters:
pool- The pool to be executed or null for any.lane- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.- Returns:
- True, when the thread belongs to the given pool and/or lane. Also returns true when both pool and lane are null.
-
updateParametersBeforeStep
public void updateParametersBeforeStep(jadex.core.IComponent instance) Update parameters based on edge inscriptions and initial values.- Parameters:
instance- The calling BPMN instance.
-
getDataEdgeValues
-
updateParametersAfterStep
Remove in parameters after step.- Parameters:
instance- The calling BPMN instance.
-
getSplitInfos
Get the split infos. -
getSplitInfo
Get a specific split info, if available. -
addSplitInfo
Add a split info. -
removeSplitInfo
Remove the split info. -
removeSubcontext
public void removeSubcontext()Remove a sub context but keep the corresponding thread. E.g. when a sub process terminates, the sub context is removed and the initiating thread continues in the outer context.- Parameters:
context- The sub context to be removed.
-
removeThread
Remove a thread from this context.- Parameters:
thread- The thread to be removed.
-
addThread
Add a thread to this context.- Parameters:
thread- The thread to be added.
-
addExternalThread
Add an external thread to this context.- Parameters:
thread- The thread to be added.
-
getAllThreads
Get all threads of the context and all subcontexts. -
getTopLevelThread
Get the top level thread. -
getParent
Get the parent. return The parent. -
setParent
Set the parent.- Parameters:
parent- The parent to set.
-
getSubthreads
Get the subthreads. -
hasSubthreads
public boolean hasSubthreads()Test if thread has subthreads. -
isFinished
The context is finished, when there are no (more) threads to execute.- Parameters:
pool- The pool to be executed or null for any.lane- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.- Returns:
- True, when the process instance is finished with regards to the specified pool/lane. When both pool and lane are null, true is returned only when all pools/lanes are finished.
-
getExecutableThread
Get an executable thread in the context or its sub contexts.- Parameters:
pool- The pool to be executed or null for any.lane- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.- Returns:
- An executable thread (if any).
-
getThread
Get a thread per id.- Parameters:
id- The thread id.- Returns:
- The process thread.
-
getNextChildId
Get a cnt for subprocesses. -
getLoopCommand
Get the loopcmd.- Returns:
- The loopcmd.
-
setLoopCommand
Set the loopcmd.- Parameters:
loopcmd- The loopcmd to set.
-
notifyFinished
public void notifyFinished()Method that can be used to determine (override) that the thread is finished. -
getBpmnFeature
Get the bpmn feature. -
terminateOnEnd
public void terminateOnEnd()Terminate the component when no process thread is active any more. -
toString
Create a string representation of this process thread.
-