Package jadex.bpmn.runtime
Class ProcessThread
- java.lang.Object
- 
- jadex.bpmn.runtime.ProcessThread
 
- 
- All Implemented Interfaces:
- jadex.bpmn.model.task.ITaskContext
 
 public class ProcessThread extends java.lang.Object implements jadex.bpmn.model.task.ITaskContextRepresentation of a single control flow in a BPMN process instance, i.e. an instance of a sequence flow.
- 
- 
Field SummaryFields Modifier and Type Field Description protected jadex.bpmn.model.MActivityactivityThe next activity.protected booleancanceledIs the task canceled.protected ICancelablecancelinfoThe wait info.protected java.util.Map<java.lang.String,java.lang.Object>dataThe data of the current or last activity.protected java.util.Map<java.lang.String,java.lang.Object>dataedgesThe data of the current data edges.protected jadex.bpmn.model.MSequenceEdgeedgeThe last edge (if any).protected java.lang.ExceptionexceptionThe exception that has just occurred in the process (if any).protected java.lang.StringidThe thread id.intidcntThe id counter for sub processes.protected IInternalAccessinstanceThe Bpmn instance.protected IResultCommand<java.lang.Boolean,java.lang.Void>loopcmdThe loop command.protected ProcessThreadparentThe parent process thread.protected SubProcessActivityHandler.SubprocessResultHandlerresulthandlerThe subprocess intermediate result received command.java.util.Map<java.lang.String,SplitInfo>splitinfosThe split infos.protected java.util.List<ProcessThread>subthreadsThe subthreads.protected jadex.bpmn.model.task.ITasktaskThe current task.protected IFilter<java.lang.Object>waitfilterThe wait filter.protected booleanwaitingIs the process in a waiting state.
 - 
