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 next row of
44 * data. <br>
45 * Provides bounded navigation.
46 */
47 public class NavNextEvent extends AbstractNavigationEvent {
48 private static Log logCat = LogFactory.getLog(NavNextEvent.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 NavNextEvent(String action, HttpServletRequest request,
58 DbFormsConfig config) {
59 super(action, request, config);
60 }
61
62
63 /***
64 * Constructor used for call from localevent.
65 *
66 * @param table the Table object
67 * @param request DOCUMENT ME!
68 * @param config the config object
69 */
70 public NavNextEvent(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 * @todo make a option to allow original "navNew" behavior if desired
97 */
98 public ResultSetVector processEvent(FieldValue[] childFieldValues,
99 FieldValue[] orderConstraint, String sqlFilter,
100 FieldValue[] sqlFilterParams, int count, String firstPosition,
101 String lastPosition, DbEventInterceptorData interceptorData)
102 throws SQLException {
103 ResultSetVector rsv;
104
105 logCat.info("==>NavNextEvent");
106
107
108 getTable().fillWithValues(orderConstraint, lastPosition);
109 rsv = getTable().doConstrainedSelect(childFieldValues, orderConstraint,
110 sqlFilter, sqlFilterParams, Constants.COMPARE_EXCLUSIVE, count,
111 interceptorData);
112
113 if (rsv.size() == 0) {
114 logCat.info("==>NavNextLastEvent");
115 FieldValue.invert(orderConstraint);
116 rsv = getTable().doConstrainedSelect(childFieldValues,
117 orderConstraint, sqlFilter, sqlFilterParams,
118 Constants.COMPARE_NONE, count, interceptorData);
119 FieldValue.invert(orderConstraint);
120 rsv.flip();
121 }
122
123 return rsv;
124 }
125 }