QueryUtil

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openswing.swing.server
Class QueryUtil

    java.lang.Object
      org.openswing.swing.server.QueryUtil

public class QueryUtil
extends java.lang.Object

Title: OpenSwing Framework

Description: Utility (singleton) class used with queries.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

Constructor Summary
`QueryUtil()`

Method Summary

`static Response`

`getQuery(java.sql.Connection conn, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, boolean logQuery)`

`static Response`

`getQuery(java.sql.Connection conn, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, GridParams gridParams, boolean logQuery)`
This method read the WHOLE result set.

`static Response`

`getQuery(java.sql.Connection conn, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, GridParams gridParams, int blockSize, boolean logQuery)`
This method read a block of record from the result set.

`static Response`

`getQuery(java.sql.Connection conn, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, boolean logQuery)`
SQL is expressed using more argument, each one without the related keyword (select, from, ...).

`static Response`

`getQuery(java.sql.Connection conn, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, GridParams gridParams, boolean logQuery)`
This method read the WHOLE result set.

`static Response`

`getQuery(java.sql.Connection conn, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, GridParams gridParams, int blockSize, boolean logQuery)`
This method read a block of record from the result set.

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, boolean logQuery)`

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, GridParams gridParams, boolean logQuery)`
This method read the WHOLE result set.

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, GridParams gridParams, int blockSize, boolean logQuery)`
This method read a block of record from the result set.

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, GridParams gridParams, int blockSize, boolean logQuery, boolean fetchTotalResultSetLength)`
This method read a block of record from the result set.

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, boolean logQuery)`
SQL is expressed using more argument, each one without the related keyword (select, from, ...).

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, GridParams gridParams, boolean logQuery)`
This method read the WHOLE result set.

`static Response`

`getQuery(java.sql.Connection conn, UserSessionParameters userSessionPars, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map attribute2dbField, java.lang.Class valueObjectClass, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, GridParams gridParams, int blockSize, boolean logQuery)`
This method read a block of record from the result set.

`static Response` | `getQuery(java.lang.String[] attributes, java.lang.Class valueObjectClass, java.util.List rows, boolean moreRows)` This method can be used to convert a list of Object[], one for each record already read, in a list of ValueObjects.
`static Response` | `getQuery(java.lang.String[] attributes, java.lang.Class valueObjectClass, java.lang.Object[] row)` This method can be used to convert a single record Object[]to a ValueObject.

`static java.lang.String`

`getSql(UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList attrNames, java.util.ArrayList values, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.util.Map attributesMapping)`
This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

`static java.lang.String`

`getSql(UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList attrNames, java.util.ArrayList values, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.util.Map attributesMapping, boolean isJPAsyntax)`
This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

`static java.lang.String`

`getSql(UserSessionParameters userSessionPars, java.lang.String baseSQL, java.util.ArrayList values, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.util.Map attributesMapping)`

`static java.lang.String`

`getSql(UserSessionParameters userSessionPars, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList attrNames, java.util.ArrayList values, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.util.Map attributesMapping)`
This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

`static java.lang.String`

`getSql(UserSessionParameters userSessionPars, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList attrNames, java.util.ArrayList values, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.util.Map attributesMapping, boolean isJPAsyntax)`
This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

`static java.lang.String`

`getSql(UserSessionParameters userSessionPars, java.lang.String select, java.lang.String from, java.lang.String where, java.lang.String group, java.lang.String having, java.lang.String order, java.util.ArrayList values, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.util.Map attributesMapping)`
This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

`static Response` | `insertTable(java.sql.Connection conn, java.util.ArrayList vos, java.lang.String tableName, java.util.Map attribute2dbField, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, boolean logSQL)` This method esecute many insert on a table, by means of a list of value objects and a subset of its fields: all field related to that table.

`static Response`

`insertTable(java.sql.Connection conn, UserSessionParameters userSessionPars, java.util.ArrayList vos, java.lang.String tableName, java.util.Map attribute2dbField, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, boolean logSQL)`
This method esecute many insert on a table, by means of a list of value objects and a subset of its fields: all field related to that table.

`static Response`

`insertTable(java.sql.Connection conn, UserSessionParameters userSessionPars, ValueObject vo, java.lang.String tableName, java.util.Map attribute2dbField, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, boolean logSQL)`
This method esecute an insert on a table, by means of the value object and a subset of its fields: all field related to that table.

