com.waveset.object
Class WFProcess

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.WorkflowComponent
          extended bycom.waveset.object.WFProcess
All Implemented Interfaces:
Extension, com.sun.idm.debugger.common.Locatable, javax.naming.Referenceable, XmlObject

public class WFProcess
extends WorkflowComponent
implements Extension

A class that represents a workflow process definition.


Nested Class Summary
static class WFProcess.Action
          Actions are descriptions of an operation that is performed within an Activity.
static class WFProcess.ActionResult
          A class used to define the effect an Action will have on the WavesetResult object maintained for this process.
static class WFProcess.Activity
          An Activity represents one "state" in the process.
static class WFProcess.Argument
          A class representing an argument to an Action.
static class WFProcess.Editor
          State related to the workflow process editor.
static class WFProcess.Iteration
          A class used to define iteration parameters for an Action.
static class WFProcess.Return
          A class used to represent a return value from an Action.
static class WFProcess.Transition
          A class used to represent a transition from one activity to the another.
 
Field Summary
static java.lang.String ATT_AUDIT
           
static java.lang.String ATT_MAX_STEPS
           
static java.lang.String ATT_NAME
           
static java.lang.String ATT_TITLE
           
static java.lang.String ATT_TRACE
           
static java.lang.String code_id
           
static java.lang.String EL_COMMENTS
           
static java.lang.String EL_REPORT_TITLE
           
static java.lang.String EL_STATUS_EXPRESSION
           
static java.lang.String ELEMENT
          Our XML element.
static java.lang.String END_ACTIVITY_NAME
          The wired in name of the end node.
static java.lang.String START_ACTIVITY_NAME
          The wired in name of the start node.
static java.lang.String VAR_ACTION_ERROR
          A variable in the scope of the Action that will be set to "true" if the previously executed action returned a result containing an error or threw an exception.
static java.lang.String VAR_ACTION_RESULT
          A variable in the scope of the Action that will be set to the WavesetResult object returned by the last action.
static java.lang.String VAR_ACTION_SUPPRESSED
          A variable in the scope of the Action that will be set to the string "true" if the action was suppressed due to a expression yielding false.
static java.lang.String VAR_ACTION_TIMEOUT
          A variable in the scope of the Action that will be set to "true" if the previously executed action timed out.
static java.lang.String VAR_APPLICATION
          A variable containing the name of the "application" that launched the workflow task.
static java.lang.String VAR_CASE_OWNER
          A variable in the scope of the root WFProcess that will contain the name of the administrator that launched the workflow task.
static java.lang.String VAR_CASE_RESULT
          A variable in the scope of the root WFProcess/WFCase that will contain the WavesetResult of the TaskInstance.
static java.lang.String VAR_CASE_TERMINATED
          A variable to indicate that the we've been requested to be terminated.
static java.lang.String VAR_CONTEXT
          A variable in the scope of the root WFProcess/WFCase that will contain a WorkflowContext object (the implementation of which happens to be this WorkflowExecutor).
static java.lang.String VAR_TRACE
          A built-in variable that causes trace message to be accumulated.
static java.lang.String VAR_TRANSACTION_SIGNATURE
          A SignedData object which comes back from the manual action form.
static java.lang.String WF_AUDIT
          A variable to determine if auditing should be performed
static java.lang.String WF_AUDIT_ATTR_ACTIVITY
           
static java.lang.String WF_AUDIT_ATTR_COND
           
static java.lang.String WF_AUDIT_ATTR_INSTANCEID
           
static java.lang.String WF_AUDIT_ATTR_MATCH
           
static java.lang.String WF_AUDIT_ATTR_ORGANIZATION
           
static java.lang.String WF_AUDIT_ATTR_PROCESS
           
static java.lang.String WF_AUDIT_ATTR_WORKFLOW
           
static java.lang.String WF_AUDIT_ATTRIBUTES
          A variable that holds the attributes the workflow should store for audit events
