KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > execution > EnterStateVetoException


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 JavaDoc 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 JavaDoc flowId, String JavaDoc sourceStateId, String JavaDoc vetoedStateId, String JavaDoc message) {
43         super(flowId, sourceStateId, message);
44         this.vetoedStateId = vetoedStateId;
45     }
46
47     /**
48      * Create a new enter state veto exception.
49      * @param flowId the active flow
50      * @param sourceStateId the current state when the veto operation occured
51      * @param vetoedStateId the state for which entering is vetoed
52      * @param message a descriptive message
53      * @param cause the underlying cause
54      */

55     public EnterStateVetoException(String JavaDoc flowId, String JavaDoc sourceStateId, String JavaDoc vetoedStateId, String JavaDoc message, Throwable JavaDoc cause) {
56         super(flowId, sourceStateId, message, cause);
57         this.vetoedStateId = vetoedStateId;
58     }
59
60     /**
61      * Create a new enter state veto exception.
62      * @param context the flow execution request context
63      * @param vetoedState the state for which entering is vetoed
64      * @param message a descriptive message
65      */

66     public EnterStateVetoException(RequestContext context, StateDefinition vetoedState, String JavaDoc message) {
67         this(context.getActiveFlow().getId(), context.getCurrentState().getId(), vetoedState.getId(), message);
68     }
69
70     /**
71      * Create a new enter state veto exception.
72      * @param context the flow execution request context
73      * @param vetoedState the state for which entering is vetoed
74      * @param message a descriptive message
75      * @param cause the underlying cause
76      */

77     public EnterStateVetoException(RequestContext context, StateDefinition vetoedState, String JavaDoc message, Throwable JavaDoc cause) {
78         this(context.getActiveFlow().getId(), context.getCurrentState().getId(), vetoedState.getId(), message, cause);
79     }
80
81     /**
82      * Returns the state for which entering was vetoed.
83      */

84     public String JavaDoc getVetoedStateId() {
85         return vetoedStateId;
86     }
87 }
Popular Tags