com.waveset.object
Class WFCase.Result

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.VariableScope
          extended bycom.waveset.object.WFCase.Result
All Implemented Interfaces:
javax.naming.Referenceable, VariableResolver, XmlObject
Enclosing class:
WFCase

public static class WFCase.Result
extends VariableScope

A class used to maintain information about the results of an execution of an Actions within an Activity.

One of these will be created for each Action defined in the Activity, both automatic and manual. For automatic actions, we simply record any action variables that the application decided to leave behind. For manual actions, we track the state of the user interaction.

A Result may contain a nested collection of Result objects if the corresponding Action used an iterator.

These will be constructed and installed on the Step object by the WorkflowExecutor. There isn't much validation going on here, we're assuming WorkflowExecutor will do the right thing. Applications are never allowed to mess with this.


Field Summary
 
Fields inherited from class com.waveset.object.VariableScope
code_id
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
WFCase.Result()
          Build an empty result object.
WFCase.Result(org.w3c.dom.Element e)
          Build a result object from XML.
 
Method Summary
 WFCase.Result addIterationResult()
          Add a new result object to the list.
 WFProcess.Action getAction()
          Get the resolved action object.
 int getActionId()
          Get the action id.
 java.lang.Object getArgument(java.lang.String name)
          Get the value of one argument.
 java.util.Map getArguments()
          Get the entire collection of action arguments.
 java.lang.String getElementName()
          Return the element name.
 int getIndex()
           
 WFCase.Result getItemResult(java.lang.String itemId)
          Locate the Result object that tracks the state of a particular work item.
 WFCase.Result getIterationResult(int index)
          Get a single iteration result.
 int getIterationResultCount()
          Get the number of iteration results.
 java.util.List getIterationResults()
          Get the nested results array.
 java.lang.Object getIterationValue(java.lang.String srcname)
           
 java.lang.Object getLocalVariable(java.lang.String name)
          Return the value of a variable defined in this scope.
 java.lang.String getName()
          Get a string describing this result.
 java.lang.String getOwner()
          Get the work item owner.
 WFCase.Result getParent()
          Get the parent result.
 VariableScope getParentScope()
          Return the parent scope.
 WFCase.Step getStep()
          Get the parent step.
 WFCase getSubCase()
          Get the subcase.
 java.util.Date getTimeout()
           
 java.lang.String getTitle()
          Get the report title
 WorkItem getWorkItem()
          Get the attached work item.
 java.lang.String getWorkItemId()
          Get the work item id.
 boolean isComplete()
          Test the completion flag.
 boolean isItemResultsPending()
          Test the work item pending results flag.
 boolean isVariableDefined(java.lang.String name)
          Test to see if a variable with a given name is defined in the scope of the result/action.
protected  void setAction(WFProcess.Action act)
          Set the resolved action object if we happen to know it.
 void setActionId(int id)
          Set the action id.
 void setArgument(java.lang.String name, java.lang.Object value)
          This should only be called by the executor as it sets up arguments.
 void setArguments(java.util.Map args)
          Set all arguments.
 void setComplete(boolean b)
          Set the completion flag.
 void setIndex(int i)
           
 void setItemResultsPending(boolean b)
          Set the pending item results flag.
 void setOwner(java.lang.String owner)
          Set the work item owner.
protected  void setParent(WFCase.Result res)
          Set the parent result.
protected  void setStep(WFCase.Step s)
          Set the parent step.
 void setSubCase(WFCase c)
          Set the subcase.
 void setTimeout(java.util.Date d)
           
 void setTitle(java.lang.String s)
          Set the report title
 void setWorkItem(WorkItem item)
          Set the attached work item.
 void setWorkItemId(java.lang.String id)
          Set the work item id.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize into a buffer with optional indentation.
 
Methods inherited from class com.waveset.object.VariableScope
assimilateLocalVariables, clearLocalVariables, expandVariables, getLocalVariables, getVariable, getVariables, getVariables, pruneGenericObjects, removeLocalVariable, resolveVariable, setLocalVariable, setLocalVariables, setVariable
 
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, toString, wait, wait, wait
 

Constructor Detail

WFCase.Result

public WFCase.Result()
Build an empty result object.


WFCase.Result

public WFCase.Result(org.w3c.dom.Element e)
              throws WavesetException
Build a result object from XML.

Method Detail

getElementName

public java.lang.String getElementName()
Description copied from class: AbstractXmlObject
Return the element name.

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