static java.lang.String WF_AUDIT_OBJECT_TYPE
           
 
Constructor Summary
WFProcess()
          Build an empty process object.
WFProcess(org.w3c.dom.Element e)
          Build a process object from its XML representation.
 
Method Summary
 WFProcess.Activity[] getActivities()
          Get the list of activity definitions.
 WFProcess.Activity getActivity(int id)
          Get an activity with a given id.
 WFProcess.Activity getActivity(java.lang.String name)
          Find an activity by name.
 int[] getActivityFeeds(int id)
          Calculate a "feed list" of activities that transition into another activity.
 WSAttribute getAttributeValues(java.lang.String attrName)
          Add any attribute values that this object may have for the specified attribute.
 java.lang.String getComments()
           
 WFProcess.Activity getEffectiveStartActivity()
          Locate the effective starting activity for a process.
 java.lang.String getElementName()
          Get our XML element name.
 int getMaxSteps()
           
 java.lang.Object getOwner()
           
 WFProcess getParent()
          Get the parent process (null if this is the root process).
 WFProcess.Activity getStartActivity()
          Get the activity named "start".
 ExNode getStatusExpression()
          Get the status expression
 WFProcess getSubProcess(java.lang.String name)
          Get a subprocess definition with a given name.
 WFProcess[] getSubProcesses()
          Get the list of subprocess definitions.
 java.lang.String getTitle()
          Get the process report title.
 ExNode getTitleExpression()
          Get the process title expression.
 java.lang.String getTrace()
           
 WFProcess.Transition[] getTransitions()
           
 Variable getVariable(java.lang.String name)
          Get the declaration of a variable by name.
 Variable[] getVariables()
          Get the list of process variables.
 boolean isAudit()
           
 void listQueryableAttributes(java.util.List qattrs)
          Add any defined attributes that this type of PersistentObject exposes as queryable attributes (regardless of whether this object has a value for each).
 void listSummaryAttributes(java.util.List sattrs)
          Add any defined attributes that this type of PersistentObject exposes as summary attributes (regardless of whether this object has a value for each).
 void parseXml(org.w3c.dom.Element e)
          Parse the XML representation of the process definition.
 void setActivities(WFProcess.Activity[] acts)
           
 void setAudit(boolean b)
           
 void setComments(java.lang.String s)
           
 void setMaxSteps(int maxSteps)
          Sets maximum number of steps to be taken.
 void setOwner(java.lang.Object o)
          Allows the extension to keep a back pointer to its container.
 void setParent(WFProcess p)
          Set the parent process (if this is a subprocess).
 void setStatusExpression(ExNode node)
           
 void setSubProcesses(WFProcess[] processes)
           
 void setTitle(java.lang.String s)
           
 void setTitleExpression(ExNode node)
           
 void setTrace(java.lang.String destination)
          Set the trace option.
 void setTransitions(WFProcess.Transition[] trans)
           
 void setVariables(Variable[] vars)
           
 java.lang.String toString()
           
 void toXml(java.lang.StringBuffer b, int indent)
          Emit the XML representation of the process definition.
 
Methods inherited from class com.waveset.object.WorkflowComponent
addCommonAttributes, getLocation, getName, getParentComponent, parseCommonAttributes, setLocation, setName, setParentComponent
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

VAR_TRACE

public static final java.lang.String VAR_TRACE
A built-in variable that causes trace message to be accumulated. Unlike the others this is not set by the engine, it must be declared in the root WFProcess and set to "true" if you want to enable trace. The value may be "console" for console trace, otherwise it is considered the name of a file.

See Also:
Constant Field Values

VAR_APPLICATION

public static final java.lang.String VAR_APPLICATION
A variable containing the name of the "application" that launched the workflow task. This is expected to be taken from the Session.getApplication() method and stored here. This should be passed to AuditApplication.

See Also:
Constant Field Values

VAR_CASE_OWNER

public static final java.lang.String VAR_CASE_OWNER
A variable in the scope of the root WFProcess that will contain the name of the administrator that launched the workflow task.

