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