View Javadoc

1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/interfaces/DbEventInterceptorData.java,v 1.3 2006/02/05 13:38:28 hkollmann Exp $
3    * $Revision: 1.3 $
4    * $Date: 2006/02/05 13:38:28 $
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  package org.dbforms.interfaces;
24  
25  import java.sql.Connection;
26  
27  import java.util.HashMap;
28  import java.util.Map;
29  
30  import javax.servlet.http.HttpServletRequest;
31  
32  import org.dbforms.config.DbFormsConfig;
33  import org.dbforms.config.Table;
34  
35  /***
36   * Class to transport the data in the interceptors.
37   * 
38   * @author hkk
39   */
40  public class DbEventInterceptorData {
41  
42  	/*** filled with FieldValues array during insert, delete and update events */
43  	public static final String FIELDVALUES = "fieldValues";
44  
45  	/*** filled with KeyValues string during delete and update events */
46  	public static final String KEYVALUES = "keyValues";
47  
48  	/*** filled with current ResultsetVector during AddRow and Select events */
49  	public static final String RESULTSET = "ResultSetVector";
50  
51  	/*** filled with objectrow which should be added during AddRow events */
52  	public static final String OBJECTROW = "ObjectRow";
53  
54  	/*** filled with the currently used connection name in all events */
55  	public static final String CONNECTIONNAME = "connectionName";
56  
57  	/*** filled with the pageContext during select events */
58  	public static final String PAGECONTEXT = "pageContext";
59  
60  	/*** filled with the current form during select events */
61  	public static final String FORMTAG = "formTag";
62  
63  	/*** filled with affected rows during insert/update/delete event */
64  	public static final String ROWSAFFECTED = "rowsAffected";
65  
66  	private HttpServletRequest request;
67  
68  	private DbFormsConfig config;
69  
70  	private Connection connection;
71  
72  	private Table table;
73  
74  	private Map attributes = new HashMap();
75  
76  	private ISqlFilter sqlFilterTag;
77  
78  	/***
79  	 * Creates a new DbEventInterceptorData object.
80  	 * 
81  	 * @param request
82  	 *            DOCUMENT ME!
83  	 * @param config
84  	 *            DOCUMENT ME!
85  	 * @param connection
86  	 *            DOCUMENT ME!
87  	 */
88  	public DbEventInterceptorData(HttpServletRequest request,
89  			DbFormsConfig config, Connection connection, Table table) {
90  		this.request = request;
91  		this.config = config;
92  		this.connection = connection;
93  		this.table = table;
94  	}
95  
96  	/***
97  	 * DOCUMENT ME!
98  	 * 
99  	 * @return DOCUMENT ME!
100 	 */
101 	public Map getAttributesMap() {
102 		return attributes;
103 	}
104 
105 	/***
106 	 * reads a value from the attributes list
107 	 * 
108 	 * @param key
109 	 *            key to read
110 	 * 
111 	 * @return The value. If not found null
112 	 */
113 	public Object getAttribute(String key) {
114 		return attributes.get(key);
115 	}
116 
117 	/***
118 	 * Stores a value in the attributes list
119 	 * 
120 	 * @param key
121 	 *            key for the value
122 	 * @param value
123 	 *            value to store
124 	 */
125 	public void setAttribute(String key, Object value) {
126 		attributes.put(key, value);
127 	}
128 
129 	/***
130 	 * Removes a value in the attributes list
131 	 * 
132 	 * @param key
133 	 *            key for the value
134 	 */
135 	public void removeAttribute(String key) {
136 		attributes.remove(key);
137 	}
138 
139 	/***
140 	 * @return Returns the config.
141 	 */
142 	public DbFormsConfig getConfig() {
143 		return config;
144 	}
145 
146 	/***
147 	 * @return Returns the connection.
148 	 */
149 	public Connection getConnection() {
150 		return connection;
151 	}
152 
153 	/***
154 	 * @return Returns the request.
155 	 */
156 	public HttpServletRequest getRequest() {
157 		return request;
158 	}
159 
160 	/***
161 	 * @return Returns the table.
162 	 */
163 	public Table getTable() {
164 		return table;
165 	}
166 
167 	public ISqlFilter getSqlFilterTag() {
168 		return sqlFilterTag;
169 	}
170 
171 	public void setSqlFilterTag(ISqlFilter sqlFilterTag) {
172 		this.sqlFilterTag = sqlFilterTag;
173 	}
174 }