getName

public java.lang.String getName()
Get a string describing this result. No formal specification yet, used for trace messages.


getStep

public WFCase.Step getStep()
Get the parent step.


setStep

protected void setStep(WFCase.Step s)
Set the parent step. Since this can be assigned after the sub-results have been constructed, make sure the change is propagated.


getParent

public WFCase.Result getParent()
Get the parent result.


setParent

protected void setParent(WFCase.Result res)
Set the parent result.


getActionId

public int getActionId()
Get the action id.


setActionId

public void setActionId(int id)
Set the action id.


getAction

public WFProcess.Action getAction()
                           throws WavesetException
Get the resolved action object.

Throws:
WavesetException

setAction

protected void setAction(WFProcess.Action act)
Set the resolved action object if we happen to know it.


isComplete

public boolean isComplete()
Test the completion flag.


getTitle

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


setTitle

public void setTitle(java.lang.String s)
Set the report title


setComplete

public void setComplete(boolean b)
Set the completion flag.


getWorkItemId

public java.lang.String getWorkItemId()
Get the work item id.


setWorkItemId

public void setWorkItemId(java.lang.String id)
Set the work item id.


getOwner

public java.lang.String getOwner()
Get the work item owner.


setOwner

public void setOwner(java.lang.String owner)
Set the work item owner.


getWorkItem

public WorkItem getWorkItem()
Get the attached work item.


setWorkItem

public void setWorkItem(WorkItem item)
Set the attached work item.


isItemResultsPending

public boolean isItemResultsPending()
Test the work item pending results flag.


setItemResultsPending

public void setItemResultsPending(boolean b)
Set the pending item results flag.


getSubCase

public WFCase getSubCase()
Get the subcase.


setSubCase

public void setSubCase(WFCase c)
Set the subcase.


getArguments

public java.util.Map getArguments()
Get the entire collection of action arguments. This should only be used for iteration.


setArgument

public void setArgument(java.lang.String name,
                        java.lang.Object value)
This should only be called by the executor as it sets up arguments.


setArguments

public void setArguments(java.util.Map args)
Set all arguments.


getArgument

public java.lang.Object getArgument(java.lang.String name)
Get the value of one argument. Argument values cannot be set.


getItemResult

public WFCase.Result getItemResult(java.lang.String itemId)
Locate the Result object that tracks the state of a particular work item.

This may be us, or one of our nested results. And in extreme cases, we may reference a nested case.


getTimeout

public java.util.Date getTimeout()

setTimeout

public void setTimeout(java.util.Date d)

setIndex

public void setIndex(int i)

getIndex

public int getIndex()

getParentScope

public VariableScope getParentScope()
Description copied from class: VariableScope
Return the parent scope.

Specified by:
getParentScope in class VariableScope

isVariableDefined

public boolean isVariableDefined(java.lang.String name)
                          throws WavesetException
Test to see if a variable with a given name is defined in the scope of the result/action.

This is more complicated than others, because we have to pretend that the iteration variable defined in an Iterate statement is like a variable declaration for the scope.

Specified by:
isVariableDefined in class VariableScope
Throws:
WavesetException

getLocalVariable

public java.lang.Object getLocalVariable(java.lang.String name)
Return the value of a variable defined in this scope. This overloads the inherited method from VariableScope so we can resolve references to the iteration variable. Note that iteration variable references are recalculated each time rather than stored as a local binding. This is necessary to allow a subprocess to modify objects in a list of objects.

Overrides:
getLocalVariable in class VariableScope

getIterationValue

public java.lang.Object getIterationValue(java.lang.String srcname)
                                   throws WavesetException
Throws:
WavesetException

getIterationResults

public java.util.List getIterationResults()
Get the nested results array. This should be used only for iteration, don't modify the list.


getIterationResultCount

public int getIterationResultCount()
Get the number of iteration results.


getIterationResult

public WFCase.Result getIterationResult(int index)
Get a single iteration result. Convenience method to avoid casting. Assumes the caller used getIterationResultCount and does their own range checking.


addIterationResult

public WFCase.Result addIterationResult()
                                 throws WavesetException
Add a new result object to the list. Called by the executor when processing a new result, we expect to be stitched into the Process by now.

Throws:
WavesetException

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Description copied from class: AbstractXmlObject
Serialize into a buffer with optional indentation. This must be implemented by the subclass.

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