See Also:
Constant Field Values

VAR_ACTION_TIMEOUT

public static final java.lang.String VAR_ACTION_TIMEOUT
A variable in the scope of the Action that will be set to "true" if the previously executed action timed out.

As a convenience, this variable will also be set in the scope of the containing Activity so you can test it in a transition condition without having to declare an Activity Variable and use an Action Return. Note though that the Activity binding will be reset after every action, so if the Activity has more than one Action and you don't want to test the status of the last action, you will have to save this in an Activity Varaible.

See Also:
Constant Field Values

VAR_ACTION_ERROR

public static final java.lang.String VAR_ACTION_ERROR
A variable in the scope of the Action that will be set to "true" if the previously executed action returned a result containing an error or threw an exception.

As a convenience, this variable will also be set in the scope of the containing Activity so you can test it in a transition condition without having to declare an Activity Variable and use an Action Return. Note though that the Activity binding will be reset after every action, so if the Activity has more than one Action and you don't want to test the status of the last action, you will have to save this in an Activity Varaible.

See Also:
Constant Field Values

VAR_ACTION_RESULT

public static final java.lang.String VAR_ACTION_RESULT
A variable in the scope of the Action that will be set to the WavesetResult object returned by the last action. Normally you don't need to reference this since the action result is by default assimilated into the task result, but there may be times when you need to get ahold of it for further processing.

Unlike some other WF_ACTION_ variables, we don't also bind this in the scope of the containing Activity. This variable is seldom used, and we don't need to clutter up the TaskInstance and trace with a duplicated result object. If you want this outside of the Action, declare an Activity Variable and use an Action Return.

See Also:
Constant Field Values

VAR_ACTION_SUPPRESSED

public static final java.lang.String VAR_ACTION_SUPPRESSED
A variable in the scope of the Action that will be set to the string "true" if the action was suppressed due to a expression yielding false.

As a convenience, this variable will also be set in the scope of the containing Activity so you can test it in a transition condition without having to declare an Activity Variable and use an Action Return. Note though that the Activity binding will be reset after every action, so if the Activity has more than one Action and you don't want to test the status of the last action, you will have to save this in an Activity Varaible.

See Also:
Constant Field Values

VAR_CONTEXT

public static final java.lang.String VAR_CONTEXT
A variable in the scope of the root WFProcess/WFCase that will contain a WorkflowContext object (the implementation of which happens to be this WorkflowExecutor).

This can be used in Actions implemented in XPRESS or Javascript in order to get ahold of the WorkflowContext. For Actions implemented as WorkflowApplication classes, the context is passed in.

This is actually not stored as a variable, we simply recognize it in ExpressionState.resolveReference. It cannot be set.

See Also:
Constant Field Values

VAR_CASE_RESULT

public static final java.lang.String VAR_CASE_RESULT
A variable in the scope of the root WFProcess/WFCase that will contain the WavesetResult of the TaskInstance.

This can be used in Actions implemented in XPRESS or Javascript in order to get ahold of the result. For Actions implemented as WorkflowApplication classes, they can obtain the result through the WorkflowContext. Since the entire WorkflowContext is exposed through the WF_CONTEXT variable, this isn't absolutely necessary, but it's a convenience.

This is actually not stored as a variable, we simply recognize it in ExpressionState.resolveReference. It cannot be set.

See Also:
Constant Field Values

VAR_CASE_TERMINATED

public static final java.lang.String VAR_CASE_TERMINATED
A variable to indicate that the we've been requested to be terminated.

See Also:
Constant Field Values

WF_AUDIT_ATTRIBUTES

public static final java.lang.String WF_AUDIT_ATTRIBUTES
A variable that holds the attributes the workflow should store for audit events

See Also:
Constant Field Values

WF_AUDIT

public static final java.lang.String WF_AUDIT
A variable to determine if auditing should be performed

See Also:
Constant Field Values

WF_AUDIT_OBJECT_TYPE

public static final java.lang.String WF_AUDIT_OBJECT_TYPE
See Also:
Constant Field Values

