| 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.apache.lenya.workflow.impl.WorkflowInstanceImpl
public abstract class WorkflowInstanceImpl
Implementation of a workflow instance.
| Constructor Summary | |
|---|---|
protected  | 
WorkflowInstanceImpl()
Creates a new instance of WorkflowInstanceImpl.  | 
| Method Summary | |
|---|---|
 void | 
addWorkflowListener(WorkflowListener listener)
Adds a workflow listener.  | 
protected  void | 
fire(TransitionImpl transition)
Invokes a transition.  | 
 State | 
getCurrentState()
Returns the current state of this WorkflowInstance.  | 
 Event[] | 
getExecutableEvents(Situation situation)
Returns the events that can be invoked in a certain situation.  | 
protected  TransitionImpl | 
getNextTransition(Event event)
Returns the transition that would fire for a given event.  | 
protected  State | 
getState(java.lang.String id)
Returns a workflow state for a given name.  | 
 boolean | 
getValue(java.lang.String variableName)
Returns the current value of a variable.  | 
protected  BooleanVariableInstance | 
getVariableInstance(BooleanVariable variable)
Returns the corresponding instance of a workflow variable.  | 
 Workflow | 
getWorkflow()
Returns the workflow object of this instance.  | 
protected abstract  WorkflowImpl | 
getWorkflow(java.lang.String workflowName)
Factory method to create a workflow object for a given identifier.  | 
protected  WorkflowImpl | 
getWorkflowImpl()
Returns the workflow object of this instance.  | 
protected  void | 
initVariableInstances()
Initializes the variable instances in the initial state.  | 
 void | 
invoke(Situation situation,
       Event event)
Invoke an event on this workflow instance.  | 
 boolean | 
isSynchronized(Event event)
Returns if the transition for a certain event is synchronized.  | 
 void | 
removeWorkflowListener(WorkflowListener listener)
Removes a workflow listener.  | 
protected  void | 
setCurrentState(State state)
Sets the current state of this instance.  | 
protected  void | 
setValue(java.lang.String variableName,
         boolean value)
Sets the value of a state variable.  | 
protected  void | 
setWorkflow(java.lang.String workflowName)
Sets the workflow of this instance.  | 
protected  void | 
setWorkflow(WorkflowImpl workflow)
Sets the workflow of this instance.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
protected WorkflowInstanceImpl()
| Method Detail | 
|---|
public Workflow getWorkflow()
getWorkflow in interface WorkflowInstanceprotected WorkflowImpl getWorkflowImpl()
public Event[] getExecutableEvents(Situation situation)
                            throws WorkflowException
getExecutableEvents in interface WorkflowInstancesituation - The situation to check.
WorkflowException - when something went wrong.
public void invoke(Situation situation,
                   Event event)
            throws WorkflowException
invoke in interface WorkflowInstancesituation - The situation when the event was invoked.event - The event that was invoked.
WorkflowException - when the event may not be invoked.
protected TransitionImpl getNextTransition(Event event)
                                    throws WorkflowException
event - The event.
WorkflowException - if no single transition would fire.
protected void fire(TransitionImpl transition)
             throws WorkflowException
transition - The transition to invoke.
WorkflowException - if something goes wrong.protected void setCurrentState(State state)
state - The state to set.public State getCurrentState()
getCurrentState in interface WorkflowInstanceprotected void setWorkflow(WorkflowImpl workflow)
workflow - A workflow object.
protected void setWorkflow(java.lang.String workflowName)
                    throws WorkflowException
workflowName - The identifier of the workflow.
WorkflowException - if something goes wrong.
protected abstract WorkflowImpl getWorkflow(java.lang.String workflowName)
                                     throws WorkflowException
workflowName - The workflow identifier.
WorkflowException - when the workflow could not be created.
protected State getState(java.lang.String id)
                  throws WorkflowException
id - The state id.
WorkflowException - when the state was not found.protected void initVariableInstances()
protected BooleanVariableInstance getVariableInstance(BooleanVariable variable)
                                               throws WorkflowException
variable - A variable of the corresponding workflow.
WorkflowException - when the variable instance was not found.
public boolean getValue(java.lang.String variableName)
                 throws WorkflowException
WorkflowInstance
getValue in interface WorkflowInstancevariableName - A variable name.
WorkflowException - when the variable does not exist.WorkflowInstance.getValue(java.lang.String)
protected void setValue(java.lang.String variableName,
                        boolean value)
                 throws WorkflowException
variableName - The variable name.value - The value to set.
WorkflowException - when the variable was not found.public void addWorkflowListener(WorkflowListener listener)
WorkflowInstance
addWorkflowListener in interface WorkflowInstancelistener - The listener to add.WorkflowInstance.addWorkflowListener(org.apache.lenya.workflow.WorkflowListener)public void removeWorkflowListener(WorkflowListener listener)
WorkflowInstance
removeWorkflowListener in interface WorkflowInstancelistener - The listener to remove.WorkflowInstance.removeWorkflowListener(org.apache.lenya.workflow.WorkflowListener)
public boolean isSynchronized(Event event)
                       throws WorkflowException
WorkflowInstance
isSynchronized in interface WorkflowInstanceevent - An event.
WorkflowExceptionWorkflowInstance.isSynchronized(org.apache.lenya.workflow.Event)
  | 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||