Class Process
- All Implemented Interfaces:
- HasHandlers,- HasFinishedHandlers,- HasTraceElementHandlers
- Direct Known Subclasses:
- Tour
- user interactions
- calls to DataSources (hence: any database or web service)
- arbitrary code
- other Processes
state
  across the different tasks that are executed.  This allows you to maintain context as you
  walk a user through a multi-step business process in your application, which may involve
  multiple operations on multiple entities.  Each Task that executes can use the Process state
  as inputs, and can output a result which is stored in the Process state - see
  TaskIO.
  
  A Process can have multiple branches, choosing the next Task to execute based on
 Criteria - see DecisionTask and MultiDecisionTask.
  
  Because a Process may return to a previous Task in various situations, the data model of a
  Process is strictly speaking a graph (a set of nodes connected by arbitary
  interlinks). However, most processes have sequences of several tasks in a row, and the
  definition format allows these to be represented as simple Arrays called "sequences",
 specified via sequences.  This reduces the need to
 manually specify IDs and
  interlinks for Tasks that simply proceed to the next task in a sequence.
  
  Processes follow all the standard rules for encoding as ComponentXML, however,
 note that the <Process> tag allows any kind of ProcessElement (tasks,
 decisions
  and sequences) to appear as a direct subelement of the <Process> tag without the need
  for an intervening <elements> or <sequences> tag.  The example below
  demonstrates this shorthand format.
  
  <Process ID="processId">
      <ServiceTask ID="serviceTaskId" nextElement="sequenceId" ..>
          <inputFieldList>
              <value>order.countryName</value>
          </inputFieldList>
          <outputFieldList>
              <value>order.countryName</value>
              <value>order.continent</value>
          <outputFieldList>
      </ServiceTask>
      <sequence ID="sequenceId" >
          <StateTask ../>
          <StateTask ../>
          <StateTask ../>
          <StateTask nextElement="userTaskId" ../>
      </sequence>
      <UserTask ID="userTaskId" ../>
      ...
  </Process>
  
  NOTE: you must load the standard DataBinding module before you can use Process.- 
Field SummaryFields inherited from class com.smartgwt.client.core.BaseClassconfig, configOnly, factoryCreated, factoryProperties, id, scClassName
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddFinishedHandler(FinishedHandler handler) Add a finished handler.Add a traceElement handler.create()String[]Returns a list of unique global IDs that are referenced by this process.Identifier of canvas where UI elements created by usinginline viewproperty should be added using addMember.WhendefaultWaitForor taskwaitForare set to "duration", how long should the wait be before starting the task? A task can override the default value with taskwaitDuration.Condition to wait for before each task is executed.getElement(String ID) Retrieve aProcessElementby its IDElements involved in this Process.getJsObj()Returns the task output of the last task executed.getLastTaskOutput(String taskType) Returns the task output of the last task executed.Enable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action.static ProcessgetOrCreateRef(JavaScriptObject jsObj) static ProcessgetProcess(String processId) Get a Process instance by its ID.Returns the process description as HTML.getProcessElements(String attribute) Canvas.IDof the component that manages "rule context" for which this process participates.Sequences of ProcessElements.getState()Current state of a process.getStateVariable(String stateVariablePath) Returns a variable value from theprocess state.Context object to be passed toProcess.traceElement()during process execution.If wizard is set then current workflow will be handled as wizard.booleanstatic voidloadProcess(String processId, ProcessCallback callback) protected voidonInit()voidvoidreset()Reset process to its initial state, so process can be started again.voidReset process to its initial state, so process can be started again.setAttribute(String attribute, ProcessElement[] value, boolean allowPostCreate) voidsetConfig(JavaScriptObject jsObj) setContainerId(String containerId) Identifier of canvas where UI elements created by usinginline viewproperty should be added using addMember.setDefaultWaitDuration(Integer defaultWaitDuration) WhendefaultWaitForor taskwaitForare set to "duration", how long should the wait be before starting the task? A task can override the default value with taskwaitDuration.setDefaultWaitFor(WaitForType defaultWaitFor) Condition to wait for before each task is executed.setElements(ProcessElement... elements) Elements involved in this Process.voidsetMockMode(Boolean mockMode) Enable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action.voidSets the task ID of the next task to execute after the current task finishes.voidsetNextElement(String nextElement) Sets the task ID of the next task to execute after the current task finishes.setRuleScope(String ruleScope) Canvas.IDof the component that manages "rule context" for which this process participates.setSequences(ProcessSequence... sequences) Sequences of ProcessElements.voidsetStartElement(ProcessElement startElement) setStartElement(String startElement) Current state of a process.voidsetStateVariable(String stateVariablePath, Object value) Sets aprocess statevariable for later reference withgetStateVariable()or more commonly with aTaskInputExpressionproperty.voidsetTaskOutput(ProcessElement task, Object value) Sets the task output oftaskin theprocess stateso it can be used by later tasks withgetLastTaskOutput()or more commonly with aTaskInputExpressionproperty.setTraceContext(Map traceContext) Context object to be passed toProcess.traceElement()during process execution.If wizard is set then current workflow will be handled as wizard.voidstart()Starts this task by executing thestartElement.Methods inherited from class com.smartgwt.client.core.BaseClassaddDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, asSGWTComponent, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfigOnly, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setScClassNameMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlersfireEvent
- 
Constructor Details- 
Processpublic Process()
- 
Process
 
