View Javadoc

1   /*
2    * Copyright 2004-2008 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.util.Map;
19  
20  /**
21   * アクションの基底クラスです。
22   * <p>
23   * アクションはビューのコントローラーの役割を果たします。
24   * </p>
25   * 
26   * @author agata
27   * @author baba
28   */
29  public abstract class Action {
30  
31  	/**
32  	 * アクションエラーオブジェクト。
33  	 */
34  	protected ActionErrors errors;
35  
36  	/**
37  	 * 揮発性メッセージ。
38  	 */
39  	protected Map<String, Object> flash;
40  
41  	/**
42  	 * Actionの実行前に呼ばれます。パラメータのバインディング前に呼ばれるので、パラメータを使用したい場合はリクエストから直接取得する必要があります。
43  	 */
44  	public void initialize() {
45  	}
46  
47  	/**
48  	 * フォーワードの直前で呼ばれます。対象のActionクラスのフォワード先で必ず使用する共通のデータなどを取得する目的で使用します。
49  	 */
50  	public void prerender() {
51  	}
52  
53  	/**
54  	 * フォワードの直後で呼ばれます。通常はあまり使用することはないでしょう。
55  	 */
56  	public void postrender() {
57  	}
58  
59  	/**
60  	 * アクションエラーオブジェクトを取得します。
61  	 * 
62  	 * @return アクションエラーオブジェクト
63  	 */
64  	public ActionErrors getErrors() {
65  		return errors;
66  	}
67  
68  	/**
69  	 * アクションエラーオブジェクトをセットします。
70  	 * 
71  	 * @param errors
72  	 *            アクションエラーオブジェクト
73  	 */
74  	public void setErrors(final ActionErrors errors) {
75  		this.errors = errors;
76  	}
77  
78  	/**
79  	 * 揮発性メッセージを取得します。
80  	 * 
81  	 * @return 揮発性メッセージ
82  	 */
83  	public Map<String, Object> getFlash() {
84  		return flash;
85  	}
86  
87  	/**
88  	 * 揮発性メッセージをセットします。
89  	 * 
90  	 * @param flash
91  	 *            揮発性メッセージ
92  	 */
93  	public void setFlash(final Map<String, Object> flash) {
94  		this.flash = flash;
95  	}
96  
97  }