WF_AUDIT_ATTR_WORKFLOW

public static final java.lang.String WF_AUDIT_ATTR_WORKFLOW
See Also:
Constant Field Values

WF_AUDIT_ATTR_INSTANCEID

public static final java.lang.String WF_AUDIT_ATTR_INSTANCEID
See Also:
Constant Field Values

WF_AUDIT_ATTR_PROCESS

public static final java.lang.String WF_AUDIT_ATTR_PROCESS
See Also:
Constant Field Values

WF_AUDIT_ATTR_ACTIVITY

public static final java.lang.String WF_AUDIT_ATTR_ACTIVITY
See Also:
Constant Field Values

WF_AUDIT_ATTR_MATCH

public static final java.lang.String WF_AUDIT_ATTR_MATCH
See Also:
Constant Field Values

WF_AUDIT_ATTR_COND

public static final java.lang.String WF_AUDIT_ATTR_COND
See Also:
Constant Field Values

WF_AUDIT_ATTR_ORGANIZATION

public static final java.lang.String WF_AUDIT_ATTR_ORGANIZATION
See Also:
Constant Field Values

VAR_TRANSACTION_SIGNATURE

public static final java.lang.String VAR_TRANSACTION_SIGNATURE
A SignedData object which comes back from the manual action form. This variable has special meaning to the workflow framework since the WorkItemViewer/WorkItemListViewers look for this variable and validate it upon view commit. Other than that, it's just a normal workflow variable.

See Also:
Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
Our XML element.

See Also:
Constant Field Values

START_ACTIVITY_NAME

public static final java.lang.String START_ACTIVITY_NAME
The wired in name of the start node.

See Also:
Constant Field Values

END_ACTIVITY_NAME

public static final java.lang.String END_ACTIVITY_NAME
The wired in name of the end node.

See Also:
Constant Field Values

ATT_NAME

public static final java.lang.String ATT_NAME
See Also:
Constant Field Values

ATT_TITLE

public static final java.lang.String ATT_TITLE
See Also:
Constant Field Values

ATT_TRACE

public static final java.lang.String ATT_TRACE
See Also:
Constant Field Values

EL_REPORT_TITLE

public static final java.lang.String EL_REPORT_TITLE
See Also:
Constant Field Values

EL_COMMENTS

public static final java.lang.String EL_COMMENTS
See Also:
Constant Field Values

ATT_MAX_STEPS

public static final java.lang.String ATT_MAX_STEPS
See Also:
Constant Field Values

ATT_AUDIT

public static final java.lang.String ATT_AUDIT
See Also:
Constant Field Values

EL_STATUS_EXPRESSION

public static final java.lang.String EL_STATUS_EXPRESSION
See Also:
Constant Field Values
Constructor Detail

WFProcess

public WFProcess()
Build an empty process object. // * Shouldn't use this, but XmlObject requries it.


WFProcess

public WFProcess(org.w3c.dom.Element e)
          throws WavesetException
Build a process object from its XML representation.

Method Detail

toString

public java.lang.String toString()

setOwner

public void setOwner(java.lang.Object o)
Description copied from interface: Extension
Allows the extension to keep a back pointer to its container.

Specified by:
setOwner in interface Extension

getOwner

public java.lang.Object getOwner()
Specified by:
getOwner in interface Extension

listQueryableAttributes

public void listQueryableAttributes(java.util.List qattrs)
Add any defined attributes that this type of PersistentObject exposes as queryable attributes (regardless of whether this object has a value for each).

Specified by:
listQueryableAttributes in interface Extension

listSummaryAttributes

public void listSummaryAttributes(java.util.List sattrs)
Add any defined attributes that this type of PersistentObject exposes as summary attributes (regardless of whether this object has a value for each).

Specified by:
listSummaryAttributes in interface Extension

getAttributeValues

public WSAttribute getAttributeValues(java.lang.String attrName)
Add any attribute values that this object may have for the specified attribute.