- 
- 
Method Details- 
getOrCreateRef
- 
setJavaScriptObject- Overrides:
- setJavaScriptObjectin class- BaseClass
 
- 
create
- 
isCreatedpublic boolean isCreated()
- 
getJsObj
- 
getOrCreateJsObj- Overrides:
- getOrCreateJsObjin class- BaseClass
 
- 
setContainerIdIdentifier of canvas where UI elements created by usinginline viewproperty should be added using addMember.
- 
getContainerIdIdentifier of canvas where UI elements created by usinginline viewproperty should be added using addMember.- Returns:
- Current containerId value. Default value is null
- See Also:
 
- 
setDefaultWaitDurationWhendefaultWaitForor taskwaitForare set to "duration", how long should the wait be before starting the task? A task can override the default value with taskwaitDuration.- Parameters:
- defaultWaitDuration- New defaultWaitDuration value. Default value is "300"
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
 
- 
getDefaultWaitDurationWhendefaultWaitForor taskwaitForare set to "duration", how long should the wait be before starting the task? A task can override the default value with taskwaitDuration.- Returns:
- Current defaultWaitDuration value. Default value is "300"
 
- 
setDefaultWaitForCondition to wait for before each task is executed. TaskwaitForcan be specified for individual tasks to override this default.For a value of "duration", the delay time is set by defaultWaitDurationand can be overridden by a taskwaitDuration.Note that if defaultWaitForis set to "systemDone" and a task overrides it withwaitFor"locator", the default "systemDone" is not performed. To apply both, as might be desired, use taskwaitFor"locatorAndSystemDone".A defaultWaitForvalue of "locator" or "locatorAndSystemDone" is not valid.- Parameters:
- defaultWaitFor- New defaultWaitFor value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
 
- 
getDefaultWaitForCondition to wait for before each task is executed. TaskwaitForcan be specified for individual tasks to override this default.For a value of "duration", the delay time is set by defaultWaitDurationand can be overridden by a taskwaitDuration.Note that if defaultWaitForis set to "systemDone" and a task overrides it withwaitFor"locator", the default "systemDone" is not performed. To apply both, as might be desired, use taskwaitFor"locatorAndSystemDone".A defaultWaitForvalue of "locator" or "locatorAndSystemDone" is not valid.- Returns:
- Current defaultWaitFor value. Default value is null
 
- 
setElementsElements involved in this Process. You can also group elements intosequencesto reduce the need to explicitly define IDs for elements and interlink them.- Parameters:
- elements- New elements value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
 
- 
setMockModeEnable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action. For example, a task that would normally fail outside of its target environment can take an alternative action during testing.mockMode can also be enabled or disabled for an individual task with ProcessElement.mockMode.- Parameters:
- mockMode- New mockMode value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
 
- 
getMockModeEnable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action. For example, a task that would normally fail outside of its target environment can take an alternative action during testing.mockMode can also be enabled or disabled for an individual task with ProcessElement.mockMode.- Returns:
- Current mockMode value. Default value is null
 