`static Response` | `insertTable(java.sql.Connection conn, ValueObject vo, java.lang.String tableName, java.util.Map attribute2dbField, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, boolean logSQL)` This method execute an insert on a table, by means of the value object and a subset of its fields: all field related to that table.

`static Response`

`updateTable(java.sql.Connection conn, java.util.HashSet pkAttributes, ValueObject oldVO, ValueObject newVO, java.lang.String tableName, java.util.Map attribute2dbField, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, boolean logSQL)`
This method esecute an update on a table, by means of the value object and a subset of its fields: all field related to that table.

`static Response`

`updateTable(java.sql.Connection conn, UserSessionParameters userSessionPars, java.util.HashSet pkAttributes, ValueObject oldVO, ValueObject newVO, java.lang.String tableName, java.util.Map attribute2dbField, java.lang.String booleanTrueValue, java.lang.String booleanFalseValue, javax.servlet.ServletContext context, boolean logSQL)`
This method esecute an update on a table, by means of the value object and a subset of its fields: all field related to that table.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### QueryUtil

    public QueryUtil()

Method Detail

### getSql

    public static java.lang.String getSql(UserSessionParameters userSessionPars,
                                          java.lang.String baseSQL,
                                          java.util.ArrayList values,
                                          java.util.Map filteredColumns,
                                          java.util.ArrayList currentSortedColumns,
                                          java.util.ArrayList currentSortedVersusColumns,
                                          java.util.Map attributesMapping)

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `filteredColumns` - columns to add in the WHERE clause
    `currentSortedColumns` - columns to add in the ORDER clause
    `currentSortedVersusColumns` - ordering versus
    `attributesMapping` - collection of pairs attributeName, corresponding database column (table.column)
  Returns:
    baseSQL + filtering and ordering conditions

### getSql

    public static java.lang.String getSql(UserSessionParameters userSessionPars,
                                          java.lang.String baseSQL,
                                          java.util.ArrayList attrNames,
                                          java.util.ArrayList values,
                                          java.util.Map filteredColumns,
                                          java.util.ArrayList currentSortedColumns,
                                          java.util.ArrayList currentSortedVersusColumns,
                                          java.util.Map attributesMapping)

  This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `attrNames` - attribute names related to filter values
    `values` - binding values related to baseSQL
    `filteredColumns` - columns to add in the WHERE clause
    `currentSortedColumns` - columns to add in the ORDER clause
    `currentSortedVersusColumns` - ordering versus
    `attributesMapping` - collection of pairs attributeName, corresponding database column (table.column)
  Returns:
    baseSQL + filtering and ordering conditions

### getSql

    public static java.lang.String getSql(UserSessionParameters userSessionPars,
                                          java.lang.String select,
                                          java.lang.String from,
                                          java.lang.String where,
                                          java.lang.String group,
                                          java.lang.String having,
                                          java.lang.String order,
                                          java.util.ArrayList values,
                                          java.util.Map filteredColumns,
                                          java.util.ArrayList currentSortedColumns,
                                          java.util.ArrayList currentSortedVersusColumns,
                                          java.util.Map attributesMapping)

  This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `filteredColumns` - columns to add in the WHERE clause
    `currentSortedColumns` - columns to add in the ORDER clause
    `currentSortedVersusColumns` - ordering versus
    `attributesMapping` - collection of pairs attributeName, corresponding database column (table.column)
  Returns:
    baseSQL + filtering and ordering conditions

### getSql

    public static java.lang.String getSql(UserSessionParameters userSessionPars,
                                          java.lang.String select,
                                          java.lang.String from,
                                          java.lang.String where,
                                          java.lang.String group,
                                          java.lang.String having,
                                          java.lang.String order,
                                          java.util.ArrayList attrNames,
                                          java.util.ArrayList values,
                                          java.util.Map filteredColumns,
                                          java.util.ArrayList currentSortedColumns,
                                          java.util.ArrayList currentSortedVersusColumns,
                                          java.util.Map attributesMapping)

  This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `attrNames` - attribute names related to filter values
    `values` - binding values related to baseSQL
    `filteredColumns` - columns to add in the WHERE clause
    `currentSortedColumns` - columns to add in the ORDER clause
    `currentSortedVersusColumns` - ordering versus
    `attributesMapping` - collection of pairs attributeName, corresponding database column (table.column)
  Returns:
    baseSQL + filtering and ordering conditions

