01: /*
02: * Copyright 2004-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.springframework.webflow.execution;
17:
18: import org.springframework.webflow.definition.StateDefinition;
19:
20: /**
21: * Exception thrown to veto the entering of a state of a flow. Typically thrown
22: * by {@link FlowExecutionListener} objects that apply security or other runtime
23: * constraint checks to flow executions.
24: *
25: * @author Keith Donald
26: * @author Erwin Vervaet
27: */
28: public class EnterStateVetoException extends FlowExecutionException {
29:
30: /**
31: * The state whose entering was vetoed.
32: */
33: private String vetoedStateId;
34:
35: /**
36: * Create a new enter state veto exception.
37: * @param flowId the active flow
38: * @param sourceStateId the current state when the veto operation occured
39: * @param vetoedStateId the state for which entering is vetoed
40: * @param message a descriptive message
41: */
42: public EnterStateVetoException(String flowId, String sourceStateId,
43: String vetoedStateId, String message) {
44: super (flowId, sourceStateId, message);
45: this .vetoedStateId = vetoedStateId;
46: }
47:
48: /**
49: * Create a new enter state veto exception.
50: * @param flowId the active flow
51: * @param sourceStateId the current state when the veto operation occured
52: * @param vetoedStateId the state for which entering is vetoed
53: * @param message a descriptive message
54: * @param cause the underlying cause
55: */
56: public EnterStateVetoException(String flowId, String sourceStateId,
57: String vetoedStateId, String message, Throwable cause) {
58: super (flowId, sourceStateId, message, cause);
59: this .vetoedStateId = vetoedStateId;
60: }
61:
62: /**
63: * Create a new enter state veto exception.
64: * @param context the flow execution request context
65: * @param vetoedState the state for which entering is vetoed
66: * @param message a descriptive message
67: */
68: public EnterStateVetoException(RequestContext context,
69: StateDefinition vetoedState, String message) {
70: this (context.getActiveFlow().getId(), context.getCurrentState()
71: .getId(), vetoedState.getId(), message);
72: }
73:
74: /**
75: * Create a new enter state veto exception.
76: * @param context the flow execution request context
77: * @param vetoedState the state for which entering is vetoed
78: * @param message a descriptive message
79: * @param cause the underlying cause
80: */
81: public EnterStateVetoException(RequestContext context,
82: StateDefinition vetoedState, String message, Throwable cause) {
83: this (context.getActiveFlow().getId(), context.getCurrentState()
84: .getId(), vetoedState.getId(), message, cause);
85: }
86:
87: /**
88: * Returns the state for which entering was vetoed.
89: */
90: public String getVetoedStateId() {
91: return vetoedStateId;
92: }
93: }
|