Class StateEngine


  • public class StateEngine
    extends Object
    Process State Engine. Based on OMG Workflow State
    Version:
    $Id: StateEngine.java,v 1.3 2006/07/30 00:54:44 jjanke Exp $
    Author:
    Jorg Janke
    • Constructor Detail

      • StateEngine

        public StateEngine()
        Default Constructor (not started)
      • StateEngine

        public StateEngine​(String startState)
        Initialized Constructor
        Parameters:
        startState - start state
    • Method Detail

      • isThrowException

        public boolean isThrowException()
        Are Exception Thrown
        Returns:
        trie if exceptions thrown
      • setThrowException

        public void setThrowException​(boolean throwException)
        Set if Exceptions are Thrown * @param throwException boolean
      • getState

        public String getState()
        Get State
        Returns:
        state
      • getStateInfo

        public String getStateInfo()
        Get clear text State Info.
        Returns:
        state info
      • isOpen

        public boolean isOpen()
        State is Open
        Returns:
        true if open (running, not started, suspended)
      • isNotRunning

        public boolean isNotRunning()
        State is Not Running
        Returns:
        true if not running (not started, suspended)
      • isClosed

        public boolean isClosed()
        State is Closed
        Returns:
        true if closed (completed, aborted, terminated)
      • isNotStarted

        public boolean isNotStarted()
        State is Not Started
        Returns:
        true if Not Started
      • isRunning

        public boolean isRunning()
        State is Running
        Returns:
        true if Running
      • isSuspended

        public boolean isSuspended()
        State is Suspended
        Returns:
        true if Suspended
      • isCompleted

        public boolean isCompleted()
        State is Completed
        Returns:
        true if Completed
      • isAborted

        public boolean isAborted()
        State is Aborted (Environment/Setup issue)
        Returns:
        true if Aborted
      • isTerminated

        public boolean isTerminated()
        State is Terminated (Execution issue)
        Returns:
        true if Terminated
      • start

        public boolean start()
        Start: not started -> running
        Returns:
        true if set to running
      • resume

        public boolean resume()
        Resume: suspended -> running
        Returns:
        true if set to sunning
      • suspend

        public boolean suspend()
        Suspend: running -> suspended
        Returns:
        true if suspended
      • complete

        public boolean complete()
        Complete: running -> completed
        Returns:
        true if set to completed
      • abort

        public boolean abort()
        Abort: open -> aborted
        Returns:
        true if set to aborted
      • terminate

        public boolean terminate()
        Terminate: open -> terminated
        Returns:
        true if set to terminated
      • getNewStateOptions

        public String[] getNewStateOptions()
        Get New State Options based on current State
        Returns:
        array of new states
      • isValidNewState

        public boolean isValidNewState​(String newState)
        Is the new State valid based on current state
        Parameters:
        newState - new state
        Returns:
        true valid new state
      • setState

        public boolean setState​(String newState)
        Set State to new State
        Parameters:
        newState - new state
        Returns:
        true if set to new state
      • getActionOptions

        public String[] getActionOptions()
        Get Action Options based on current State
        Returns:
        array of actions
      • isValidAction

        public boolean isValidAction​(String action)
        Is The Action Valid based on current state
        Parameters:
        action - action
        Returns:
        true if valid
      • process

        public boolean process​(String action)
        Process
        Parameters:
        action - action
        Returns:
        true if set to new state
      • getNewStateIfAction

        public String getNewStateIfAction​(String action)
        Get New State If Action performed
        Parameters:
        action - action
        Returns:
        potential new state
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class Object
        Returns:
        info