01: package org.wfmc.wapi;
02:
03: public class WMTransitionNotAllowedException extends
04: WMWorkflowException {
05: private static final long serialVersionUID = -9001778228100390200L;
06: private static final String[] ACTIONS = { "(illegal)", "(none)",
07: "start", "stop", "suspend", "abort", "terminate",
08: "complete" };
09: private final String _oldState;
10: private final String _newState;
11: private final int _action;
12:
13: public WMTransitionNotAllowedException(String oldState,
14: String newState, String message) {
15:
16: super (new WMError(WMError.WM_TRANSITION_NOT_ALLOWED), message);
17: _oldState = oldState;
18: _newState = newState;
19: _action = WMObjectState.ILLEGAL_ACTION;
20: }
21:
22: public WMTransitionNotAllowedException(String oldState, int action,
23: String message) {
24:
25: super (new WMError(WMError.WM_TRANSITION_NOT_ALLOWED), message);
26: _oldState = oldState;
27: _newState = "(invalid)";
28: _action = action;
29: }
30:
31: public String toString() {
32: return super .toString() + "[from='" + _oldState + "', to='"
33: + _newState + "', action='" + ACTIONS[_action + 2]
34: + "']";
35: }
36: }
|