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.uruma.procedure.entity;
17  
18  import java.util.ArrayList;
19  import java.util.Collections;
20  import java.util.List;
21  
22  import org.seasar.uruma.annotation.EventListenerType;
23  import org.seasar.uruma.util.AssertionUtil;
24  
25  /**
26   * プロシジャの実行シーケンス情報を保持するクラスです。<br />
27   * 本クラスはプロシジャ実行定義ファイルの sequence 要素に対応します。<br />
28   * 
29   * @author y-komori
30   */
31  public class Sequence {
32      private List<Procedure> procedures = new ArrayList<Procedure>();
33  
34      private List<String> ids = new ArrayList<String>();
35  
36      private EventListenerType type = EventListenerType.SELECTION;
37  
38      private ExecuteTiming timing;
39  
40      /**
41       * プロシジャ実行対象 GUI コンポーネントの ID 一覧を取得します。<br />
42       * 
43       * @return プロシジャ実行対象 GUI コンポーネントの ID リスト
44       */
45      public List<String> getIds() {
46          return Collections.unmodifiableList(ids);
47      }
48  
49      /**
50       * プロシジャ実行対象 GUI コンポーネントの ID を追加します。<br />
51       * 
52       * @param id
53       *            プロシジャ実行対象 GUI コンポーネントの ID
54       */
55      public void addId(final String id) {
56          AssertionUtil.assertNotNull("id", id);
57          this.ids.add(id);
58      }
59  
60      /**
61       * プロシジャ実行対象 GUI コンポーネントの ID を削除します。<br />
62       * 
63       * @param id
64       *            削除対象の ID
65       */
66      public void removeId(final String id) {
67          AssertionUtil.assertNotNull("id", id);
68          this.ids.remove(id);
69      }
70  
71      /**
72       * プロシジャ実行対象イベントの種類を取得します。<br />
73       * 
74       * @return プロシジャ実行対象イベントの種類
75       */
76      public EventListenerType getType() {
77          return this.type;
78      }
79  
80      /**
81       * プロシジャ実行対象イベントの種類を設定します。<br />
82       * 
83       * @param type
84       *            プロシジャ実行対象イベントの種類
85       */
86      public void setType(final EventListenerType type) {
87          this.type = type;
88      }
89  
90      /**
91       * プロシジャ実行タイミングを取得します。<br />
92       * 
93       * @return プロシジャ実行タイミング
94       */
95      public ExecuteTiming getTiming() {
96          return this.timing;
97      }
98  
99      /**
100      * プロシジャ実行タイミングを設定します。<br />
101      * 
102      * @param timing
103      *            プロシジャ実行タイミング
104      */
105     public void setTiming(final ExecuteTiming timing) {
106         this.timing = timing;
107     }
108 
109     /**
110      * プロシジャ定義を追加します。<br />
111      * 
112      * @param procedure
113      *            プロシジャ定義
114      */
115     public void addProcedure(final Procedure procedure) {
116         AssertionUtil.assertNotNull("procedure", procedure);
117         procedures.add(procedure);
118     }
119 
120     /**
121      * プロシジャ定義を削除します。<br />
122      * 
123      * @param procedure
124      *            プロシジャ定義
125      */
126     public void removeProcedure(final Procedure procedure) {
127         AssertionUtil.assertNotNull("procedure", procedure);
128         procedures.remove(procedure);
129     }
130 
131     /**
132      * プロシジャ定義の一覧を取得します。<br />
133      * 
134      * @return プロシジャ定義のリスト
135      */
136     public List<Procedure> getProcedures() {
137         return Collections.unmodifiableList(procedures);
138     }
139 }