1 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 31 import java.sql.*; 32 33 import javax.servlet.http.*; 34 35 36 37 46 public class NavPrevEvent extends NavigationEvent { 47 private static Log logCat = LogFactory.getLog(NavPrevEvent.class.getName()); 49 56 public NavPrevEvent(String action, HttpServletRequest request, 57 DbFormsConfig config) { 58 super(action, request, config); 59 } 60 61 62 69 public NavPrevEvent(Table table, HttpServletRequest request, 70 DbFormsConfig config) { 71 super(table, request, config); 72 } 73 74 95 public ResultSetVector processEvent(FieldValue[] childFieldValues, 96 FieldValue[] orderConstraint, String sqlFilter, 97 FieldValue[] sqlFilterParams, int count, String firstPosition, 98 String lastPosition, DbEventInterceptorData interceptorData) 99 throws SQLException { 100 logCat.info("==>NavPrevEvent"); 101 102 getTable().fillWithValues(orderConstraint, firstPosition); 104 FieldValue.invert(orderConstraint); 105 106 ResultSetVector resultSetVector = getTable().doConstrainedSelect(childFieldValues, 107 orderConstraint, sqlFilter, sqlFilterParams, 108 Constants.COMPARE_EXCLUSIVE, count, interceptorData); 109 110 FieldValue.invert(orderConstraint); 111 resultSetVector.flip(); 112 113 if (resultSetVector.size() == 0) { 115 logCat.info("==>NavPrevFirstEvent"); 117 resultSetVector = getTable().doConstrainedSelect(childFieldValues, 118 orderConstraint, sqlFilter, sqlFilterParams, 119 Constants.COMPARE_NONE, count, interceptorData); 120 } 121 122 return resultSetVector; 123 } 124 } 125 | Popular Tags |