1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/tests/test/interceptors/InterceptorTest.java,v 1.2 2005/11/29 19:18:38 hkollmann Exp $
3    * $Revision: 1.2 $
4    * $Date: 2005/11/29 19:18:38 $
5    *
6    * DbForms - a Rapid Application Development Framework
7    * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8    *
9    * This library is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public
11   * License as published by the Free Software Foundation; either
12   * version 2.1 of the License, or (at your option) any later version.
13   *
14   * This library is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this library; if not, write to the Free Software
21   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   */
23  
24  package interceptors;
25  
26  import org.dbforms.config.MultipleValidationException;
27  import org.dbforms.config.ValidationException;
28  
29  import org.dbforms.event.DbEventInterceptorSupport;
30  import org.dbforms.interfaces.DbEventInterceptorData;
31  
32  
33  
34  /***
35   * DOCUMENT ME!
36   *
37   * @author hkk To change this generated comment go to
38   *         Window>Preferences>Java>Code Generation>Code and Comments
39   */
40  public class InterceptorTest extends DbEventInterceptorSupport {
41     /*** DOCUMENT ME! */
42     public static boolean preInsertCalled  = false;
43  
44     /*** DOCUMENT ME! */
45     public static boolean preSelectCalled  = false;
46  
47     /*** DOCUMENT ME! */
48     public static boolean preUpdateCalled  = false;
49  
50     /*** DOCUMENT ME! */
51     public static boolean preDeleteCalled  = false;
52  
53     /*** DOCUMENT ME! */
54     public static boolean preAddRowCalled  = false;
55  
56     /*** DOCUMENT ME! */
57     public static boolean postUpdateCalled = false;
58  
59     /*** DOCUMENT ME! */
60     public static boolean postSelectCalled = false;
61  
62     /*** DOCUMENT ME! */
63     public static boolean postInsertCalled = false;
64  
65     /*** DOCUMENT ME! */
66     public static boolean postDeleteCalled = false;
67  
68     /*** DOCUMENT ME! */
69     public static boolean postAddRowCalled = false;
70  
71     /***
72      * DOCUMENT ME!
73      *
74      * @param data DOCUMENT ME!
75      */
76     public void postAddRow(DbEventInterceptorData data) {
77        postAddRowCalled = true;
78     }
79  
80  
81     /***
82      * DOCUMENT ME!
83      *
84      * @param data DOCUMENT ME!
85      */
86     public void postDelete(DbEventInterceptorData data) {
87        postDeleteCalled = true;
88     }
89  
90  
91     /***
92      * DOCUMENT ME!
93      *
94      * @param data DOCUMENT ME!
95      */
96     public void postInsert(DbEventInterceptorData data) {
97        postInsertCalled = true;
98     }
99  
100 
101    /***
102     * DOCUMENT ME!
103     *
104     * @param data DOCUMENT ME!
105     */
106    public void postSelect(DbEventInterceptorData data) {
107       postSelectCalled = true;
108    }
109 
110 
111    /***
112     * DOCUMENT ME!
113     *
114     * @param data DOCUMENT ME!
115     */
116    public void postUpdate(DbEventInterceptorData data) {
117       postUpdateCalled = true;
118    }
119 
120 
121    /***
122     * DOCUMENT ME!
123     *
124     * @param data DOCUMENT ME!
125     *
126     * @return DOCUMENT ME!
127     *
128     * @throws ValidationException DOCUMENT ME!
129     * @throws MultipleValidationException DOCUMENT ME!
130     */
131    public int preAddRow(DbEventInterceptorData data)
132                  throws ValidationException, MultipleValidationException {
133       preAddRowCalled = true;
134 
135       return GRANT_OPERATION;
136    }
137 
138 
139    /***
140     * DOCUMENT ME!
141     *
142     * @param data DOCUMENT ME!
143     *
144     * @return DOCUMENT ME!
145     *
146     * @throws ValidationException DOCUMENT ME!
147     * @throws MultipleValidationException DOCUMENT ME!
148     */
149    public int preDelete(DbEventInterceptorData data)
150                  throws ValidationException, MultipleValidationException {
151       preDeleteCalled = true;
152 
153       return GRANT_OPERATION;
154    }
155 
156 
157    /***
158     * DOCUMENT ME!
159     *
160     * @param data DOCUMENT ME!
161     *
162     * @return DOCUMENT ME!
163     *
164     * @throws ValidationException DOCUMENT ME!
165     * @throws MultipleValidationException DOCUMENT ME!
166     */
167    public int preInsert(DbEventInterceptorData data)
168                  throws ValidationException, MultipleValidationException {
169       preInsertCalled = true;
170 
171       return GRANT_OPERATION;
172    }
173 
174 
175    /***
176     * DOCUMENT ME!
177     *
178     * @param data DOCUMENT ME!
179     *
180     * @return DOCUMENT ME!
181     *
182     * @throws ValidationException DOCUMENT ME!
183     * @throws MultipleValidationException DOCUMENT ME!
184     */
185    public int preSelect(DbEventInterceptorData data)
186                  throws ValidationException, MultipleValidationException {
187       preSelectCalled = true;
188 
189       return GRANT_OPERATION;
190    }
191 
192 
193    /***
194     * DOCUMENT ME!
195     *
196     * @param data DOCUMENT ME!
197     *
198     * @return DOCUMENT ME!
199     *
200     * @throws ValidationException DOCUMENT ME!
201     * @throws MultipleValidationException DOCUMENT ME!
202     */
203    public int preUpdate(DbEventInterceptorData data)
204                  throws ValidationException, MultipleValidationException {
205       preUpdateCalled = true;
206 
207       return GRANT_OPERATION;
208    }
209 }