public class Process extends Task
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 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.
Processes follow all the standard rules for encoding as ComponentXML
, however,
note that the <Process> tag allows any kind of ProcessElement
(tasks,
gateways
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 Workflow module
Optional Modules
before you can use Process
.Modifier and Type | Class and Description |
---|---|
static interface |
Process.ProcessCallback |
config, configOnly, factoryCreated, factoryProperties, id, scClassName
Constructor and Description |
---|
Process() |
Process(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.core.client.JavaScriptObject |
create() |
void |
finished(Record state)
StringMethod called when a process completes, meaning the process executes a ProcessElement with no next element.
|
java.lang.String |
getContainerId()
Identifier of canvas where should be added UI elements created by using
inline view property. |
ProcessElement |
getElement(java.lang.String ID)
Retrieve a
ProcessElement by it's ID |
ProcessElement[] |
getElements()
Elements involved in this Process.
|
static Process |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
static Process |
getProcess(java.lang.String processId)
Get a Process instance by it's ID.
|
ProcessSequence[] |
getSequences()
Sequences of ProcessElements.
|
java.lang.String |
getStartElement()
|
Record |
getState()
Current state of a process.
|
java.lang.Boolean |
getWizard()
If wizard is set then current workflow will be handled as wizard.
|
static void |
loadProcess(java.lang.String processId,
Process.ProcessCallback callback) |
protected void |
onInit_Process() |
protected void |
onInit() |
void |
reset(Record state)
Reset process to it's initial state, so process can be started again.
|
void |
setConfig(com.google.gwt.core.client.JavaScriptObject jsObj) |
void |
setContainerId(java.lang.String containerId)
Identifier of canvas where should be added UI elements created by using
inline view property. |
void |
setElements(ProcessElement... elements)
Elements involved in this Process.
|
void |
setSequences(ProcessSequence... sequences)
Sequences of ProcessElements.
|
void |
setStartElement(ProcessElement startElement) |
void |
setStartElement(java.lang.String startElement)
|
void |
setState(Record state)
Current state of a process.
|
void |
setWizard(java.lang.Boolean wizard)
If wizard is set then current workflow will be handled as wizard.
|
void |
start()
Starts this task by executing the
startElement . |
getInputField, getInputFieldList, getOutputField, getOutputFieldList, setInputField, setInputFieldList, setOutputField, setOutputFieldList
convertToJavaScriptArray, getID, getJsObj, getNextElement, getOrCreateJsObj, getProcessElements, isCreated, setAttribute, setID, setJavaScriptObject, setNextElement
applyFactoryProperties, asSGWTComponent, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getRef, getScClassName, getTestInstance, hasAutoAssignedID, 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, setProperty, setProperty, setProperty, setProperty, setScClassName
public Process()
public Process(com.google.gwt.core.client.JavaScriptObject jsObj)
public static Process getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setContainerId(java.lang.String containerId)
inline view
property.containerId
- New containerId value. Default value is nullGlobalId
public java.lang.String getContainerId()
inline view
property.GlobalId
public void setElements(ProcessElement... elements) throws java.lang.IllegalStateException
sequences
to reduce the need to explicitly define IDs for
elements and interlink them.elements
- New elements value. Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic void setSequences(ProcessSequence... sequences) throws java.lang.IllegalStateException
ProcessElement.nextElement
implicit.
Example of using sequences:
Process process = new Process(); process.setStartElement("firstSequence"); ProcessSequence innerSequence = new ProcessSequence(incTask, add2Task, incTask); process.setSequences( new ProcessSequence("firstSequence", serviceTask, decisionGateway), 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();
sequences
- New sequences value. Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic ProcessSequence[] getSequences()
ProcessElement.nextElement
implicit.
Example of using sequences:
Process process = new Process(); process.setStartElement("firstSequence"); ProcessSequence innerSequence = new ProcessSequence(incTask, add2Task, incTask); process.setSequences( new ProcessSequence("firstSequence", serviceTask, decisionGateway), 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();
public void setStartElement(java.lang.String startElement) throws java.lang.IllegalStateException
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 elementsstartElement
- New startElement value. Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.String getStartElement()
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 elementspublic void setState(Record state)
state
- the new process state. Default value is nullpublic Record getState()
public void setWizard(java.lang.Boolean wizard) throws java.lang.IllegalStateException
wizard
- New wizard value. Default value is falsejava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getWizard()
public void finished(Record state)
state
- the final process statepublic ProcessElement getElement(java.lang.String ID)
ProcessElement
by it's IDID
- id of the process elementpublic void reset(Record state)
state
- new state of the processpublic void start()
startElement
.public static Process getProcess(java.lang.String processId)
loadProcess()
.processId
- process IDs to retrieve.
See Identifier
Identifier
public void setConfig(com.google.gwt.core.client.JavaScriptObject jsObj)
public static void loadProcess(java.lang.String processId, Process.ProcessCallback callback)
public ProcessElement[] getElements()
sequences
to reduce the need to explicitly define IDs for
elements and interlink them.public void setStartElement(ProcessElement startElement) throws java.lang.IllegalStateException
java.lang.IllegalStateException
setStartElement(String)
protected void onInit_Process()
protected void onInit()
onInit
in class ProcessElement