org.apache.lenya.workflow.impl
Class WorkflowImpl

java.lang.Object
  extended by org.apache.lenya.workflow.impl.WorkflowImpl
All Implemented Interfaces:
Workflow

public class WorkflowImpl
extends java.lang.Object
implements Workflow

Implementation of a workflow schema.


Field Summary
 
Fields inherited from interface org.apache.lenya.workflow.Workflow
DEFAULT_PREFIX, NAMESPACE
 
Constructor Summary
protected WorkflowImpl(StateImpl initialState)
          Creates a new instance of WorkflowImpl.
 
Method Summary
protected  void addEvent(EventImpl event)
          Adds an event.
protected  void addTransition(TransitionImpl transition)
          Adds a transition.
protected  void addVariable(BooleanVariableImpl variable)
          Adds a variable.
protected  boolean containsState(State state)
          Checks if this workflow contains a state.
protected  State getDestination(Transition transition)
          Returns the destination state of a transition.
 EventImpl getEvent(java.lang.String name)
          Returns the event for a certain event name.
 State getInitialState()
          Returns the initial state of this workflow.
 Transition[] getLeavingTransitions(State state)
          Returns the transitions that leave a state.
protected  StateImpl getState(java.lang.String name)
          Returns the state with a certain name.
protected  StateImpl[] getStates()
          Returns the states.
protected  TransitionImpl[] getTransitions()
          Returns the transitions.
 BooleanVariableImpl getVariable(java.lang.String name)
          Returns the variable for a certain name.
 java.lang.String[] getVariableNames()
          Returns the variable names.
protected  BooleanVariableImpl[] getVariables()
          Returns the variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowImpl

protected WorkflowImpl(StateImpl initialState)
Creates a new instance of WorkflowImpl.

Parameters:
initialState - the initial state of the workflow.
Method Detail

getInitialState

public State getInitialState()
Returns the initial state of this workflow.

Specified by:
getInitialState in interface Workflow
Returns:
The initial state.

addTransition

protected void addTransition(TransitionImpl transition)
Adds a transition.

Parameters:
transition - The transition.

getTransitions

protected TransitionImpl[] getTransitions()
Returns the transitions.

Returns:
An array of transitions.

getDestination

protected State getDestination(Transition transition)
Returns the destination state of a transition.

Parameters:
transition - A transition.
Returns:
The destination state.

getLeavingTransitions

public Transition[] getLeavingTransitions(State state)
Returns the transitions that leave a state.

Specified by:
getLeavingTransitions in interface Workflow
Parameters:
state - A state.
Returns:
The transitions that leave the state.

containsState

protected boolean containsState(State state)
Checks if this workflow contains a state.

Parameters:
state - The state to check.
Returns:
true if the state is contained, false otherwise.

getStates

protected StateImpl[] getStates()
Returns the states.

Returns:
An array of states.

getState

protected StateImpl getState(java.lang.String name)
                      throws WorkflowException
Returns the state with a certain name.

Parameters:
name - The state name.
Returns:
A state.
Throws:
WorkflowException - when the state does not exist.

addEvent

protected void addEvent(EventImpl event)
Adds an event.

Parameters:
event - An event.

getEvent

public EventImpl getEvent(java.lang.String name)
                   throws WorkflowException
Returns the event for a certain event name.

Parameters:
name - A string.
Returns:
The event with this name.
Throws:
WorkflowException - when no event with the given name exists.

addVariable

protected void addVariable(BooleanVariableImpl variable)
Adds a variable.

Parameters:
variable - A variable.

getVariable

public BooleanVariableImpl getVariable(java.lang.String name)
                                throws WorkflowException
Returns the variable for a certain name.

Parameters:
name - The name of the variable.
Returns:
A variable.
Throws:
WorkflowException - if no variable with the given name exists.

getVariables

protected BooleanVariableImpl[] getVariables()
Returns the variables.

Returns:
An array of variables.

getVariableNames

public java.lang.String[] getVariableNames()
Description copied from interface: Workflow
Returns the variable names.

Specified by:
getVariableNames in interface Workflow
Returns:
A string array.
See Also:
Workflow.getVariableNames()


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.