|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.util.AbstractXmlObject
com.waveset.object.VariableScope
com.waveset.object.WFCase
A class used to represent extended state for TaskInstance objects assocated with workflow processes.
A case can be considered an instance of a Process, it maintains runtime state as the process is executed, and holds results after the process has completed.
The case maintains a list of "steps" which hold the state of one execution of an Activity defined in the process. You can think of a Step as an instance of an Activity. Workflow literature usually refers to these as "Activity Instances" but that turns out to be very awkward to type, so I chose Step. So there.
Earlier implementations called these objects "Tasks" but the name was changed to avoid confusion with the new background task management system.
Each step may contain one or more Result objects which hold the results of the Actions defined in the Activity. If an action used an "iteration", the result may be an aggregate result, which points to other Result objects.
WFCase and its inner classes extend VariableScope to maintain a hierarchy of variable bindings. VariableScope extends AbstractXmlObject so we can also serizlize oursleves.
Nested Class Summary | |
static class |
WFCase.Result
A class used to maintain information about the results of an execution of an Actions within an Activity. |
static class |
WFCase.Step
A class used to represent the execution state of an Activity from the process definition. |
Field Summary | |
static java.lang.String |
code_id
|
static java.lang.String |
ELEMENT
Our XML element. |
Fields inherited from class com.waveset.util.AbstractXmlObject |
_trace |
Constructor Summary | |
WFCase()
No-arg constructor. |
|
WFCase(org.w3c.dom.Element e)
Construct a case from an XML element. |
Method Summary | |
void |
addAutoTransition(java.lang.String to)
|
void |
addInvalidWorkItem(java.lang.String id)
|
void |
addNewWorkItem(WorkItem item)
|
WFCase.Step |
addStep(WFProcess.Activity activity)
Add a new step for a process activity. |
WFCase |
findCase(java.lang.String name)
Look for a case with the given name. |
WFCase.Step |
findJoinStep(WFProcess.Activity activity)
Given an Activity, find a corresponding Step. |
WSAttribute |
getAttributeValues(java.lang.String attrName)
Add any attribute values
that this object may have for the specified attribute. |
java.lang.String |
getElementName()
Get the XML element name. |
long |
getEndDate()
|
int |
getFirstStep()
Get the index of the first active step. |
java.util.List |
getInvalidWorkItems()
|
WFCase.Result |
getItemResult(java.lang.String itemId)
Locate the Result object that tracks the state of a particular work item. |
java.lang.String |
getName()
Get the case name. |
java.util.List |
getNewWorkItems()
|
java.util.Date |
getNextTimeout()
Walk over the case returning the next timeout event. |
java.lang.Object |
getOwner()
Get the owning object. |
WFCase.Result |
getParent()
Get the parent Result object for subcases. |
VariableScope |
getParentScope()
Return the parent scope. |
WFProcess |
getProcess()
Get the process definition. |
WFProcess |
getProcess(LighthouseContext context,
ObjectRef ref,
boolean raiseError)
Attempt to fetch an external process given an object reference. |
ObjectRef |
getProcessRef()
Get the reference to the external process definition. |
WavesetResult |
getResult()
|
WFCase |
getRootCase()
Get the root case. |
long |
getStartDate()
|
WFCase.Step |
getStartStep()
Gets the start step for this case. |
WFCase.Step |
getStep(int index)
Get a step given its index. |
int |
getStepCount()
Get the number of steps in the process. |
java.util.ArrayList |
getSteps()
Get the step list. |
java.lang.String |
getTitle()
Get the case title. |
java.util.List |
getWorkItems()
Walk over the case returning a list of all WFCase.Result objects contained within that have corresponding WorkItem objects in the repository. |
boolean |
isAutoTransitioned(java.lang.String name)
Return true if we've taken an automatic transition to the named activity. |
boolean |
isComplete()
Tests the case completion flag. |
boolean |
isPending()
Test the pending status of the case. |
boolean |
isTerminated()
|
boolean |
isVariableDefined(java.lang.String name)
Test to see if the variable is defined in this scope. |
void |
listQueryableAttributes(java.util.List qattrs)
Add any defined attributes
that this type of PersistentObject may expose 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 may expose 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 case. |
void |
removeNewWorkItem(WorkItem item)
|
void |
resolveProcessDefinitions(LighthouseContext context)
Recursivly walk over the active cases resolving the references to their process definitons. |
void |
setComplete(boolean b)
Set the case completion flag. |
void |
setEndDate()
|
void |
setFirstStep(int index)
Set the index of the first active activity. |
void |
setInvalidWorkItems(java.util.List items)
|
void |
setName(java.lang.String name)
Set the case name. |
void |
setNewWorkItems(java.util.List items)
|
void |
setOwner(java.lang.Object o)
Allows the extension to keep a back pointer to its container. |
void |
setParent(WFCase.Result res)
Set the parent Result object for subcases. |
void |
setProcess(WFProcess p)
Set the process definition. |
void |
setProcessRef(ObjectRef ref)
Set the external process definition reference. |
void |
setResult(WavesetResult r)
|
void |
setStartDate()
|
void |
setTerminated(boolean b)
|
void |
setTitle(java.lang.String s)
|
void |
toXml(java.lang.StringBuffer b,
int indent)
Emit the XML representation of the case. |
Methods inherited from class com.waveset.object.VariableScope |
assimilateLocalVariables, clearLocalVariables, expandVariables, getLocalVariable, 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 |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String ELEMENT
Constructor Detail |
public WFCase()
public WFCase(org.w3c.dom.Element e) throws WavesetException
Method Detail |
public void setResult(WavesetResult r)
public void setTerminated(boolean b)
public void setInvalidWorkItems(java.util.List items)
public void addInvalidWorkItem(java.lang.String id)
public void setNewWorkItems(java.util.List items)
public void addNewWorkItem(WorkItem item)
public void removeNewWorkItem(WorkItem item)
public void addAutoTransition(java.lang.String to)
public void setOwner(java.lang.Object o)
Extension
setOwner
in interface Extension
public void listQueryableAttributes(java.util.List qattrs)
defined attributes
that this type of PersistentObject may expose as queryable attributes
(regardless of whether this object has a value for each).
listQueryableAttributes
in interface Extension
public void listSummaryAttributes(java.util.List sattrs)
defined attributes
that this type of PersistentObject may expose as summary attributes
(regardless of whether this object has a value for each).
listSummaryAttributes
in interface Extension
public WSAttribute getAttributeValues(java.lang.String attrName)
attribute values
that this object may have for the specified attribute.
getAttributeValues
in interface Extension
attribute values
that the extension may have for the specified attribute.public java.lang.String getElementName()
getElementName
in interface XmlObject
getElementName
in class AbstractXmlObject
public java.lang.Object getOwner()
getOwner
in interface Extension
public ObjectRef getProcessRef()
public void setProcessRef(ObjectRef ref)
public WFProcess getProcess()
public void setProcess(WFProcess p)
public WFCase.Result getParent()
public void setParent(WFCase.Result res)
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getTitle()
public void setTitle(java.lang.String s)
public WFCase getRootCase() throws InternalError
InternalError
public boolean isPending()
public boolean isComplete()
public void setComplete(boolean b)
public boolean isTerminated()
public WavesetResult getResult()
public java.util.List getInvalidWorkItems()
public java.util.List getNewWorkItems()
public WFCase findCase(java.lang.String name)
public boolean isAutoTransitioned(java.lang.String name)
public void resolveProcessDefinitions(LighthouseContext context) throws WavesetException
WavesetException
public WFProcess getProcess(LighthouseContext context, ObjectRef ref, boolean raiseError) throws WavesetException
WavesetException
public VariableScope getParentScope()
getParentScope
in class VariableScope
public boolean isVariableDefined(java.lang.String name) throws WavesetException
isVariableDefined
in class VariableScope
WavesetException
public java.util.ArrayList getSteps()
public int getFirstStep()
public void setFirstStep(int index)
public int getStepCount()
public WFCase.Step getStep(int index)
public WFCase.Step getStartStep() throws WavesetException
WavesetException
public WFCase.Step addStep(WFProcess.Activity activity) throws WavesetException
WavesetException
public WFCase.Result getItemResult(java.lang.String itemId)
This got a lot more complicated now that we support subprocesses. Lacking any nice search structure, we have to traverse the whole damn thing looking for Result objects that have a reference to the repository ID of this work item. For small cases this shouldn't be that expensive, but we obviously should consider a faster way of storing this association.
public WFCase.Step findJoinStep(WFProcess.Activity activity)
We just do a linear search from the base of the active step list. This isn't terribly effecient, but the join step should trickle down toward the bottom of the list.
Here is is the crux of the "case thread" problem. We could support multiple threads through the process by dynamically allocating tasks as we do now, keeping a thread counter on the task, and "spawning" another thread every time we take an AND SPLIT. Each Join task would then have to be referenced by both activity index and thread counter.
Need to study the WfmC spec on case threads.
public java.util.List getWorkItems()
Added for the report generator, may have other uses.
public java.util.Date getNextTimeout()
public void setStartDate()
public long getStartDate()
public void setEndDate()
public long getEndDate()
public void toXml(java.lang.StringBuffer b, int indent)
toXml
in interface XmlObject
toXml
in class AbstractXmlObject
public void parseXml(org.w3c.dom.Element e) throws WavesetException
WavesetException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |