1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/tests/test/interceptors/InterceptorTestClassic.java,v 1.1 2004/10/17 20:27:44 hkollmann Exp $
3    * $Revision: 1.1 $
4    * $Date: 2004/10/17 20:27:44 $
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.DbFormsConfig;
27  import org.dbforms.config.FieldValues;
28  import org.dbforms.config.Table;
29  import org.dbforms.config.ValidationException;
30  
31  import org.dbforms.event.DbEventInterceptorSupport;
32  
33  import java.sql.Connection;
34  import javax.servlet.http.HttpServletRequest;
35  
36  
37  
38  
39  
40  /***
41   * @author hkk
42   *
43   * To change this generated comment go to Window>Preferences>Java>Code
44   * Generation>Code and Comments
45   */
46  public class InterceptorTestClassic extends DbEventInterceptorSupport {
47      public static boolean preInsertCalled = false;
48      public static boolean preSelectCalled = false;
49      public static boolean preUpdateCalled = false;
50      public static boolean preDeleteCalled = false;
51      public static boolean postUpdateCalled = false;
52      public static boolean postSelectCalled = false;
53      public static boolean postInsertCalled = false;
54      public static boolean postDeleteCalled = false;
55  
56  	/* (non-Javadoc)
57  	 * @see org.dbforms.event.DbEventInterceptorSupport#postDelete(javax.servlet.http.HttpServletRequest, org.dbforms.config.DbFormsConfig, java.sql.Connection)
58  	 */
59  	public void postDelete(HttpServletRequest request, DbFormsConfig config,
60  			Connection con) {
61  		postDeleteCalled = true;
62  	}
63  
64  	public void postInsert(HttpServletRequest request, DbFormsConfig config,
65  			Connection con) {
66          postInsertCalled = true;
67  	}
68  
69  	public void postSelect(HttpServletRequest request, DbFormsConfig config,
70  			Connection con) {
71          postSelectCalled = true;
72  }
73  
74  	public void postUpdate(HttpServletRequest request, DbFormsConfig config,
75  			Connection con) {
76          postUpdateCalled = true;
77  	}
78  
79  	public int preDelete(HttpServletRequest request, Table table,
80  			FieldValues fieldValues, DbFormsConfig config, Connection con)
81  			throws ValidationException {
82          preDeleteCalled = true;
83      	return GRANT_OPERATION;
84  	}
85  
86  	public int preInsert(HttpServletRequest request,
87                          Table              table,
88                          FieldValues        fieldValues,
89                          DbFormsConfig      config,
90                          Connection         con) throws ValidationException {
91          preInsertCalled = true;
92      	return GRANT_OPERATION;
93     }
94  
95     public int preSelect(HttpServletRequest request,
96                          DbFormsConfig      config,
97                          Connection         con) {
98         preSelectCalled = true;
99        return GRANT_OPERATION;
100    }
101 
102 
103    public int preUpdate(HttpServletRequest request,
104                         Table              table,
105                         FieldValues        fieldValues,
106                         DbFormsConfig      config,
107                         Connection         con) throws ValidationException {
108         preUpdateCalled = true;
109         return GRANT_OPERATION;
110       }
111 }