Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.lenya.workflow.impl
Class WorkflowInstanceImpl  view WorkflowInstanceImpl download WorkflowInstanceImpl.java

java.lang.Object
  extended byorg.apache.lenya.workflow.impl.WorkflowInstanceImpl
All Implemented Interfaces:
org.apache.lenya.workflow.WorkflowInstance

public abstract class WorkflowInstanceImpl
extends java.lang.Object
implements org.apache.lenya.workflow.WorkflowInstance

Implementation of a workflow instance.


Field Summary
private  org.apache.lenya.workflow.State currentState
           
private  java.util.List listeners
           
private static org.apache.log4j.Category log
           
private  java.util.Map variableInstances
           
private  WorkflowImpl workflow
           
 
Constructor Summary
protected WorkflowInstanceImpl()
          Creates a new instance of WorkflowInstanceImpl.
 
Method Summary
 void addWorkflowListener(org.apache.lenya.workflow.WorkflowListener listener)
          Adds a workflow listener.
protected  void fire(TransitionImpl transition)
          Invokes a transition.
 org.apache.lenya.workflow.State getCurrentState()
          Returns the current state of this WorkflowInstance.
 org.apache.lenya.workflow.Event[] getExecutableEvents(org.apache.lenya.workflow.Situation situation)
          Returns the events that can be invoked in a certain situation.
protected  TransitionImpl getNextTransition(org.apache.lenya.workflow.Event event)
          Returns the transition that would fire for a given event.
protected  org.apache.lenya.workflow.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  org.apache.lenya.workflow.BooleanVariableInstance getVariableInstance(org.apache.lenya.workflow.BooleanVariable variable)
          Returns the corresponding instance of a workflow variable.
 org.apache.lenya.workflow.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(org.apache.lenya.workflow.Situation situation, org.apache.lenya.workflow.Event event)
          Invoke an event on this workflow instance.
 boolean isSynchronized(org.apache.lenya.workflow.Event event)
          Returns if the transition for a certain event is synchronized.
 void removeWorkflowListener(org.apache.lenya.workflow.WorkflowListener listener)
          Removes a workflow listener.
protected  void setCurrentState(org.apache.lenya.workflow.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
 

Field Detail

log

private static final org.apache.log4j.Category log

workflow

private WorkflowImpl workflow

currentState

private org.apache.lenya.workflow.State currentState

variableInstances

private java.util.Map variableInstances

listeners

private java.util.List listeners
Constructor Detail

WorkflowInstanceImpl

protected WorkflowInstanceImpl()
Creates a new instance of WorkflowInstanceImpl.

Method Detail

getWorkflow

public org.apache.lenya.workflow.Workflow getWorkflow()
Returns the workflow object of this instance.

Specified by:
getWorkflow in interface org.apache.lenya.workflow.WorkflowInstance

getWorkflowImpl

protected WorkflowImpl getWorkflowImpl()
Returns the workflow object of this instance.


getExecutableEvents

public org.apache.lenya.workflow.Event[] getExecutableEvents(org.apache.lenya.workflow.Situation situation)
                                                      throws org.apache.lenya.workflow.WorkflowException
Returns the events that can be invoked in a certain situation.

Specified by:
getExecutableEvents in interface org.apache.lenya.workflow.WorkflowInstance

invoke

public void invoke(org.apache.lenya.workflow.Situation situation,
                   org.apache.lenya.workflow.Event event)
            throws org.apache.lenya.workflow.WorkflowException
Invoke an event on this workflow instance.

Specified by:
invoke in interface org.apache.lenya.workflow.WorkflowInstance

getNextTransition

protected TransitionImpl getNextTransition(org.apache.lenya.workflow.Event event)
                                    throws org.apache.lenya.workflow.WorkflowException
Returns the transition that would fire for a given event.


fire

protected void fire(TransitionImpl transition)
             throws org.apache.lenya.workflow.WorkflowException
Invokes a transition.


setCurrentState

protected void setCurrentState(org.apache.lenya.workflow.State state)
Sets the current state of this instance.


getCurrentState

public org.apache.lenya.workflow.State getCurrentState()
Returns the current state of this WorkflowInstance.

Specified by:
getCurrentState in interface org.apache.lenya.workflow.WorkflowInstance

setWorkflow

protected void setWorkflow(WorkflowImpl workflow)
Sets the workflow of this instance.


setWorkflow

protected void setWorkflow(java.lang.String workflowName)
                    throws org.apache.lenya.workflow.WorkflowException
Sets the workflow of this instance.


getWorkflow

protected abstract WorkflowImpl getWorkflow(java.lang.String workflowName)
                                     throws org.apache.lenya.workflow.WorkflowException
Factory method to create a workflow object for a given identifier.


getState

protected org.apache.lenya.workflow.State getState(java.lang.String id)
                                            throws org.apache.lenya.workflow.WorkflowException
Returns a workflow state for a given name.


initVariableInstances

protected void initVariableInstances()
Initializes the variable instances in the initial state.


getVariableInstance

protected org.apache.lenya.workflow.BooleanVariableInstance getVariableInstance(org.apache.lenya.workflow.BooleanVariable variable)
                                                                         throws org.apache.lenya.workflow.WorkflowException
Returns the corresponding instance of a workflow variable.


getValue

public boolean getValue(java.lang.String variableName)
                 throws org.apache.lenya.workflow.WorkflowException
Description copied from interface: org.apache.lenya.workflow.WorkflowInstance
Returns the current value of a variable.

Specified by:
getValue in interface org.apache.lenya.workflow.WorkflowInstance

setValue

protected void setValue(java.lang.String variableName,
                        boolean value)
                 throws org.apache.lenya.workflow.WorkflowException
Sets the value of a state variable.


addWorkflowListener

public void addWorkflowListener(org.apache.lenya.workflow.WorkflowListener listener)
Description copied from interface: org.apache.lenya.workflow.WorkflowInstance
Adds a workflow listener.

Specified by:
addWorkflowListener in interface org.apache.lenya.workflow.WorkflowInstance

removeWorkflowListener

public void removeWorkflowListener(org.apache.lenya.workflow.WorkflowListener listener)
Description copied from interface: org.apache.lenya.workflow.WorkflowInstance
Removes a workflow listener.

Specified by:
removeWorkflowListener in interface org.apache.lenya.workflow.WorkflowInstance

isSynchronized

public boolean isSynchronized(org.apache.lenya.workflow.Event event)
                       throws org.apache.lenya.workflow.WorkflowException
Description copied from interface: org.apache.lenya.workflow.WorkflowInstance
Returns if the transition for a certain event is synchronized.

Specified by:
isSynchronized in interface org.apache.lenya.workflow.WorkflowInstance