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.validator;
17  
18  import java.util.Collection;
19  import java.util.Map;
20  
21  import org.seasar.cubby.action.ActionErrors;
22  import org.seasar.cubby.action.ActionResult;
23  
24  /**
25   * アクションメソッドに対する入力検証のルールの集合です。
26   * 
27   * @author agata
28   * @author baba
29   * @since 1.0.0
30   */
31  public interface ValidationRules {
32  
33  	/**
34  	 * すべてのフェーズに対する入力検証を実行します。
35  	 * 
36  	 * @param params
37  	 *            リクエストパラメータ
38  	 * @param form
39  	 *            フォームオブジェクト
40  	 * @param errors
41  	 *            アクションのエラー
42  	 */
43  	void validate(Map<String, Object[]> params, Object formBean,
44  			ActionErrors actionErrors);
45  
46  	/**
47  	 * 入力検証にエラーがあった場合に呼び出されます。
48  	 * 
49  	 * @param errorPage
50  	 *            エラーページ
51  	 * @return アクションメソッド実行後の処理
52  	 * @see org.seasar.cubby.action.Validation#errorPage()
53  	 * @since 1.0.2
54  	 */
55  	ActionResult fail(String errorPage);
56  
57  	/**
58  	 * 入力検証のフェーズの一覧を実行順に並べた{@link Collection}として取得します。
59  	 * 
60  	 * @return 入力検証のフェーズ
61  	 * @since 1.1.0
62  	 */
63  	Collection<ValidationPhase> getValidationPhases();
64  
65  	/**
66  	 * 指定された入力検証フェーズに対応する入力検証ルールの{@link Collection}を取得します。
67  	 * 
68  	 * @param validationPhase
69  	 *            入力検証フェーズ
70  	 * @return 指定された入力検証フェーズに対応する入力検証ルールの{@link Collection}
71  	 * @since 1.1.0
72  	 */
73  	Collection<ValidationRule> getPhaseValidationRules(
74  			ValidationPhase validationPhase);
75  
76  }