- 
setRuleScopeCanvas.IDof the component that manages "rule context" for which this process participates. The rule context can be used intaskInputExpression.- Overrides:
- setRuleScopein class- BaseClass
- Parameters:
- ruleScope- New ruleScope value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
- See Also:
 
- 
getRuleScopeCanvas.IDof the component that manages "rule context" for which this process participates. The rule context can be used intaskInputExpression.- Overrides:
- getRuleScopein class- BaseClass
- Returns:
- Current ruleScope value. Default value is null
- See Also:
 
- 
setSequencesSequences of ProcessElements. By defining a sequences of elements you can make theProcessElement.nextElementimplicit.Example of using sequences: Process process = new Process(); process.setStartElement("firstSequence"); ProcessSequence innerSequence = new ProcessSequence(incTask, add2Task, incTask); process.setSequences( new ProcessSequence("firstSequence", serviceTask, multiDecisionTask), new ProcessSequence("errorFlow", failureTask, userNotifyTask) ); // standalone process elements not part of sequences process.setElements(new ServiceTask(){...}); Record state = new Record(); state.setAttribute("someField", "someValue"); process.setState(state); process.start();- Parameters:
- sequences- New sequences value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
 
- 
getSequencesSequences of ProcessElements. By defining a sequences of elements you can make theProcessElement.nextElementimplicit.Example of using sequences: Process process = new Process(); process.setStartElement("firstSequence"); ProcessSequence innerSequence = new ProcessSequence(incTask, add2Task, incTask); process.setSequences( new ProcessSequence("firstSequence", serviceTask, multiDecisionTask), new ProcessSequence("errorFlow", failureTask, userNotifyTask) ); // standalone process elements not part of sequences process.setElements(new ServiceTask(){...}); Record state = new Record(); state.setAttribute("someField", "someValue"); process.setState(state); process.start();- Returns:
- Current sequences value. Default value is null
 
- 
setStartElementThe ID of either asequenceor anelementwhich should be the starting point of the process. If not specified, the first sequence is chosen, or if there are no sequences, the first element. - log a warning and do nothing if there are neither sequences or elements- Parameters:
- startElement- New startElement value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
 
- 
getStartElementThe ID of either asequenceor anelementwhich should be the starting point of the process. If not specified, the first sequence is chosen, or if there are no sequences, the first element. - log a warning and do nothing if there are neither sequences or elements- Returns:
- Current startElement value. Default value is null
 
- 
setStateCurrent state of a process. As with Records in general, any field of a Record may contain a nested Record or Array of Records, so the process state is essentially a hierarchical data structure.Transient stateIn addition to the explicit process state there is a "transient state." The transient state represents the complete output of each of the last tasks of each type within the current process execution. This allows easy reference to the previous task output withtaskInputExpressions.
 If this method is called after the component has been drawn/initialized: Set process state for current process- Parameters:
- state- the new process state. Default value is null
- Returns:
- Processinstance, for chaining setter calls
 
- 
getStateCurrent state of a process. As with Records in general, any field of a Record may contain a nested Record or Array of Records, so the process state is essentially a hierarchical data structure.Transient stateIn addition to the explicit process state there is a "transient state." The transient state represents the complete output of each of the last tasks of each type within the current process execution. This allows easy reference to the previous task output withtaskInputExpressions.- Returns:
- Current state value. Default value is null
 
- 
setTraceContextContext object to be passed toProcess.traceElement()during process execution.Note : This is an advanced setting - Parameters:
- traceContext- New traceContext value. Default value is null
- Returns:
- Processinstance, for chaining setter calls
 
- 
getTraceContextContext object to be passed toProcess.traceElement()during process execution.- Returns:
- Current traceContext value. Default value is null
 
- 
setWizardIf wizard is set then current workflow will be handled as wizard. Every userTask will hide associated form after user finished step.- Parameters:
- wizard- New wizard value. Default value is false
- Returns:
- Processinstance, for chaining setter calls
- Throws:
- IllegalStateException- this property cannot be changed after the underlying component has been created
 
- 
getWizardIf wizard is set then current workflow will be handled as wizard. Every userTask will hide associated form after user finished step.- Returns:
- Current wizard value. Default value is false
 
