View Javadoc

1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/event/classic/NavLastEvent.java,v 1.13 2005/11/30 20:31:17 hkollmann Exp $
3    * $Revision: 1.13 $
4    * $Date: 2005/11/30 20:31:17 $
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 org.dbforms.event.classic;
25  
26  import org.apache.commons.logging.Log;
27  import org.apache.commons.logging.LogFactory;
28  
29  import org.dbforms.config.*;
30  
31  import org.dbforms.event.AbstractNavigationEvent;
32  import org.dbforms.interfaces.DbEventInterceptorData;
33  
34  import java.sql.*;
35  
36  import javax.servlet.http.*;
37  
38  
39  
40  /***
41   * DOCUMENT ME!
42   *
43   * @author Joe Peer
44   *
45   * @deprecated <p>
46   */
47  public class NavLastEvent extends AbstractNavigationEvent {
48     static Log logCat = LogFactory.getLog(NavLastEvent.class.getName()); // logging category for this class
49  
50     /***
51      * Creates a new NavLastEvent object.
52      *
53      * @param action DOCUMENT ME!
54      * @param request DOCUMENT ME!
55      * @param config DOCUMENT ME!
56      */
57     public NavLastEvent(String             action,
58                         HttpServletRequest request,
59                         DbFormsConfig      config) {
60        super(action, request, config);
61     }
62  
63  
64     /***
65      * Creates a new NavLastEvent object.
66      *
67      * @param table DOCUMENT ME!
68      * @param request DOCUMENT ME!
69      * @param config DOCUMENT ME!
70      */
71     public NavLastEvent(Table              table,
72                         HttpServletRequest request,
73                         DbFormsConfig      config) {
74        super(table, request, config);
75     }
76  
77     /***
78      * Process the current event.
79      *
80      * @param childFieldValues FieldValue array used to restrict a set of data
81      * @param orderConstraint FieldValue array used to build a cumulation of
82      *        rules for ordering (sorting) and restricting fields to the actual
83      *        block of data
84      * @param firstPosition DOCUMENT ME!
85      * @param sqlFilterParams a string identifying the last resultset position
86      * @param count record count
87      * @param firstPosition a string identifying the first resultset position
88      * @param lastPosition DOCUMENT ME!
89      * @param dbConnectionName name of the used db connection. Can be used to
90      *        get an own db connection, e.g. to hold it during the session (see
91      *        DataSourceJDBC for example!)
92      * @param con the JDBC Connection object
93      *
94      * @return a ResultSetVector object
95      *
96      * @exception SQLException if any error occurs
97      */
98     public ResultSetVector processEvent(FieldValue[] childFieldValues,
99                                         FieldValue[] orderConstraint,
100                                        String       sqlFilter,
101                                        FieldValue[] sqlFilterParams,
102                                        int          count,
103                                        String       firstPosition,
104                                        String       lastPosition,
105                                        DbEventInterceptorData interceptorData)
106                                 throws SQLException {
107       // select from table in inverted order
108       logCat.info("==>NavLastEvent");
109       FieldValue.invert(orderConstraint);
110 
111       ResultSetVector resultSetVector = getTable()
112                                            .doConstrainedSelect(childFieldValues,
113                                                                 orderConstraint,
114                                                                 sqlFilter,
115                                                                 sqlFilterParams,
116                                                                 Constants.COMPARE_NONE,
117                                                                 count, interceptorData);
118       FieldValue.invert(orderConstraint);
119       resultSetVector.flip();
120 
121       return resultSetVector;
122    }
123 }