コード例 #1
0
 private String previousElement(VariablesSecureApp vars, String strSelected, TableSQLData tableSQL)
     throws IOException, ServletException {
   if (strSelected == null || strSelected.equals("")) return firstElement(vars, tableSQL);
   if (tableSQL != null) {
     String data = null;
     try {
       String strSQL =
           ModelSQLGeneration.generateSQLonlyId(
               this,
               vars,
               tableSQL,
               (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"),
               new Vector<String>(),
               new Vector<String>(),
               0,
               0);
       ExecuteQuery execquery =
           new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
       data =
           execquery.selectAndSearch(
               ExecuteQuery.SearchType.PREVIOUS, strSelected, tableSQL.getKeyColumn());
     } catch (Exception e) {
       log4j.error("Error getting previous element", e);
     }
     if (data != null) {
       return data;
     }
   }
   return strSelected;
 }
コード例 #2
0
 private String lastElement(VariablesSecureApp vars, TableSQLData tableSQL)
     throws IOException, ServletException {
   if (tableSQL != null) {
     String data = null;
     try {
       String strSQL =
           ModelSQLGeneration.generateSQLonlyId(
               this,
               vars,
               tableSQL,
               (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"),
               new Vector<String>(),
               new Vector<String>(),
               0,
               0);
       ExecuteQuery execquery =
           new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
       data = execquery.selectAndSearch(ExecuteQuery.SearchType.LAST, "", tableSQL.getKeyColumn());
     } catch (Exception e) {
       log4j.error("Error getting last element", e);
     }
     if (data != null) return data;
   }
   return "";
 }
コード例 #3
0
 private int getKeyPosition(VariablesSecureApp vars, String strSelected, TableSQLData tableSQL)
     throws IOException, ServletException {
   if (log4j.isDebugEnabled()) log4j.debug("getKeyPosition: " + strSelected);
   if (tableSQL != null) {
     String data = null;
     try {
       String strSQL =
           ModelSQLGeneration.generateSQLonlyId(
               this,
               vars,
               tableSQL,
               (tableSQL.getTableName() + "." + tableSQL.getKeyColumn() + " AS ID"),
               new Vector<String>(),
               new Vector<String>(),
               0,
               0);
       ExecuteQuery execquery =
           new ExecuteQuery(this, strSQL, tableSQL.getParameterValuesOnlyId());
       data =
           execquery.selectAndSearch(
               ExecuteQuery.SearchType.GETPOSITION, strSelected, tableSQL.getKeyColumn());
     } catch (Exception e) {
       log4j.error("Error getting key position", e);
     }
     if (data != null) {
       // split offset -> (page,relativeOffset)
       int absoluteOffset = Integer.valueOf(data);
       int page = absoluteOffset / TableSQLData.maxRowsPerGridPage;
       int relativeOffset = absoluteOffset % TableSQLData.maxRowsPerGridPage;
       log4j.debug(
           "getKeyPosition: absOffset: "
               + absoluteOffset
               + "=> page: "
               + page
               + " relOffset: "
               + relativeOffset);
       String currPageKey = tabId + "|" + "currentPage";
       vars.setSessionValue(currPageKey, String.valueOf(page));
       return relativeOffset;
     }
   }
   return 0;
 }