- 
addFinishedHandlerAdd a finished handler.StringMethod called when a process completes, meaning the process executes a ProcessElement with no next element. - Specified by:
- addFinishedHandlerin interface- HasFinishedHandlers
- Parameters:
- handler- the finished handler
- Returns:
- HandlerRegistrationused to remove this handler
 
- 
getComponentReferencesReturns a list of unique global IDs that are referenced by this process.List is assembled by calling ProcessElement.getComponentReferences()for each task in the workflow and filtering the list to the unique component IDs.- Returns:
- array of component IDs that are referenced by this process
 
- 
getElementRetrieve aProcessElementby its ID- Parameters:
- ID- id of the process element
- Returns:
- the indicated process element, or null if no such element exists
 
- 
getLastTaskOutputReturns the task output of the last task executed. More commonly aTaskInputExpressionproperty is used (seeProcessElement.getDynamicValue()).- Returns:
- the last task output or null if none is found
 
- 
getLastTaskOutputReturns the task output of the last task executed. More commonly aTaskInputExpressionproperty is used (seeProcessElement.getDynamicValue()).- Parameters:
- taskType- the optional task type to lookup in last task output
- Returns:
- the last task output or null if none is found
 
- 
getProcessDescriptionReturns the process description as HTML.- Returns:
- the process description as HTML
 
- 
getStateVariableReturns a variable value from theprocess state. Values can be written into process state bysetStateVariable(), settingProcessElement.bindOutput, or various task output settings (SeeTaskIO.)- Parameters:
- stateVariablePath- path to variable in process state to set. segments are separated by a decimal point (.)
- Returns:
- the value found at the path
 
- 
passThruTaskOutputTakes thelast task outputand sets it as thetask outputfor thetask.This method is not just a shortcut to set output of a pass-thru task but it also records the correct schema of the passed-thru output so it can be quickly looked up. - Parameters:
- task- the workflow task setting the output (i.e. this)
 
- 
resetpublic void reset()Reset process to its initial state, so process can be started again.
- 
resetReset process to its initial state, so process can be started again.- Parameters:
- state- new state of the process
 
- 
setNextElementpublic void setNextElement()Sets the task ID of the next task to execute after the current task finishes. If the task is not found ornullis passed as the nextElement, the current process will be terminated instead.
- 
setNextElementSets the task ID of the next task to execute after the current task finishes. If the task is not found ornullis passed as the nextElement, the current process will be terminated instead.- Parameters:
- nextElement- ID of the next task execute or null to terminate process
 
- 
setStateVariableSets aprocess statevariable for later reference withgetStateVariable()or more commonly with aTaskInputExpressionproperty.- Parameters:
- stateVariablePath- path to variable in process state to set. segments are separated by a decimal point (.)
- value- the value to save
 
- 
setTaskOutputSets the task output oftaskin theprocess stateso it can be used by later tasks withgetLastTaskOutput()or more commonly with aTaskInputExpressionproperty.If the task sets bindOutputthe output value is also written into thatprocess statevariable.- Parameters:
- task- the workflow task setting the output (i.e. this)
- value- the output value for task
 
- 
startpublic void start()Starts this task by executing thestartElement. Also used by asynchronous tasks to restart the workflow.
- 
addTraceElementHandlerAdd a traceElement handler.StringMethod called during process execution before each task element is processed. - Specified by:
- addTraceElementHandlerin interface- HasTraceElementHandlers
- Parameters:
- handler- the traceElement handler
- Returns:
- HandlerRegistrationused to remove this handler
 
- 
getProcessGet a Process instance by its ID.Each process instance created that has an IDis cached for later lookup by that ID. If two processes have the same ID the last one is cached, overwriting the first. Note that the process instances are not affected - only the cache reference.- Parameters:
- processId- process ID to retrieve. See- Identifier
- Returns:
- the process, or null if not found
- See Also:
 
- 
onInitprotected void onInit()
- 
setAttribute
- 
setConfig
- 
loadProcess
- 
getProcessElements
- 
getElementsElements involved in this Process. You can also group elements intosequencesto reduce the need to explicitly define IDs for elements and interlink them.- Returns:
- ProcessElement
 
- 
setStartElement- Throws:
- IllegalStateException
- See Also:
 
 
-