### getSql

    public static java.lang.String getSql(UserSessionParameters userSessionPars,
                                          java.lang.String select,
                                          java.lang.String from,
                                          java.lang.String where,
                                          java.lang.String group,
                                          java.lang.String having,
                                          java.lang.String order,
                                          java.util.ArrayList attrNames,
                                          java.util.ArrayList values,
                                          java.util.Map filteredColumns,
                                          java.util.ArrayList currentSortedColumns,
                                          java.util.ArrayList currentSortedVersusColumns,
                                          java.util.Map attributesMapping,
                                          boolean isJPAsyntax)

  This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `attrNames` - attribute names related to filter values
    `values` - binding values related to baseSQL
    `filteredColumns` - columns to add in the WHERE clause
    `currentSortedColumns` - columns to add in the ORDER clause
    `currentSortedVersusColumns` - ordering versus
    `attributesMapping` - collection of pairs attributeName, corresponding database column (table.column)
    `isJPAsyntax` - flag
  Returns:
    baseSQL + filtering and ordering conditions

### getSql

    public static java.lang.String getSql(UserSessionParameters userSessionPars,
                                          java.lang.String baseSQL,
                                          java.util.ArrayList attrNames,
                                          java.util.ArrayList values,
                                          java.util.Map filteredColumns,
                                          java.util.ArrayList currentSortedColumns,
                                          java.util.ArrayList currentSortedVersusColumns,
                                          java.util.Map attributesMapping,
                                          boolean isJPAsyntax)

  This constructor can be useful when combining OpenSwing with Hibernate, to retrieve attribute names too.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `attrNames` - attribute names related to filter values
    `values` - binding values related to baseSQL
    `filteredColumns` - columns to add in the WHERE clause
    `currentSortedColumns` - columns to add in the ORDER clause
    `currentSortedVersusColumns` - ordering versus
    `attributesMapping` - collection of pairs attributeName, corresponding database column (table.column)
    `isJPAsyntax` - flag
  Returns:
    baseSQL + filtering and ordering conditions

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    GridParams gridParams,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read the WHOLE result set.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    java.lang.String select,
                                    java.lang.String from,
                                    java.lang.String where,
                                    java.lang.String group,
                                    java.lang.String having,
                                    java.lang.String order,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    GridParams gridParams,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read the WHOLE result set. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    GridParams gridParams,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read the WHOLE result set.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String select,
                                    java.lang.String from,
                                    java.lang.String where,
                                    java.lang.String group,
                                    java.lang.String having,
                                    java.lang.String order,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    GridParams gridParams,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read the WHOLE result set. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    GridParams gridParams,
                                    int blockSize,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read a block of record from the result set.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `blockSize` - number of rows to read
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    java.lang.String select,
                                    java.lang.String from,
                                    java.lang.String where,
                                    java.lang.String group,
                                    java.lang.String having,
                                    java.lang.String order,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    GridParams gridParams,
                                    int blockSize,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read a block of record from the result set. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `blockSize` - number of rows to read
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    GridParams gridParams,
                                    int blockSize,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read a block of record from the result set.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `blockSize` - number of rows to read
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    GridParams gridParams,
                                    int blockSize,
                                    boolean logQuery,
                                    boolean fetchTotalResultSetLength)
                             throws java.lang.Exception

  This method read a block of record from the result set.

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `blockSize` - number of rows to read
    `logQuery` - `true` to log the query, `false` to no log the query
    `fetchTotalResultSetLength` - fetch all result set length; be careful: this task could slow down the data retrieval
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String select,
                                    java.lang.String from,
                                    java.lang.String where,
                                    java.lang.String group,
                                    java.lang.String having,
                                    java.lang.String order,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    GridParams gridParams,
                                    int blockSize,
                                    boolean logQuery)
                             throws java.lang.Exception

  This method read a block of record from the result set. SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `gridParams` - grid parameters (filtering/ordering settings, starting row to read, read versus)
    `blockSize` - number of rows to read
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    a list of value objects (in VOListResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    boolean logQuery)
                             throws java.lang.Exception

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    one value object (in VOResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    java.lang.String select,
                                    java.lang.String from,
                                    java.lang.String where,
                                    java.lang.String group,
                                    java.lang.String having,
                                    java.lang.String order,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    boolean logQuery)
                             throws java.lang.Exception

  SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    one value object (in VOResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String baseSQL,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    boolean logQuery)
                             throws java.lang.Exception

  Parameters:
    `baseSQL` - SQL to change by adding filter and order clauses
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    one value object (in VOResponse object) or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.sql.Connection conn,
                                    UserSessionParameters userSessionPars,
                                    java.lang.String select,
                                    java.lang.String from,
                                    java.lang.String where,
                                    java.lang.String group,
                                    java.lang.String having,
                                    java.lang.String order,
                                    java.util.ArrayList values,
                                    java.util.Map attribute2dbField,
                                    java.lang.Class valueObjectClass,
                                    java.lang.String booleanTrueValue,
                                    java.lang.String booleanFalseValue,
                                    javax.servlet.ServletContext context,
                                    boolean logQuery)
                             throws java.lang.Exception

  SQL is expressed using more argument, each one without the related keyword (select, from, ...). Example: following query select customer_code,corporate_name from companies order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,corporate_name","companies","","customer_code asc","","",...); Example: following query select customer_code,customername from (select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates) order by customer_code asc become an invokation of getSql: getSql(userSessionPars,"customer_code,customername","(select customer_code,corporate_name as customername from companies union select customer_code,name as customername from privates)","","customer_code asc","","",...);

  Parameters:
    `select` - list of fields for select statement
    `from` - list of tables for from statement
    `where` - where statement; may be null
    `group` - group by statement; may be null
    `having` - having statement; may be null
    `order` - list of fields for order by statement; may be null
    `values` - binding values related to baseSQL
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields is the select clause
    `valueObjectClass` - value object class to use to generate the result
    `booleanTrueValue` - read value to interpret as true
    `booleanFalseValue` - read value to interpret as false
    `context` - servlet context; this may be null
    `logQuery` - `true` to log the query, `false` to no log the query
  Returns:
    one value object (in VOResponse object) or an error response
  Throws:
    `java.lang.Exception`