Specified by:
getAttributeValues in interface Extension
Returns:
any attribute values that the extension may have for the specified attribute.

getElementName

public java.lang.String getElementName()
Get our XML element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

setMaxSteps

public void setMaxSteps(int maxSteps)
Sets maximum number of steps to be taken. If zero, WorkflowEngine will default to that specified in SystemConfiguration.


getMaxSteps

public int getMaxSteps()

setAudit

public void setAudit(boolean b)

isAudit

public boolean isAudit()

setTrace

public void setTrace(java.lang.String destination)
Set the trace option. The value may be "console" to trace to the console, or the name of an output file.


getTrace

public java.lang.String getTrace()

getTitle

public java.lang.String getTitle()
Get the process report title.


setTitle

public void setTitle(java.lang.String s)

getTitleExpression

public ExNode getTitleExpression()
Get the process title expression.


setTitleExpression

public void setTitleExpression(ExNode node)

getStatusExpression

public ExNode getStatusExpression()
Get the status expression


setStatusExpression

public void setStatusExpression(ExNode node)

getParent

public WFProcess getParent()
Get the parent process (null if this is the root process).


setParent

public void setParent(WFProcess p)
Set the parent process (if this is a subprocess).


setComments

public void setComments(java.lang.String s)

getComments

public java.lang.String getComments()

getTransitions

public WFProcess.Transition[] getTransitions()

setTransitions

public void setTransitions(WFProcess.Transition[] trans)

getVariables

public Variable[] getVariables()
Get the list of process variables. Should be used only for iteration, do not modify this list. // * Is this necessary?


setVariables

public void setVariables(Variable[] vars)

getActivities

public WFProcess.Activity[] getActivities()
Get the list of activity definitions.


setActivities

public void setActivities(WFProcess.Activity[] acts)

getSubProcesses

public WFProcess[] getSubProcesses()
Get the list of subprocess definitions.


setSubProcesses

public void setSubProcesses(WFProcess[] processes)

getActivity

public WFProcess.Activity getActivity(int id)
Get an activity with a given id. The id happens to be an array index, but keep that hidden.


getActivity

public WFProcess.Activity getActivity(java.lang.String name)
Find an activity by name. Helper for postProcess.


getStartActivity

public WFProcess.Activity getStartActivity()
Get the activity named "start". This was formerly required in all process definitions. In V4 we started allowing the effective start activity to be the first one with no inbound transitions. See getEffectiveStartActivity.


getActivityFeeds

public int[] getActivityFeeds(int id)
Calculate a "feed list" of activities that transition into another activity. The activities are referenced through their id numbers. This is calculated on the fly so we don't have to keep them in sync when the activities or transitions change. This is used by the workflow executor when it gets ready to start processing an AND-Join. // *

// * This isn't terribly effecient, but it shouldn't be called that often.


getSubProcess

public WFProcess getSubProcess(java.lang.String name)
Get a subprocess definition with a given name. Proably should give these ids like the rest of them, but there will be comparitivily few.

We can't easily prevent these from being nested, but I don't want to maintain name scopes here. Always search the entire tree of process definitions.


getVariable

public Variable getVariable(java.lang.String name)
Get the declaration of a variable by name. Used by VariableScope implementations over in the Case object, to see who defines the variable.

We're not expecting to have many of these, so we'll just do a linear search.


getEffectiveStartActivity

public WFProcess.Activity getEffectiveStartActivity()
                                             throws WavesetException
Locate the effective starting activity for a process. Originally we required an explicit activity named "start", now if the start activity can be located unambiguously we'll automatically select one. This is more convenient for simple workflows. We'll take it a step further and even if there is an ambiguous start activity we'll take the first eligible one. Eligibility is defined as any activity that has no inbound transitions, either from another activity, or an auto-transition.

Throws:
WavesetException

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Emit the XML representation of the process definition.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject

parseXml

public void parseXml(org.w3c.dom.Element e)
              throws WavesetException
Parse the XML representation of the process definition.

Throws:
WavesetException