KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > event > datalist > NavLastEvent


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/event/datalist/NavLastEvent.java,v 1.15 2004/10/20 10:51:49 hkollmann Exp $
3  * $Revision: 1.15 $
4  * $Date: 2004/10/20 10:51:49 $
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.event.datalist;
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 import org.dbforms.config.DbEventInterceptorData;
28 import org.dbforms.config.DbFormsConfig;
29 import org.dbforms.config.FieldValue;
30 import org.dbforms.config.ResultSetVector;
31 import org.dbforms.config.Table;
32
33 import org.dbforms.event.NavigationEvent;
34 import org.dbforms.event.datalist.dao.DataSourceFactory;
35 import org.dbforms.event.datalist.dao.DataSourceSessionList;
36
37 import java.sql.SQLException JavaDoc;
38
39 import javax.servlet.http.HttpServletRequest JavaDoc;
40
41
42
43 /**
44  * This event scrolls the current ResultSet to its last row of data. <br>
45  * Works with new factory classes
46  *
47  * @author Henner Kollmann
48  */

49 public class NavLastEvent extends NavigationEvent {
50    // logging category for this class
51
private static Log logCat = LogFactory.getLog(NavLastEvent.class.getName());
52
53    /**
54     * Creates a new NavLastEvent object.
55     *
56     * @param action the action string
57     * @param request the request object
58     * @param config the config object
59     */

60    public NavLastEvent(String JavaDoc action, HttpServletRequest JavaDoc request,
61       DbFormsConfig config) {
62       super(action, request, config);
63    }
64
65
66    /**
67     * Creates a new NavLastEvent object.
68     *
69     * @param table the input table object
70     * @param request the request object
71     * @param config the config object
72     */

73    public NavLastEvent(Table table, HttpServletRequest JavaDoc request,
74       DbFormsConfig config) {
75       super(table, request, config);
76    }
77
78    /**
79     * Process the current event.
80     *
81     * @param filterFieldValues FieldValue array used to restrict a set of data
82     * @param orderConstraint FieldValue array used to build a cumulation of
83     * rules for ordering (sorting) and restricting fields to the actual
84     * block of data
85     * @param sqlFilter DOCUMENT ME!
86     * @param sqlFilterParams DOCUMENT ME!
87     * @param count record count
88     * @param firstPosition a string identifying the first resultset position
89     * @param lastPosition a string identifying the last resultset position
90     * @param dbConnectionName name of the used db connection. Can be used to
91     * get an own db connection, e.g. to hold it during the session (see
92     * DataSourceJDBC for example!)
93     * @param con the JDBC Connection object
94     *
95     * @return a ResultSetVector object
96     *
97     * @exception SQLException if any error occurs
98     */

99    public ResultSetVector processEvent(FieldValue[] filterFieldValues,
100       FieldValue[] orderConstraint, String JavaDoc sqlFilter,
101       FieldValue[] sqlFilterParams, int count, String JavaDoc firstPosition,
102       String JavaDoc lastPosition, DbEventInterceptorData interceptorData)
103       throws SQLException JavaDoc {
104       logCat.info("==>NavLastEvent.processEvent");
105
106       DataSourceSessionList ds = DataSourceSessionList.getInstance(getRequest());
107       DataSourceFactory qry = ds.get(getTable(), getRequest());
108
109       if (qry == null) {
110          qry = new DataSourceFactory((String JavaDoc) interceptorData.getAttribute(
111                   DbEventInterceptorData.CONNECTIONNAME),
112                interceptorData.getConnection(), getTable());
113          qry.setSelect(filterFieldValues, orderConstraint, sqlFilter,
114             sqlFilterParams);
115          ds.put(getTable(), getRequest(), qry);
116       }
117
118       return qry.getLast(interceptorData, count);
119    }
120 }
121
Popular Tags