Package org.compiere.process
Class StateEngine
java.lang.Object
org.compiere.process.StateEngine
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
Modifier and TypeFieldDescriptionstatic final String
Abortstatic final String
Completestatic final String
Resumestatic final String
Startstatic final String
Suspendstatic final String
Terminateprotected CLogger
Loggerstatic final String
Closed - Aborted - Environment/Setup Errorstatic final String
Closed - Completed - normal exitstatic final String
Open - Not Startedstatic final String
Open - Runningstatic final String
Open - Suspendedstatic final String
Closed - Teminated - Execution Error -
Constructor Summary
ConstructorDescriptionDefault Constructor (not started)StateEngine
(String startState) Initialized Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
abort()
Abort: open -> abortedboolean
complete()
Complete: running -> completedString[]
Get Action Options based on current StategetNewStateIfAction
(String action) Get New State If Action performedString[]
Get New State Options based on current StategetState()
Get StateGet clear text State Info.boolean
State is Aborted (Environment/Setup issue)boolean
isClosed()
State is Closedboolean
State is Completedboolean
State is Not Runningboolean
State is Not Startedboolean
isOpen()
State is Openboolean
State is Runningboolean
State is Suspendedboolean
State is Terminated (Execution issue)boolean
Are Exception Thrownboolean
isValidAction
(String action) Is The Action Valid based on current stateboolean
isValidNewState
(String newState) Is the new State valid based on current stateboolean
Processboolean
resume()
Resume: suspended -> runningboolean
Set State to new Statevoid
setThrowException
(boolean throwException) Set if Exceptions are Thrown * @param throwException booleanboolean
start()
Start: not started -> runningboolean
suspend()
Suspend: running -> suspendedboolean
Terminate: open -> terminatedtoString()
String Representation
-
Field Details
-
STATE_NotStarted
Open - Not Started- See Also:
-
STATE_Running
Open - Running- See Also:
-
STATE_Suspended
Open - Suspended- See Also:
-
STATE_Completed
Closed - Completed - normal exit- See Also:
-
STATE_Aborted
Closed - Aborted - Environment/Setup Error- See Also:
-
STATE_Terminated
Closed - Teminated - Execution Error- See Also:
-
ACTION_Suspend
Suspend- See Also:
-
ACTION_Start
Start- See Also:
-
ACTION_Resume
Resume- See Also:
-
ACTION_Complete
Complete- See Also:
-
ACTION_Abort
Abort- See Also:
-
ACTION_Terminate
Terminate- See Also:
-
log
Logger
-
-
Constructor Details
-
StateEngine
public StateEngine()Default Constructor (not started) -
StateEngine
Initialized Constructor- Parameters:
startState
- start state
-
-
Method Details
-
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
Get State- Returns:
- state
-
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
Get New State Options based on current State- Returns:
- array of new states
-
isValidNewState
Is the new State valid based on current state- Parameters:
newState
- new state- Returns:
- true valid new state
-
setState
Set State to new State- Parameters:
newState
- new state- Returns:
- true if set to new state
-
getActionOptions
Get Action Options based on current State- Returns:
- array of actions
-
isValidAction
Is The Action Valid based on current state- Parameters:
action
- action- Returns:
- true if valid
-
process
Process- Parameters:
action
- action- Returns:
- true if set to new state
-
getNewStateIfAction
Get New State If Action performed- Parameters:
action
- action- Returns:
- potential new state
-
toString
String Representation
-