com.smartgwt.client.util.workflow
Class Process

java.lang.Object
  extended by com.smartgwt.client.core.BaseClass
      extended by com.smartgwt.client.util.workflow.ProcessElement
          extended by com.smartgwt.client.util.workflow.Task
              extended by com.smartgwt.client.util.workflow.Process

public class Process
extends Task

A instance of Process represents a stateful process executing a series of Tasks, which may be:

A Process is stateful in the sense that it maintains 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 com.smartgwt.client.docs.TaskIO.

A Process can have multiple branches, choosing the next Task to execute based on Criteria - see XORGateway and DecisionGateway.

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.


Field Summary
 
Fields inherited from class com.smartgwt.client.core.BaseClass
config, id, scClassName
 
Constructor Summary
Process()
           
Process(JavaScriptObject jsObj)
           
 
Method Summary
 JavaScriptObject create()
           
 void finished(Record state)
          StringMethod called when a process completes, meaning the process executes a ProcessElement with no next element.
 ProcessElement getElement(String ID)
          Retrieve a ProcessElement by it's ID
 ProcessElement[] getElements()
          Elements involved in this Process.
static Process getOrCreateRef(JavaScriptObject jsObj)
           
 ProcessSequence[] getSequences()
          Sequences of ProcessElements.
 String getStartElement()
          The ID of either a sequence or an element which should be the starting point of the process.
 Record getState()
          Current state of a process.
protected  void onInit_Process()
           
protected  void onInit()
           
 void setElements(ProcessElement... elements)
          Elements involved in this Process.
 void setSequences(ProcessSequence... sequences)
          Sequences of ProcessElements.
 void setStartElement(ProcessElement startElement)
           
 void setStartElement(String startElement)
          The ID of either a sequence or an element which should be the starting point of the process.
 void setState(Record state)
          Current state of a process.
 void start()
          Starts this task by executing the startElement.
 
Methods inherited from class com.smartgwt.client.util.workflow.Task
getInputField, getInputFields, getOutputField, getOutputFields, setInputField, setInputFields, setOutputField, setOutputFields
 
Methods inherited from class com.smartgwt.client.util.workflow.ProcessElement
convertToJavaScriptArray, getID, getJsObj, getNextElement, getOrCreateJsObj, getProcessElements, isCreated, setAttribute, setID, setNextElement
 
Methods inherited from class com.smartgwt.client.core.BaseClass
destroy, doAddHandler, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getConfig, getHandlerCount, getRef, getScClassName, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setProperty, setProperty, setProperty, setProperty, setScClassName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Process

public Process()

Process

public Process(JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static Process getOrCreateRef(JavaScriptObject jsObj)

create

public JavaScriptObject create()
Overrides:
create in class Task

setSequences

public void setSequences(ProcessSequence... sequences)
                  throws IllegalStateException
Sequences of ProcessElements. By defining a sequences of elements you can make the nextElement implicit.

Parameters:
sequences - sequences Default value is null
Throws:
IllegalStateException - this property cannot be changed after the underlying component has been created

getSequences

public ProcessSequence[] getSequences()
Sequences of ProcessElements. By defining a sequences of elements you can make the nextElement implicit.

Returns:
ProcessSequence

setStartElement

public void setStartElement(String startElement)
                     throws IllegalStateException
The ID of either a sequence or an element which 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 - an example of how a Process would be defined
  isc.Process.create({
      startElement:"firstSequence", 
      sequences: [
          { 
             id:"firstSequence",
             elements : [
                 isc.ServiceTask.create({ .. }),
                 isc.DecisionGateway.create({ .. })
             ]
          },
          {
             id:"errorFlow",
             elements : [ ... ]
             
          }
      ],
      elements: [
         // standalone process elements not part of sequences
         isc.ServiceTask.create({ .. })
      ],
      state : {
          someField:"someValue"
      }
  })
  

Parameters:
startElement - startElement Default value is null
Throws:
IllegalStateException - this property cannot be changed after the underlying component has been created

getStartElement

public String getStartElement()
The ID of either a sequence or an element which 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 - an example of how a Process would be defined
  isc.Process.create({
      startElement:"firstSequence", 
      sequences: [
          { 
             id:"firstSequence",
             elements : [
                 isc.ServiceTask.create({ .. }),
                 isc.DecisionGateway.create({ .. })
             ]
          },
          {
             id:"errorFlow",
             elements : [ ... ]
             
          }
      ],
      elements: [
         // standalone process elements not part of sequences
         isc.ServiceTask.create({ .. })
      ],
      state : {
          someField:"someValue"
      }
  })
  

Returns:
String

setState

public void setState(Record state)
Current 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.

Parameters:
state - state Default value is null

getState

public Record getState()
Current 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.

Returns:
Record

finished

public void finished(Record state)
StringMethod called when a process completes, meaning the process executes a ProcessElement with no next element.

Parameters:
state - the final process state

getElement

public ProcessElement getElement(String ID)
Retrieve a ProcessElement by it's ID

Parameters:
ID - id of the process element
Returns:
the indicated process element, or null if no such element exists

start

public void start()
Starts this task by executing the startElement.


getElements

public ProcessElement[] getElements()
Elements involved in this Process. You can also group elements into sequences to reduce the need to explicitly define IDs for elements and interlink them.

Returns:
ProcessElement

setElements

public void setElements(ProcessElement... elements)
                 throws IllegalStateException
Elements involved in this Process. You can also group elements into sequences to reduce the need to explicitly define IDs for elements and interlink them.

Parameters:
elements - elements Default value is null
Throws:
IllegalStateException - this property cannot be changed after the underlying component has been created

setStartElement

public void setStartElement(ProcessElement startElement)
                     throws IllegalStateException
Throws:
IllegalStateException
See Also:
setStartElement(String)

onInit_Process

protected void onInit_Process()

onInit

protected void onInit()
Overrides:
onInit in class BaseClass