Overview | Package | Class | Tree | Deprecated | Index | Help
| bea Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## theory.smart.axiom.workflow
Class StateMachine

    java.lang.Object
      |
      +--theory.smart.axiom.workflow.StateMachine

Direct Known Subclasses:
  EBusinessSessionWorkflow, OrderWorkflow, TroubleTicketWorkflow

public class StateMachine
extends java.lang.Object
implements Workflow

This is the reference implemenation of a Workflow object. It provides a simple implemenation based on a set of states and transitions.

See Also:
  `Workflow`, Serialized Form

Field Summary
`protected State` | `currentState`
`protected State` | `initialState`
`protected com.sun.java.util.collections.TreeSet` | `states`
`protected java.lang.String` | `TRANSITION_KEY_TOKEN`
`protected com.sun.java.util.collections.TreeMap` | `transitions`

Constructor Summary
`StateMachine()` Use WorkflowHome.create("theory.smart.axiom.workflow.StateMachine") to instantiate the workflow.

Method Summary
`protected void` | `addTransition(Transition t)`
`java.lang.String` | `doTransition(java.lang.String transitionName)` Given the name of the transition, perform the transition and return the new state.
`WorkflowContext` | `getContext()` Get the context of the Workflow.
`java.lang.String` | `getCurrentStateName()` Get the name of the current state
`java.lang.String` | `getInitialStateName()` Get the name of the initial state
`java.lang.String[]` | `getStateNames()` Get all State names in an array of Strings.
`java.lang.String[]` | `getTransitionNames()` Get all transition names in an array of Strings.
`java.lang.String` | `lookAheadTransition(java.lang.String transition)` Given the name of the transition, look ahead the transition and return the predicted new state.
`void` | `reset()` Reset the current workflow state to the initial state
`void` | `setContext(WorkflowContext workflowContext)` Set the new context for the underlying workflow engine.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TRANSITION_KEY_TOKEN

    protected java.lang.String TRANSITION_KEY_TOKEN

### currentState

    protected State currentState

### initialState

    protected State initialState

### transitions

    protected com.sun.java.util.collections.TreeMap transitions

### states

    protected com.sun.java.util.collections.TreeSet states

Constructor Detail

### StateMachine

    public StateMachine()

  Use WorkflowHome.create("theory.smart.axiom.workflow.StateMachine") to instantiate the workflow.

Method Detail

### doTransition

    public java.lang.String doTransition(java.lang.String transitionName)
                                  throws IllegalWorkflowTransitionException

  Given the name of the transition, perform the transition and return the new state. If transition is invalid for the current state of the state machine, throw IllegalWorkflowTransitionException
  Specified by:
    doTransition in interface Workflow
  Parameters:
    `transition` - the name of the transition to be performed
  Returns:
    new state.
  Throws:
    IllegalWorkflowTransitionException - if the transition is invalid

### getContext

    public WorkflowContext getContext()

  Get the context of the Workflow. This method should be used only by the classes that implement the Workflow interface.
  Specified by:
    getContext in interface Workflow
  Returns:
    WorkflowContext

### getCurrentStateName

    public java.lang.String getCurrentStateName()

  Get the name of the current state
  Specified by:
    getCurrentStateName in interface Workflow
  Returns:
    current state name

### getInitialStateName

    public java.lang.String getInitialStateName()

  Get the name of the initial state
  Specified by:
    getInitialStateName in interface Workflow
  Returns:
    initial state name

### getStateNames

    public java.lang.String[] getStateNames()

  Get all State names in an array of Strings.
  Specified by:
    getStateNames in interface Workflow
  Returns:
    String[] an array of Strings

### getTransitionNames

    public java.lang.String[] getTransitionNames()

  Get all transition names in an array of Strings.
  Specified by:
    getTransitionNames in interface Workflow
  Returns:
    String[] an array of Strings

### lookAheadTransition

    public java.lang.String lookAheadTransition(java.lang.String transition)
                                         throws IllegalWorkflowTransitionException

  Given the name of the transition, look ahead the transition and return the predicted new state. If transition is invalid for the current state of the state machine, throw IllegalWorkflowTransitionException.
  Specified by:
    lookAheadTransition in interface Workflow
  Parameters:
    `transition` - the name of the transition to be performed
  Returns:
    predicted new state.
  Throws:
    IllegalWorkflowTransitionException - if the transition is invalid

### reset

    public void reset()

  Reset the current workflow state to the initial state
  Specified by:
    reset in interface Workflow

### setContext

    public void setContext(WorkflowContext workflowContext)

  Set the new context for the underlying workflow engine. This method should be used only by the classes that implement the Workflow interface.
  Specified by:
    setContext in interface Workflow
  Parameters:
    `WorkflowContext` - the new context for the underlying workflow engine.

### addTransition

    protected void addTransition(Transition t)

Overview | Package | Class | Tree | Deprecated | Index | Help
| bea Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© Copyright 2000 bea Systems, Inc. All rights reserved.