Adempiere 3.5.2a

org.compiere.process
Class StateEngine

java.lang.Object
  extended by org.compiere.process.StateEngine
Direct Known Subclasses:
AdempiereService

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

Field Summary
static String ACTION_Abort
          Abort
static String ACTION_Complete
          Complete
static String ACTION_Resume
          Resume
static String ACTION_Start
          Start
static String ACTION_Suspend
          Suspend
static String ACTION_Terminate
          Terminate
protected  CLogger log
          Logger
static String STATE_Aborted
          Closed - Aborted - Environment/Setup Error
static String STATE_Completed
          Closed - Completed - normal exit
static String STATE_NotStarted
          Open - Not Started
static String STATE_Running
          Open - Running
static String STATE_Suspended
          Open - Suspended
static String STATE_Terminated
          Closed - Teminated - Execution Error
 
Constructor Summary
StateEngine()
          Default Constructor (not started)
StateEngine(String startState)
          Initialized Constructor
 
Method Summary
 boolean abort()
          Abort: open -> aborted
 boolean complete()
          Complete: running -> completed
 String[] getActionOptions()
          Get Action Options based on current State
 String getNewStateIfAction(String action)
          Get New State If Action performed
 String[] getNewStateOptions()
          Get New State Options based on current State
 String getState()
          Get State
 String getStateInfo()
          Get clear text State Info.
 boolean isAborted()
          State is Aborted (Environment/Setup issue)
 boolean isClosed()
          State is Closed
 boolean isCompleted()
          State is Completed
 boolean isNotRunning()
          State is Not Running
 boolean isNotStarted()
          State is Not Started
 boolean isOpen()
          State is Open
 boolean isRunning()
          State is Running
 boolean isSuspended()
          State is Suspended
 boolean isTerminated()
          State is Terminated (Execution issue)
 boolean isThrowException()
          Are Exception Thrown
 boolean isValidAction(String action)
          Is The Action Valid based on current state
 boolean isValidNewState(String newState)
          Is the new State valid based on current state
 boolean process(String action)
          Process
 boolean resume()
          Resume: suspended -> running
 boolean setState(String newState)
          Set State to new State
 void setThrowException(boolean throwException)
          Set if Exceptions are Thrown * @param throwException boolean
 boolean start()
          Start: not started -> running
 boolean suspend()
          Suspend: running -> suspended
 boolean terminate()
          Terminate: open -> terminated
 String toString()
          String Representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_NotStarted

public static final String STATE_NotStarted
Open - Not Started

See Also:
Constant Field Values

STATE_Running

public static final String STATE_Running
Open - Running

See Also:
Constant Field Values

STATE_Suspended

public static final String STATE_Suspended
Open - Suspended

See Also:
Constant Field Values

STATE_Completed

public static final String STATE_Completed
Closed - Completed - normal exit

See Also:
Constant Field Values

STATE_Aborted

public static final String STATE_Aborted
Closed - Aborted - Environment/Setup Error

See Also:
Constant Field Values

STATE_Terminated

public static final String STATE_Terminated
Closed - Teminated - Execution Error

See Also:
Constant Field Values

ACTION_Suspend

public static final String ACTION_Suspend
Suspend

See Also:
Constant Field Values

ACTION_Start

public static final String ACTION_Start
Start

See Also:
Constant Field Values

ACTION_Resume

public static final String ACTION_Resume
Resume

See Also:
Constant Field Values

ACTION_Complete

public static final String ACTION_Complete
Complete

See Also:
Constant Field Values

ACTION_Abort

public static final String ACTION_Abort
Abort

See Also:
Constant Field Values

ACTION_Terminate

public static final String ACTION_Terminate
Terminate

See Also:
Constant Field Values

log

protected CLogger log
Logger

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

Adempiere 3.5.2a

Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.