### insertTable

    public static Response insertTable(java.sql.Connection conn,
                                       ValueObject vo,
                                       java.lang.String tableName,
                                       java.util.Map attribute2dbField,
                                       java.lang.String booleanTrueValue,
                                       java.lang.String booleanFalseValue,
                                       boolean logSQL)
                                throws java.lang.Exception

  This method execute an insert on a table, by means of the value object and a subset of its fields: all field related to that table.

  Parameters:
    `vo` - value object to use on insert
    `tableName` - table name to use on insert
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields related to the specified table
    `booleanTrueValue` - value to interpret as true
    `booleanFalseValue` - value to interpret as false
    `logSQL` - `true` to log the SQL, `false` to no log the SQL
  Returns:
    the insert response
  Throws:
    `java.lang.Exception`

### insertTable

    public static Response insertTable(java.sql.Connection conn,
                                       UserSessionParameters userSessionPars,
                                       ValueObject vo,
                                       java.lang.String tableName,
                                       java.util.Map attribute2dbField,
                                       java.lang.String booleanTrueValue,
                                       java.lang.String booleanFalseValue,
                                       javax.servlet.ServletContext context,
                                       boolean logSQL)
                                throws java.lang.Exception

  This method esecute an insert on a table, by means of the value object and a subset of its fields: all field related to that table.

  Parameters:
    `vo` - value object to use on insert
    `tableName` - table name to use on insert
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields related to the specified table
    `booleanTrueValue` - value to interpret as true
    `booleanFalseValue` - value to interpret as false
    `context` - servlet context; this may be null
    `logSQL` - `true` to log the SQL, `false` to no log the SQL
  Returns:
    the insert response
  Throws:
    `java.lang.Exception`

### insertTable

    public static Response insertTable(java.sql.Connection conn,
                                       java.util.ArrayList vos,
                                       java.lang.String tableName,
                                       java.util.Map attribute2dbField,
                                       java.lang.String booleanTrueValue,
                                       java.lang.String booleanFalseValue,
                                       boolean logSQL)
                                throws java.lang.Exception

  This method esecute many insert on a table, by means of a list of value objects and a subset of its fields: all field related to that table.

  Parameters:
    `vos` - list of ValueObject's to use on insert operations
    `tableName` - table name to use on insert
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields related to the specified table
    `booleanTrueValue` - value to interpret as true
    `booleanFalseValue` - value to interpret as false
    `logSQL` - `true` to log the SQL, `false` to no log the SQL
  Returns:
    the insert response (VOListResponse object or an ErrorResponse object)
  Throws:
    `java.lang.Exception`

