1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.dbforms.event.classic;
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 import org.dbforms.config.*;
28
29 import org.dbforms.event.*;
30 import org.dbforms.interfaces.DbEventInterceptorData;
31
32 import java.sql.*;
33
34 import javax.servlet.http.*;
35
36
37
38 /***
39 * DOCUMENT ME!
40 *
41 * @author Joe Peer, John Peterson
42 *
43 * @deprecated This event scrolls the current ResultSet to the previous row of
44 * data. <br>
45 * Provides bounded navigation.
46 */
47 public class NavPrevEvent extends AbstractNavigationEvent {
48 private static Log logCat = LogFactory.getLog(NavPrevEvent.class.getName());
49
50 /***
51 * Constructor.
52 *
53 * @param action the action string
54 * @param request the request object
55 * @param config the config object
56 */
57 public NavPrevEvent(String action, HttpServletRequest request,
58 DbFormsConfig config) {
59 super(action, request, config);
60 }
61
62
63 /***
64 * Constructor used for call from localevents.
65 *
66 * @param table the Table object
67 * @param request DOCUMENT ME!
68 * @param config the config object
69 */
70 public NavPrevEvent(Table table, HttpServletRequest request,
71 DbFormsConfig config) {
72 super(table, request, config);
73 }
74
75 /***
76 * Process the current event.
77 *
78 * @param childFieldValues FieldValue array used to restrict a set of data
79 * @param orderConstraint FieldValue array used to build a cumulation of
80 * rules for ordering (sorting) and restricting fields to the actual
81 * block of data
82 * @param firstPosition DOCUMENT ME!
83 * @param sqlFilterParams a string identifying the last resultset position
84 * @param count record count
85 * @param firstPosition a string identifying the first resultset position
86 * @param lastPosition DOCUMENT ME!
87 * @param dbConnectionName name of the used db connection. Can be used to
88 * get an own db connection, e.g. to hold it during the session (see
89 * DataSourceJDBC for example!)
90 * @param con the JDBC Connection object
91 *
92 * @return a ResultSetVector object
93 *
94 * @exception SQLException if any error occurs
95 */
96 public ResultSetVector processEvent(FieldValue[] childFieldValues,
97 FieldValue[] orderConstraint, String sqlFilter,
98 FieldValue[] sqlFilterParams, int count, String firstPosition,
99 String lastPosition, DbEventInterceptorData interceptorData)
100 throws SQLException {
101 logCat.info("==>NavPrevEvent");
102
103
104 getTable().fillWithValues(orderConstraint, firstPosition);
105 FieldValue.invert(orderConstraint);
106
107 ResultSetVector resultSetVector = getTable().doConstrainedSelect(childFieldValues,
108 orderConstraint, sqlFilter, sqlFilterParams,
109 Constants.COMPARE_EXCLUSIVE, count, interceptorData);
110
111 FieldValue.invert(orderConstraint);
112 resultSetVector.flip();
113
114
115 if (resultSetVector.size() == 0) {
116
117 logCat.info("==>NavPrevFirstEvent");
118 resultSetVector = getTable().doConstrainedSelect(childFieldValues,
119 orderConstraint, sqlFilter, sqlFilterParams,
120 Constants.COMPARE_NONE, count, interceptorData);
121 }
122
123 return resultSetVector;
124 }
125 }