View Javadoc

1   /*
2    * Copyright 2004-2009 the Seasar Foundation and the Others.
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,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.cubby.action;
17  
18  import java.lang.reflect.Method;
19  import java.util.Map;
20  
21  /**
22   * アクションのコンテキストです。
23   * 
24   * @author baba
25   */
26  public interface ActionContext {
27  
28  	/**
29  	 * このコンテキストを初期化します。
30  	 * 
31  	 * @param action
32  	 *            アクション
33  	 * @param actionClass
34  	 *            アクションクラス
35  	 * @param actionMethod
36  	 *            アクションメソッド
37  	 * @param actionErrors
38  	 *            アクションエラー
39  	 * @param flashMap
40  	 *            揮発性メッセージ
41  	 */
42  	void initialize(Object action, Class<?> actionClass, Method actionMethod,
43  			ActionErrors actionErrors, Map<String, Object> flashMap);
44  
45  	/**
46  	 * アクションを取得します。
47  	 * 
48  	 * @return アクション
49  	 */
50  	Object getAction();
51  
52  	/**
53  	 * アクションクラスを取得します。
54  	 * 
55  	 * @return アクションクラス
56  	 */
57  	Class<?> getActionClass();
58  
59  	/**
60  	 * アクションメソッドを取得します。
61  	 * 
62  	 * @return アクションメソッド
63  	 */
64  	Method getActionMethod();
65  
66  	/**
67  	 * 指定されたアクションからアクションメソッドに対応するフォームオブジェクトを取得します。
68  	 * 
69  	 * @return フォームオブジェクト
70  	 * @throws ActionException
71  	 *             &#064;Formでフォームオブジェクトとなるプロパティを指定しているが、そのプロパティが
72  	 *             <code>null</code> だった場合
73  	 */
74  	Object getFormBean();
75  
76  	/**
77  	 * フォームオブジェクトのすべてのプロパティに要求パラメータをバインドするかを示します。
78  	 * 
79  	 * @return フォームオブジェクトのすべてのプロパティに要求パラメータをバインドする場合は <code>true</code>
80  	 *         、そうでない場合は <code>false</code>
81  	 */
82  	boolean isBindRequestParameterToAllProperties();
83  
84  	/**
85  	 * アクションメソッドの実行前に呼ばれます。
86  	 * <p>
87  	 * {@link Action#invokeInitializeMethod(Method)} を呼び出します。
88  	 * </p>
89  	 */
90  	void invokeInitializeMethod();
91  
92  	/**
93  	 * フォーワードの直前に呼ばれます。
94  	 * <p>
95  	 * {@link Action#invokePreRenderMethod(Method)} を呼び出します。
96  	 * </p>
97  	 */
98  	void invokePreRenderMethod();
99  
100 	/**
101 	 * フォワードの直後に呼ばれます。
102 	 * <p>
103 	 * {@link Action#invokePostRenderMethod(Method)} を呼び出します。
104 	 * </p>
105 	 */
106 	void invokePostRenderMethod();
107 
108 	/**
109 	 * アクションエラーを取得します。
110 	 * 
111 	 * @return アクションエラー
112 	 */
113 	ActionErrors getActionErrors();
114 
115 	/**
116 	 * 揮発性メッセージを取得します。
117 	 * 
118 	 * @return 揮発性メッセージ
119 	 */
120 	Map<String, Object> getFlashMap();
121 
122 	/**
123 	 * 揮発性メッセージをクリアします。
124 	 */
125 	void clearFlash();
126 
127 }