Constructor SummaryConstructors Constructor Description ProcessThread(jadex.bpmn.model.MActivity activity, ProcessThread parent, IInternalAccess instance)Create a new process instance.ProcessThread(jadex.bpmn.model.MActivity activity, ProcessThread parent, IInternalAccess instance, boolean passive)Create a new process instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExternalThread(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.booleanbelongsTo(java.lang.String pool, java.lang.String lane)Test if the thread belongs to the given pool and/or lane.voidcopy(ProcessThread ret)Create a copy of this thread (e.g.ProcessThreadcreateCopy()Create a copy of this thread (e.g.jadex.bpmn.model.MActivitygetActivity()Get the activity.java.util.Set<java.lang.String>getAllParameterNames()Get the name of all parameters.java.util.Set<ProcessThread>getAllThreads()Get all threads of the context and all subcontexts.protected IInternalBpmnComponentFeaturegetBpmnFeature(IInternalAccess ia)Get the bpmn feature.jadex.bpmn.model.MBpmnModelgetBpmnModel()Get the model.java.util.Map<java.lang.String,java.lang.Object>getData()Get the data.java.util.Map<java.lang.String,java.lang.Object>getDataEdges()Get the data edges.protected java.util.Map<java.lang.String,java.lang.Object>getDataEdgeValues()java.lang.ExceptiongetException()Get the exception (if any).ProcessThreadgetExecutableThread(java.lang.String pool, java.lang.String lane)Get an executable thread in the context or its sub contexts.java.lang.StringgetId()Get the id.IInternalAccessgetInstance()Get the instance.jadex.bpmn.model.MSequenceEdgegetLastEdge()Get the last edge (if any).IResultCommand<java.lang.Boolean,java.lang.Void>getLoopCommand()Get the loopcmd.jadex.bpmn.model.MActivitygetModelElement()Get the model element.protected java.lang.StringgetNextChildId()Get a cnt for subprocesses.java.lang.String[]getParameterNames()Get the name of all parameters.java.util.Map<java.lang.String,java.lang.Object>getParameters()Get the parameters.java.lang.ObjectgetParameterValue(java.lang.String name)Get the value of a parameter.ProcessThreadgetParent()Get the parent.java.lang.ObjectgetPropertyValue(java.lang.String name)Get the value of a property.java.lang.ObjectgetPropertyValue(java.lang.String name, jadex.bpmn.model.MActivity activity)Hack: method is necessary because thread.activity is not always the activity to execute in case of multiple event.SplitInfogetSplitInfo(java.lang.String id)Get a specific split info, if available.java.util.Collection<SplitInfo>getSplitInfos()Get the split infos.java.util.List<ProcessThread>getSubthreads()Get the subthreads.jadex.bpmn.model.task.ITaskgetTask()Gets the current task.ProcessThreadgetThread(java.lang.String id)Get a thread per id.IFilter<java.lang.Object>getWaitFilter()Get the wait filter.ICancelablegetWaitInfo()Get the waitinfo.booleanhasOwnParameterValue(java.lang.String name)Test if a parameter has been set on activity.booleanhasParameterValue(java.lang.String name)Test if a parameter has been set on activity.booleanhasPropertyValue(java.lang.String name)Test, if a property is declared.booleanhasSubthreads()Test if thread has subthreads.protected voidinternalSetParameterValue(java.lang.String name, java.lang.Object key, java.lang.Object value, ProcessThread start)Set the value of a parameter.booleanisCanceled()Is the current task canceled?booleanisFinished(java.lang.String pool, java.lang.String lane)The context is finished, when there are no (more) threads to execute.booleanisWaiting()Is the process in a waiting state (i.e.voidnotifyFinished()Method that can be used to determine (override) that the thread is finished.voidremoveParameterValue(java.lang.String name)Remove the value of a parameter.voidremoveSplitInfo(SplitInfo spi)Remove the split info.voidremoveSubcontext()Remove a sub context but keep the corresponding thread.voidremoveThread(ProcessThread thread)Remove a thread from this context.protected voidscheduleExecution()Schedule notification of this thread.voidsetActivity(jadex.bpmn.model.MActivity activity)Set the next activity.voidsetCanceled(boolean canceled)Set the canceled state.voidsetDataEdgeValue(java.lang.String name, java.lang.Object value)Set the value of a parameter.voidsetException(java.lang.Exception exception)Set the exception.voidsetLastEdge(jadex.bpmn.model.MSequenceEdge edge)Set the last edge.voidsetLoopCommand(IResultCommand<java.lang.Boolean,java.lang.Void> loopcmd)Set the loopcmd.voidsetNonWaiting()Set to non waiting.voidsetOrCreateParameterValue(java.lang.String name, java.lang.Object value)Set or create a parameter value directly in this thread.voidsetOrCreateParameterValue(java.lang.String name, java.lang.Object key, java.lang.Object value)Set or create a parameter value directly in this thread.voidsetParameterValue(java.lang.String name, java.lang.Object value)Set the value of a parameter.voidsetParameterValue(java.lang.String name, java.lang.Object key, java.lang.Object value)Set the value of a parameter.voidsetParent(ProcessThread parent)Set the parent.voidsetTask(jadex.bpmn.model.task.ITask task)Sets the current task.voidsetWaitFilter(IFilter<java.lang.Object> waitfilter)Set the wait filter.voidsetWaitInfo(ICancelable cancelinfo)Set the process waiting info.voidsetWaiting(boolean waiting)Set the waiting state.java.lang.StringtoString()Create a string representation of this process thread.voidupdateParametersAfterStep(jadex.bpmn.model.MActivity activity, IInternalAccess instance)Remove in parameters after step.voidupdateParametersBeforeStep(IInternalAccess instance)Update parameters based on edge inscriptions and initial values.
 
- 
- 
- 
Field Detail- 
idprotected java.lang.String id The thread id.
 - 
activityprotected jadex.bpmn.model.MActivity activity The next activity.
 - 
edgeprotected jadex.bpmn.model.MSequenceEdge edge The last edge (if any).
 - 
dataprotected java.util.Map<java.lang.String,java.lang.Object> data The data of the current or last activity.
 - 
dataedgesprotected java.util.Map<java.lang.String,java.lang.Object> dataedges The data of the current data edges.
 - 
parentprotected ProcessThread parent The parent process thread.
 - 
subthreadsprotected java.util.List<ProcessThread> subthreads The subthreads.
 - 
instanceprotected IInternalAccess instance The Bpmn instance.
 - 
exceptionprotected java.lang.Exception exception The exception that has just occurred in the process (if any).
 - 
waitingprotected boolean waiting Is the process in a waiting state.
 - 
cancelinfoprotected ICancelable cancelinfo The wait info.
 - 
waitfilterprotected IFilter<java.lang.Object> waitfilter The wait filter.
 - 
taskprotected jadex.bpmn.model.task.ITask task The current task.
 - 
canceledprotected boolean canceled Is the task canceled.
 - 
idcntpublic int idcnt The id counter for sub processes.
 - 
splitinfospublic java.util.Map<java.lang.String,SplitInfo> splitinfos The split infos.
 - 
loopcmdprotected IResultCommand<java.lang.Boolean,java.lang.Void> loopcmd The loop command.
 - 
resulthandlerprotected SubProcessActivityHandler.SubprocessResultHandler resulthandler The subprocess intermediate result received command.
 
- 
 - 
Constructor Detail- 
ProcessThreadpublic ProcessThread(jadex.bpmn.model.MActivity activity, ProcessThread parent, IInternalAccess instance)Create a new process instance.- Parameters:
- activity- The current activity.
 
 - 
ProcessThreadpublic ProcessThread(jadex.bpmn.model.MActivity activity, ProcessThread parent, IInternalAccess instance, boolean passive)Create a new process instance.- Parameters:
- activity- The current activity.
 
 
- 
 - 
Method Detail- 
getBpmnModelpublic jadex.bpmn.model.MBpmnModel getBpmnModel() Get the model.- Specified by:
- getBpmnModelin interface- jadex.bpmn.model.task.ITaskContext
- Returns:
- The bpmn model.
 
 - 
getIdpublic java.lang.String getId() Get the id.- Returns:
- The id.
 
 - 
getActivitypublic jadex.bpmn.model.MActivity getActivity() Get the activity.- Specified by:
- getActivityin interface- jadex.bpmn.model.task.ITaskContext
- Returns:
- The activity.
 
 - 
setActivitypublic void setActivity(jadex.bpmn.model.MActivity activity) 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).
 - 
isCanceledpublic boolean isCanceled() Is the current task canceled?- Returns:
- The canceled flag.
 
 - 
setCanceledpublic void setCanceled(boolean canceled) Set the canceled state.- Parameters:
- canceled- True, if canceled.
 
 - 
getTaskpublic jadex.bpmn.model.task.ITask getTask() Gets the current task.- Returns:
- The current task.
 
 - 
setTaskpublic void setTask(jadex.bpmn.model.task.ITask task) Sets the current task.- Parameters:
- task- The current task.
 
 - 
getLastEdgepublic jadex.bpmn.model.MSequenceEdge getLastEdge() Get the last edge (if any).- Returns:
- The edge.
 
 - 
setLastEdgepublic void setLastEdge(jadex.bpmn.model.MSequenceEdge edge) Set the last edge. Also sets the next activity.- Parameters:
- edge- The edge.
 
 - 
isWaitingpublic boolean isWaiting() Is the process in a waiting state (i.e. blocked)?- Returns:
- The waiting flag.
 
 - 
setWaitingpublic void setWaiting(boolean waiting) Set the waiting state.
 - 
setNonWaitingpublic void setNonWaiting() Set to non waiting.
 - 
scheduleExecutionprotected void scheduleExecution() Schedule notification of this thread.
 - 
setWaitInfopublic void setWaitInfo(ICancelable cancelinfo) Set the process waiting info.- Parameters:
- waiting- The waiting info.
 
 - 
getWaitInfopublic ICancelable getWaitInfo() Get the waitinfo.- Returns:
- The waitinfo.
 
 - 
getWaitFilterpublic IFilter<java.lang.Object> getWaitFilter() Get the wait filter.- Returns:
- The waitfilter.
 
 - 
setWaitFilterpublic void setWaitFilter(IFilter<java.lang.Object> waitfilter) Set the wait filter.- Parameters:
- waitfilter- The waitfilter to set.
 
 - 
createCopypublic ProcessThread createCopy() Create a copy of this thread (e.g. for a parallel split).
 - 
copypublic void copy(ProcessThread ret) Create a copy of this thread (e.g. for a parallel split).
 - 
hasOwnParameterValuepublic boolean hasOwnParameterValue(java.lang.String name) Test if a parameter has been set on activity.- Parameters:
- name- The parameter name.
- Returns:
- True if parameter is known.
 
 - 
hasParameterValuepublic boolean hasParameterValue(java.lang.String name) Test if a parameter has been set on activity.- Specified by:
- hasParameterValuein interface- jadex.bpmn.model.task.ITaskContext
- Parameters:
- name- The parameter name.
- Returns:
- True if parameter is known.
 
 - 
getModelElementpublic jadex.bpmn.model.MActivity getModelElement() Get the model element.- Specified by:
- getModelElementin interface- jadex.bpmn.model.task.ITaskContext
- Returns:
- The model of the task.
 
 - 
getParameterValuepublic java.lang.Object getParameterValue(java.lang.String name) Get the value of a parameter.- Specified by:
- getParameterValuein interface- jadex.bpmn.model.task.ITaskContext
- Parameters:
- name- The parameter name.
- Returns:
- The parameter value.
 
 - 
getParameterspublic java.util.Map<java.lang.String,java.lang.Object> getParameters() Get the parameters.- Returns:
- The parameters.
 
 - 
setDataEdgeValuepublic void setDataEdgeValue(java.lang.String name, java.lang.Object value)Set the value of a parameter.- Parameters:
- name- The parameter name.
- value- The parameter value.
 
 - 
setParameterValuepublic void setParameterValue(java.lang.String name, java.lang.Object value)Set the value of a parameter.- Specified by:
- setParameterValuein interface- jadex.bpmn.model.task.ITaskContext
- Parameters:
- name- The parameter name.
- value- The parameter value.
 
 - 
setParameterValuepublic void setParameterValue(java.lang.String name, java.lang.Object key, java.lang.Object value)Set the value of a parameter.- Specified by:
- setParameterValuein interface- jadex.bpmn.model.task.ITaskContext
- Parameters:
- name- The parameter name.
- value- The parameter value.
 
 - 
internalSetParameterValueprotected void internalSetParameterValue(java.lang.String name, java.lang.Object key, java.lang.Object value, ProcessThread start)Set the value of a parameter.- Parameters:
- name- The parameter name.
- value- The parameter value.
 
 - 
setOrCreateParameterValuepublic void setOrCreateParameterValue(java.lang.String name, java.lang.Object value)Set or create a parameter value directly in this thread.- Specified by:
- setOrCreateParameterValuein interface- jadex.bpmn.model.task.ITaskContext
 
 - 
setOrCreateParameterValuepublic void setOrCreateParameterValue(java.lang.String name, java.lang.Object key, java.lang.Object value)Set or create a parameter value directly in this thread.- Specified by:
- setOrCreateParameterValuein interface- jadex.bpmn.model.task.ITaskContext
 
 - 
removeParameterValuepublic void removeParameterValue(java.lang.String name) Remove the value of a parameter.- Parameters:
- name- The parameter name.
 
 - 
getParameterNamespublic java.lang.String[] getParameterNames() Get the name of all parameters.- Returns:
- The parameter names.
 
 - 
getAllParameterNamespublic java.util.Set<java.lang.String> getAllParameterNames() Get the name of all parameters.- Returns:
- The parameter names.
 
 - 
getPropertyValuepublic java.lang.Object getPropertyValue(java.lang.String name) Get the value of a property.- Specified by:
- getPropertyValuein interface- jadex.bpmn.model.task.ITaskContext
- Parameters:
- name- The property name.
- Returns:
- The property value.
 
 - 
getPropertyValuepublic java.lang.Object getPropertyValue(java.lang.String name, jadex.bpmn.model.MActivity activity)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.
 
 - 
hasPropertyValuepublic boolean hasPropertyValue(java.lang.String name) Test, if a property is declared.- Parameters:
- name- The property name.
- Returns:
- True, if the property is declared.
 
 - 
getExceptionpublic java.lang.Exception getException() Get the exception (if any).- Returns:
- The exception (if any).
 
 - 
setExceptionpublic void setException(java.lang.Exception exception) Set the exception.- Parameters:
- exception- The exception.
 
 - 
getInstancepublic IInternalAccess getInstance() Get the instance.- Returns:
- The instance.
 
 - 
getDataEdgespublic java.util.Map<java.lang.String,java.lang.Object> getDataEdges() Get the data edges.- Returns:
- The data edges.
 
 - 
getDatapublic java.util.Map<java.lang.String,java.lang.Object> getData() Get the data.- Returns:
- The data.
 
 - 
belongsTopublic boolean belongsTo(java.lang.String pool, java.lang.String lane)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.
 
 - 
updateParametersBeforeSteppublic void updateParametersBeforeStep(IInternalAccess instance) Update parameters based on edge inscriptions and initial values.- Parameters:
- instance- The calling BPMN instance.
 
 - 
getDataEdgeValuesprotected java.util.Map<java.lang.String,java.lang.Object> getDataEdgeValues() 
 - 
updateParametersAfterSteppublic void updateParametersAfterStep(jadex.bpmn.model.MActivity activity, IInternalAccess instance)Remove in parameters after step.- Parameters:
- instance- The calling BPMN instance.
 
 - 
getSplitInfospublic java.util.Collection<SplitInfo> getSplitInfos() Get the split infos.
 - 
getSplitInfopublic SplitInfo getSplitInfo(java.lang.String id) Get a specific split info, if available.
 - 
addSplitInfopublic void addSplitInfo(SplitInfo spi) Add a split info.
 - 
removeSplitInfopublic void removeSplitInfo(SplitInfo spi) Remove the split info.
 - 
removeSubcontextpublic 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.
 
 - 
removeThreadpublic void removeThread(ProcessThread thread) Remove a thread from this context.- Parameters:
- thread- The thread to be removed.
 
 - 
addThreadpublic void addThread(ProcessThread thread) Add a thread to this context.- Parameters:
- thread- The thread to be added.
 
 - 
addExternalThreadpublic void addExternalThread(ProcessThread thread) Add an external thread to this context.- Parameters:
- thread- The thread to be added.
 
 - 
getAllThreadspublic java.util.Set<ProcessThread> getAllThreads() Get all threads of the context and all subcontexts.
 - 
getParentpublic ProcessThread getParent() Get the parent. return The parent.
 - 
setParentpublic void setParent(ProcessThread parent) Set the parent.- Parameters:
- parent- The parent to set.
 
 - 
getSubthreadspublic java.util.List<ProcessThread> getSubthreads() Get the subthreads.
 - 
hasSubthreadspublic boolean hasSubthreads() Test if thread has subthreads.
 - 
isFinishedpublic boolean isFinished(java.lang.String pool, java.lang.String lane)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.
 
 - 
getExecutableThreadpublic ProcessThread getExecutableThread(java.lang.String pool, java.lang.String lane) 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).
 
 - 
getThreadpublic ProcessThread getThread(java.lang.String id) Get a thread per id.- Parameters:
- id- The thread id.
- Returns:
- The process thread.
 
 - 
getNextChildIdprotected java.lang.String getNextChildId() Get a cnt for subprocesses.
 - 
getLoopCommandpublic IResultCommand<java.lang.Boolean,java.lang.Void> getLoopCommand() Get the loopcmd.- Returns:
- The loopcmd.
 
 - 
setLoopCommandpublic void setLoopCommand(IResultCommand<java.lang.Boolean,java.lang.Void> loopcmd) Set the loopcmd.- Parameters:
- loopcmd- The loopcmd to set.
 
 - 
notifyFinishedpublic void notifyFinished() Method that can be used to determine (override) that the thread is finished.
 - 
getBpmnFeatureprotected IInternalBpmnComponentFeature getBpmnFeature(IInternalAccess ia) Get the bpmn feature.
 - 
toStringpublic java.lang.String toString() Create a string representation of this process thread.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- A string representation of this process thread.
 
 
- 
 
-