### insertTable

    public static Response insertTable(java.sql.Connection conn,
                                       UserSessionParameters userSessionPars,
                                       java.util.ArrayList vos,
                                       java.lang.String tableName,
                                       java.util.Map attribute2dbField,
                                       java.lang.String booleanTrueValue,
                                       java.lang.String booleanFalseValue,
                                       javax.servlet.ServletContext context,
                                       boolean logSQL)
                                throws java.lang.Exception

  This method esecute many insert on a table, by means of a list of value objects and a subset of its fields: all field related to that table.

  Parameters:
    `vos` - list of ValueObject's to use on insert operations
    `tableName` - table name to use on insert
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields related to the specified table
    `booleanTrueValue` - value to interpret as true
    `booleanFalseValue` - value to interpret as false
    `context` - servlet context; this may be null
    `logSQL` - `true` to log the SQL, `false` to no log the SQL
  Returns:
    the insert response (VOListResponse object or an ErrorResponse object)
  Throws:
    `java.lang.Exception`

### updateTable

    public static Response updateTable(java.sql.Connection conn,
                                       java.util.HashSet pkAttributes,
                                       ValueObject oldVO,
                                       ValueObject newVO,
                                       java.lang.String tableName,
                                       java.util.Map attribute2dbField,
                                       java.lang.String booleanTrueValue,
                                       java.lang.String booleanFalseValue,
                                       boolean logSQL)
                                throws java.lang.Exception

  This method esecute an update on a table, by means of the value object and a subset of its fields: all field related to that table. The update operation verifies if the record is yet the same as when the v.o. was read (concurrent access resolution).

  Parameters:
    `pkAttributes` - v.o. attributes related to the primary key of the table
    `oldVO` - previous value object to use on the where clause
    `newVO` - new value object to use on update
    `tableName` - table name to use on update
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields related to the specified table
    `booleanTrueValue` - value to interpret as true
    `booleanFalseValue` - value to interpret as false
    `logSQL` - `true` to log the SQL, `false` to no log the SQL
  Returns:
    the update response
  Throws:
    `java.lang.Exception`

### updateTable

    public static Response updateTable(java.sql.Connection conn,
                                       UserSessionParameters userSessionPars,
                                       java.util.HashSet pkAttributes,
                                       ValueObject oldVO,
                                       ValueObject newVO,
                                       java.lang.String tableName,
                                       java.util.Map attribute2dbField,
                                       java.lang.String booleanTrueValue,
                                       java.lang.String booleanFalseValue,
                                       javax.servlet.ServletContext context,
                                       boolean logSQL)
                                throws java.lang.Exception

  This method esecute an update on a table, by means of the value object and a subset of its fields: all field related to that table. The update operation verifies if the record is yet the same as when the v.o. was read (concurrent access resolution).

  Parameters:
    `pkAttributes` - v.o. attributes related to the primary key of the table
    `oldVO` - previous value object to use on the where clause
    `newVO` - new value object to use on update
    `tableName` - table name to use on update
    `attribute2dbField` - collection of pairs attributeName, corresponding database column (table.column) - for ALL fields related to the specified table
    `booleanTrueValue` - value to interpret as true
    `booleanFalseValue` - value to interpret as false
    `context` - servlet context; this may be null
    `logSQL` - `true` to log the SQL, `false` to no log the SQL
  Returns:
    the update response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.lang.String[] attributes,
                                    java.lang.Class valueObjectClass,
                                    java.util.List rows,
                                    boolean moreRows)
                             throws java.lang.Exception

  This method can be used to convert a list of Object[], one for each record already read, in a list of ValueObjects.

  Parameters:
    `attributes` - list of attribute names of the specified value object, exactly one for each fields is the select clause (i.e. one for each elements of Object[])
    `valueObjectClass` - value object class to use to generate the result
    `rows` - list of Object[] elements, one for each record already read
    `moreRows` - `true` if there are still other records to read after these ones, `false` if no other records ara available
  Returns:
    a list of value objects or an error response
  Throws:
    `java.lang.Exception`

### getQuery

    public static Response getQuery(java.lang.String[] attributes,
                                    java.lang.Class valueObjectClass,
                                    java.lang.Object[] row)
                             throws java.lang.Exception

  This method can be used to convert a single record Object[]to a ValueObject.

  Parameters:
    `attributes` - list of attribute names of the specified value object, exactly one for each fields is the select clause (i.e. one for each elements of Object[])
    `valueObjectClass` - value object class to use to generate the result
    `row` - Object[], related to the record already read
  Returns:
    value object or an error response
  Throws:
    `java.lang.Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD