org.dbforms.config
Class Table

java.lang.Object
  extended by org.dbforms.config.Table
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Query

public class Table
extends Object
implements Serializable

This class represents a table tag in dbforms-config.xml (dbforms config xml file).
It also defines a lot of methods for preparing and actually performing operations (queries) on the table

Author:
Joe Peer
See Also:
Serialized Form

Field Summary
static int BLOB_CLASSIC
          DOCUMENT ME!
static int BLOB_INTERCEPTOR
          either "classic" or "interceptor", default is "interceptor"
protected static int CALC_FIELD
          DOCUMENT ME!
protected static int DB_FIELD
          DOCUMENT ME!
protected static int SEARCH_FIELD
          DOCUMENT ME!
 
Constructor Summary
Table()
           
 
Method Summary
 void addCalcField(Field field)
          adds a Field-Object to this table and puts it into othere datastructure for further references (this method gets called from DbFormsConfig)
 void addField(Field field)
          Adds a Field-Object to this table and puts it into othere datastructure for further references (this method gets called from DbFormsConfig)
 void addForeignKey(ForeignKey fk)
          Adds a ForeignKey-Object to this table and puts it into othere datastructure for further references (this method gets called from DbFormsConfig)
 void addInterceptor(Interceptor interceptor)
          Add an interceptor to this table.
protected  boolean checkFieldId(int type, int aid)
          DOCUMENT ME!
 boolean containsDiskblob()
          Determinates if this table contains a diskblob field.
 FieldValue[] createOrderFieldValues(String order, HttpServletRequest request, boolean includeKeys)
          Column ["ASC" | "DESC"] {"," Column ["ASC" | "DESC"] } (if neither ASC nor DESC follow "Col", then ASC is choosen as default).
protected  int decodeFieldId(int type, int aid)
          DOCUMENT ME!
 ResultSetVector doConstrainedSelect(FieldValue[] fvEqual, FieldValue[] fvOrder, String sqlFilter, FieldValue[] sqlFilterParams, int compareMode, int maxRows, DbEventInterceptorData interceptorData)
          Do a constrained select.
 ResultSetVector doFreeFormSelect(String whereClause, String tableList, int maxRows, DbEventInterceptorData interceptorData)
          perform free-form select query
protected  int encodeFieldId(int type, int aid)
          DOCUMENT ME!
 void fillWithValues(FieldValue[] orderConstraint, String aPosition)
          in version 0.9 this method moved from FieldValue.fillWithValues to Table.fillWithValues
 String getAlias()
          DOCUMENT ME!
 String getBlobHandling()
          for digester only, see blobHandlingStrategy
 int getBlobHandlingStrategy()
          DOCUMENT ME!
 Vector getCalcFields()
          DOCUMENT ME!
protected static DbFormsConfig getConfig()
           
 String getDataAccessClass()
          DOCUMENT ME!
 FieldValue[] getDefaultOrder()
          Return the datastructure containing info about the default sorting behavior of this table.
 String getDefaultVisibleFields()
          Getter for property defaultVisibleFields.
 String getDefaultVisibleFieldsFormat()
          Getter for property defaultVisibleFieldsFormat.
 String getDeleteStatement(String keyValString)
          Returns SQL delete statement, used by deleteEvent.
 String getDisblobSelectStatement()
          Generates part of a field list for a SQL SELECT clause selecting the DISKBLOB fields from a table (used by DeleteEvent to maintain data consistence).
 Vector getDiskblobs()
          Returns a Vector of Field-Objects representing fields of type "DISKBLOB"
 ResultSet getDoSelectResultSet(FieldValue[] fvEqual, FieldValue[] fvOrder, FieldValue[] sqlFilterParams, int compareMode, PreparedStatement ps)
          Get the SQL ResultSet from the query builded using the input data.
 IEscaper getEscaper()
          DOCUMENT ME!
 String getEscaperClass()
          DOCUMENT ME!
 Field getField(int fieldId)
          Returns the Field-Objet with specified id.
 Field getFieldByName(String aname)
          Returns the field-objects as specified by name (or null if no field with the specified name exists in this table).
 String getFieldName(int fieldID)
          We have the field ID - we need the field name
 Vector getFields()
          Returns the vector of fields this table constists of
 FieldValues getFieldValues(String position)
          This method parses a position string and build a data structure representing the values of the fields decoded from the position.
 FieldValue[] getFilterFieldArray(String filter, Locale locale)
          Initialize the filterFieldValues array.
 Collection getForeignKeys()
          Get all the ForeignKey objects related to this table.
 String getFreeFormSelectQuery(Vector fieldsToSelect, String whereClause, String tableList)
          Prepares the Querystring for the free form select statement
 GrantedPrivileges getGrantedPrivileges()
          returns object containing info about rights mapped to user-roles.
 int getId()
          Returns ID of this table.
 String getInsertStatement(FieldValues fieldValues)
          Returns SQL insert statement, used by insertEvent.
 Vector getInterceptors()
          Get all the interceptor objects related to this table.
 Vector getKey()
          Returns the key of this table (consisting of Field-Objects representing key-fields).
 String getKeyPositionString(FieldValues fvHT)
          Get key position from the input hash table
 String getKeyPositionString(ResultSetVector rsv)
          Does basically the same as getPositionString but only for key-fields.
 String getKeyPositionString(String[] currentRow)
          Does basically the same as getPositionString but only for key-fields.
 String getName()
          Returns name of the table
 Hashtable getNamesHashtable(String core)
          returns the hash table.
 String getOrderBy()
          Return default-orderBy clause from xml config or null if not specified.
 String getPositionString(FieldValues fvHT)
          Get key position from the input hash table
 String getPositionString(Hashtable ht)
          Used for instance by goto with prefix
 String getPositionString(ResultSetVector rsv)
          Builds a "position- string" representing the values of the current row in the given ResultSetVector.
 String getPositionString(String[] currentRow)
          Builds a "position- string" representing the values of the current row in the given ResultSetVector.
 String getQueryFrom()
          Returns the FROM part of a query.
protected  String getQueryOrderBy(FieldValue[] fvOrder)
          Returns the part of the orderby-clause represented by this FieldValue object.
 String getQuerySelect(Vector fieldsToSelect)
          Returns the select part of a query.
protected  String getQueryToChange()
          Returns the FROM part of a insert/delete/update query.
protected  String getQueryWhere(FieldValue[] fvEqual, FieldValue[] fvOrder, int compareMode)
          Returns the WHERE part of a query.
 String getSelectQuery(Vector fieldsToSelect, FieldValue[] fvEqual, FieldValue[] fvOrder, String sqlFilter, int compareMode)
          Prepares the Querystring for the select statement Order of parts: 1.
 String getSelectStatement()
          Get the SQL select statement.
 TableEvents getTableEvents()
          Get the table events object related to this table.
 String getUpdateStatement(FieldValues fieldValues, String keyValStr)
          Returns SQL update statement, used by updateEvent.
 String getWhereClause(FieldValue[] fv)
          Build the WHERE clause string using the input field values.
 String getWhereClauseForKeyFields(String keyValuesStr)
          Generates a part of the SQL where clause needed to select a distinguished row form the table.
 boolean hasInterceptors()
          Check if this table has got interceptors.
 boolean hasUserPrivileg(HttpServletRequest request, int privileg)
          Checks if there exists a granted-privileges object and if so it queries if access/operation is possible
 void initDefaultOrder()
          This method generates a datastructure holding sorting information from "orderBy" clause in XML-config.
 boolean isCalcField(int fieldId)
           
 FieldValues mapChildFieldValues(Table parentTable, String parentFieldString, String childFieldString, String aPosition)
          maps child fields to parent fields
 void populateWhereClauseWithKeyFields(String keyValuesStr, PreparedStatement ps, int startColumn)
          POPULATES a part of the SQL where clause needed to select a distinguished row form the table using values endcoded in a string.
 int populateWhereEqualsClause(FieldValue[] fv, PreparedStatement ps, int curCol)
          situation: we have built a query (involving the getWhereEqualsClause() method) and now we want to prepare the statemtent - provide actual values for the the '?'
 int processInterceptors(int action, DbEventInterceptorData data)
          Process the interceptor objects related to this table.
 void setAlias(String alias)
          DOCUMENT ME!
 void setBlobHandling(String blobHandling)
          for digester only, see blobHandlingStrategy
 void setDataAccessClass(String dataAccessClass)
          Sets the dataAccessClass.
 void setDefaultVisibleFields(String defaultVisibleFields)
          Setter for property defaultVisibleFields.
 void setDefaultVisibleFieldsFormat(String defaultVisibleFieldsFormat)
          Setter for property defaultVisibleFieldsFormat.
 void setEscaperClass(String string)
          DOCUMENT ME!
 void setGrantedPrivileges(GrantedPrivileges grantedPrivileges)
          Set GrantedPrivileges, if defined in dbforms-config-xml (this method gets called from XML-digester).
 void setId(int id)
          Sets the ID of this table (this method gets called from DbFormsConfig).
 void setName(String name)
          Sets the name of the table (this method gets called from XML-digester)
 void setOrderBy(String orderBy)
          Sets a default-orderBy clause from xml config (this method gets called from XML-digester).
 void setTableEvents(TableEvents tableEvents)
          Set the table events object related to this table.
 String toString()
          This metod is useful for logging / debugging purposes only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLOB_INTERCEPTOR

public static final int BLOB_INTERCEPTOR
either "classic" or "interceptor", default is "interceptor"

See Also:
Constant Field Values

BLOB_CLASSIC

public static final int BLOB_CLASSIC
DOCUMENT ME!

See Also:
Constant Field Values

DB_FIELD

protected static final int DB_FIELD
DOCUMENT ME!

See Also:
Constant Field Values

SEARCH_FIELD

protected static final int SEARCH_FIELD
DOCUMENT ME!

See Also:
Constant Field Values

CALC_FIELD

protected static final int CALC_FIELD
DOCUMENT ME!

See Also:
Constant Field Values
Constructor Detail

Table

public Table()
Method Detail

setAlias

public void setAlias(String alias)
DOCUMENT ME!

Parameters:
alias - the alias to set

getAlias

public String getAlias()
DOCUMENT ME!

Returns:
String

setBlobHandling

public void setBlobHandling(String blobHandling)
for digester only, see blobHandlingStrategy

Parameters:
blobHandling - config parameter

getBlobHandling

public String getBlobHandling()
for digester only, see blobHandlingStrategy

Returns:
String

getBlobHandlingStrategy

public int getBlobHandlingStrategy()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getCalcFields

public Vector getCalcFields()
DOCUMENT ME!

Returns:

setDataAccessClass

public void setDataAccessClass(String dataAccessClass)
Sets the dataAccessClass.

Parameters:
dataAccessClass - The dataAccessClass to set

getDataAccessClass

public String getDataAccessClass()
DOCUMENT ME!

Returns:
String

getDefaultOrder

public FieldValue[] getDefaultOrder()
Return the datastructure containing info about the default sorting behavior of this table.

Returns:
the datastructure containing info about the default sorting behavior of this table.

setDefaultVisibleFields

public void setDefaultVisibleFields(String defaultVisibleFields)
Setter for property defaultVisibleFields.

Parameters:
defaultVisibleFields - New value of property defaultVisibleFields.

getDefaultVisibleFields

public String getDefaultVisibleFields()
Getter for property defaultVisibleFields.

Returns:
Value of property defaultVisibleFields.

setDefaultVisibleFieldsFormat

public void setDefaultVisibleFieldsFormat(String defaultVisibleFieldsFormat)
Setter for property defaultVisibleFieldsFormat.

Parameters:
defaultVisibleFieldsFormat - New value of property defaultVisibleFieldsFormat.

getDefaultVisibleFieldsFormat

public String getDefaultVisibleFieldsFormat()
Getter for property defaultVisibleFieldsFormat.

Returns:
Value of property defaultVisibleFieldsFormat.

getDeleteStatement

public String getDeleteStatement(String keyValString)
Returns SQL delete statement, used by deleteEvent.

Returns:
the SQL delete statement

getDisblobSelectStatement

public String getDisblobSelectStatement()
Generates part of a field list for a SQL SELECT clause selecting the DISKBLOB fields from a table (used by DeleteEvent to maintain data consistence).

Returns:
a part of a field list for a SQL SELECT clause selecting the DISKBLOB fields from a table

getDiskblobs

public Vector getDiskblobs()
Returns a Vector of Field-Objects representing fields of type "DISKBLOB"

Returns:
a Vector of Field-Objects representing fields of type "DISKBLOB"

getDoSelectResultSet

public ResultSet getDoSelectResultSet(FieldValue[] fvEqual,
                                      FieldValue[] fvOrder,
                                      FieldValue[] sqlFilterParams,
                                      int compareMode,
                                      PreparedStatement ps)
                               throws SQLException
Get the SQL ResultSet from the query builded using the input data. Order of parts: 1. sqlFilter 2. where condition generated from searching 3. where condition generated from ordering Generating the query in getSelectQuery() must match this order!

Parameters:
fvEqual - FieldValue array used to restrict a set in a subform where all "childFields" in the resultset match their respective "parentFields" in main form
fvOrder - FieldValue array used to build a cumulation of rules for ordering (sorting) and restricting fields
sqlFilterParams - DOCUMENT ME!
compareMode - the value of the compare mode
ps - the PreparedStatement object
Returns:
a ResultSet object
Throws:
SQLException - if any error occurs

getEscaper

public IEscaper getEscaper()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setEscaperClass

public void setEscaperClass(String string)
DOCUMENT ME!

Parameters:
string -

getEscaperClass

public String getEscaperClass()
DOCUMENT ME!

Returns:

getField

public Field getField(int fieldId)
Returns the Field-Objet with specified id.

Parameters:
fieldId - The id of the field to be returned
Returns:
the Field object having the input id

isCalcField

public boolean isCalcField(int fieldId)

getFieldByName

public Field getFieldByName(String aname)
Returns the field-objects as specified by name (or null if no field with the specified name exists in this table).

Parameters:
name - The name of the field
Returns:
Filed object having the input name

getFieldName

public String getFieldName(int fieldID)
We have the field ID - we need the field name

Parameters:
fieldID - fieldID to get field name from
Returns:
the field name

getFieldValues

public FieldValues getFieldValues(String position)
This method parses a position string and build a data structure representing the values of the fields decoded from the position.
#fixme: replace seperator-based tokenization by better algoithm!

Parameters:
position - the position string
Returns:
the HashTable containing the FieldValues of the fields decoded, key of the HashTable is the fieldName!

getFields

public Vector getFields()
Returns the vector of fields this table constists of

Returns:
the vector of fields this table constists of

getFilterFieldArray

public FieldValue[] getFilterFieldArray(String filter,
                                        Locale locale)
Initialize the filterFieldValues array.

Parameters:
filter - the filter string
locale - the table object
Returns:
an initialized FieldValue array

getForeignKeys

public Collection getForeignKeys()
Get all the ForeignKey objects related to this table.

Returns:
a vector containing all the ForeignKey objects related to this table.

getFreeFormSelectQuery

public String getFreeFormSelectQuery(Vector fieldsToSelect,
                                     String whereClause,
                                     String tableList)
Prepares the Querystring for the free form select statement

Parameters:
fieldsToSelect - vector of fields to be selected
whereClause - free-form whereClause to be appended to query
tableList - the list of tables involved into the query
Returns:
the query string

setGrantedPrivileges

public void setGrantedPrivileges(GrantedPrivileges grantedPrivileges)
Set GrantedPrivileges, if defined in dbforms-config-xml (this method gets called from XML-digester).

Parameters:
grantedPrivileges - the grantedPrivileges object

getGrantedPrivileges

public GrantedPrivileges getGrantedPrivileges()
returns object containing info about rights mapped to user-roles. (context: this table object!)

Returns:
the GrantedPrivileges object

setId

public void setId(int id)
Sets the ID of this table (this method gets called from DbFormsConfig).

Parameters:
id - the id value to set

getId

public int getId()
Returns ID of this table.

Returns:
the id value

getInsertStatement

public String getInsertStatement(FieldValues fieldValues)
Returns SQL insert statement, used by insertEvent.

Parameters:
fieldValues - the Hashtable containing the field values
Returns:
the SQL insert statement

getInterceptors

public Vector getInterceptors()
Get all the interceptor objects related to this table.

Returns:
a vector containing all the interceptor objects related to this table.

getKey

public Vector getKey()
Returns the key of this table (consisting of Field-Objects representing key-fields).

Returns:
the key of this table (consisting of Field-Objects representing key-fields)

getKeyPositionString

public String getKeyPositionString(ResultSetVector rsv)
Does basically the same as getPositionString but only for key-fields.
#checkme: could be merged with getPositionString
#fixme: replace seperator-based tokenization by better algoithm!

Parameters:
rsv - the ResultSetVector object
Returns:
the position string for key fields

getKeyPositionString

public String getKeyPositionString(String[] currentRow)
Does basically the same as getPositionString but only for key-fields.

Parameters:
currentRow - the currentRow as String[]
Returns:
the position string

getKeyPositionString

public String getKeyPositionString(FieldValues fvHT)
Get key position from the input hash table

Parameters:
fvHT - has field as key and FieldValue as value!
Returns:
the key position string
Throws:
IllegalArgumentException - DOCUMENT ME!

setName

public void setName(String name)
Sets the name of the table (this method gets called from XML-digester)

Parameters:
name - the name of the table

getName

public String getName()
Returns name of the table

Returns:
the name of this table

getNamesHashtable

public Hashtable getNamesHashtable(String core)
returns the hash table. Moved from dbFormTag to table, so that you can overload it!

Parameters:
core - starting tag for the fields
Returns:
hash table of names in PHP slang we would call that an "associative array" :=)

setOrderBy

public void setOrderBy(String orderBy)
Sets a default-orderBy clause from xml config (this method gets called from XML-digester).

Parameters:
orderBy - the orderBy clause

getOrderBy

public String getOrderBy()
Return default-orderBy clause from xml config or null if not specified.

Returns:
the default-orderBy clause from xml config or null if not specified.

getPositionString

public String getPositionString(ResultSetVector rsv)
Builds a "position- string" representing the values of the current row in the given ResultSetVector.
Not all field-values get explicitl listed in this string. only fields important for navigation and sorting are listed.
Position strings are used as request parameters allowing the framework to keep track of the position the user comes from or goes to.
Look into com.itp.tablib.DbFormTag for better understanding changed 0-04-2001 by joe #note: enhanced algorithm since version 0.9!

Parameters:
rsv - the ResultSetVector object
Returns:
the position string

getPositionString

public String getPositionString(String[] currentRow)
Builds a "position- string" representing the values of the current row in the given ResultSetVector.
Not all field-values get explicitly listed in this string. only fields important for navigation and sorting are listed.
Position strings are used as request parameters allowing the framework to keep track of the position the user comes from or goes to.

Parameters:
currentRow - the currentRow as String[]
Returns:
the position string

getPositionString

public String getPositionString(Hashtable ht)
Used for instance by goto with prefix

Parameters:
ht - the Hashtable object containing the field names used to build the position string ht has fieldName as key and valueStr as value!
Returns:
the position string

getPositionString

public String getPositionString(FieldValues fvHT)
Get key position from the input hash table

Parameters:
fvHT - has field as key and FieldValue as value!
Returns:
the key position string
Throws:
IllegalArgumentException - DOCUMENT ME!

getQueryFrom

public String getQueryFrom()
Returns the FROM part of a query.

Returns:
the FROM part of a query

getQuerySelect

public String getQuerySelect(Vector fieldsToSelect)
Returns the select part of a query.

Parameters:
fieldsToSelect - the vector containing the Field objects used to build the elect part of the query
Returns:
the select part of a query

getSelectQuery

public String getSelectQuery(Vector fieldsToSelect,
                             FieldValue[] fvEqual,
                             FieldValue[] fvOrder,
                             String sqlFilter,
                             int compareMode)
Prepares the Querystring for the select statement Order of parts: 1. sqlFilter (fild in getDoSelectResultSet!) 2. where condition generated from having / ordering fields (fild in populateWhereEqualsClause) Retrieving the parameters in getDoSelectResultSet() must match this order!

Parameters:
fieldsToSelect - vector of fields to be selected
fvEqual - fieldValues representing values we are looking for
fvOrder - fieldValues representing needs for order clauses
sqlFilter - sql condition to and with the where clause
compareMode - compare mode value for generating the order clause
Returns:
the query string

getSelectStatement

public String getSelectStatement()
Get the SQL select statement.

Returns:
the SQL select statement

setTableEvents

public void setTableEvents(TableEvents tableEvents)
Set the table events object related to this table.

Parameters:
tableEvents - the table events object related to this table

getTableEvents

public TableEvents getTableEvents()
Get the table events object related to this table.
If it is null (because user didn't specify custom events), set a new TableEvents object and return its reference.

Returns:
the table events object related to this table

getUpdateStatement

public String getUpdateStatement(FieldValues fieldValues,
                                 String keyValStr)
Returns SQL update statement, used by updateEvent.

Parameters:
fieldValues - the Hashtable object containing the field values
Returns:
the SQL update statement

getWhereClause

public String getWhereClause(FieldValue[] fv)
Build the WHERE clause string using the input field values.

Parameters:
fv - the array of FieldValue objects
Returns:
the WHERE clause string protected so that it can be tested

getWhereClauseForKeyFields

public String getWhereClauseForKeyFields(String keyValuesStr)
Generates a part of the SQL where clause needed to select a distinguished row form the table. This is done by querying for KEY VALUES !

Returns:
a part of the SQL where clause needed to select a distinguished row form the table

addCalcField

public void addCalcField(Field field)
                  throws Exception
adds a Field-Object to this table and puts it into othere datastructure for further references (this method gets called from DbFormsConfig)

Parameters:
field - field to add
Throws:
Exception - DOCUMENT ME!

addField

public void addField(Field field)
              throws Exception
Adds a Field-Object to this table and puts it into othere datastructure for further references (this method gets called from DbFormsConfig)

Parameters:
field - the Field object to add
Throws:
Exception - DOCUMENT ME!

addForeignKey

public void addForeignKey(ForeignKey fk)
Adds a ForeignKey-Object to this table and puts it into othere datastructure for further references (this method gets called from DbFormsConfig)

Parameters:
fk - the foreign key object

addInterceptor

public void addInterceptor(Interceptor interceptor)
Add an interceptor to this table.

Parameters:
interceptor - the interceptor to add

containsDiskblob

public boolean containsDiskblob()
Determinates if this table contains a diskblob field. (this method is used by DeleteEvent which needs to delete files referenced by a diskblob field).

Returns:
true if this table contains a diskblob field, false otherwise

createOrderFieldValues

public FieldValue[] createOrderFieldValues(String order,
                                           HttpServletRequest request,
                                           boolean includeKeys)
Column ["ASC" | "DESC"] {"," Column ["ASC" | "DESC"] } (if neither ASC nor DESC follow "Col", then ASC is choosen as default).
this method assures, that ALL KEY FIELDs are part of the order criteria, in any case (independly from the order-Str). if necessary it appends them. WHY: to ensure correct scrollig (not getting STUCK if the search criteria are not "sharp" enough).
#fixme - better explaination #fixme - determinate illegal input and throw IllegalArgumentException

Parameters:
order - a String from JSP provided by the user in SQL-Style
request - the request object
includeKeys - true to include key fields, false otherwise
Returns:
???

doConstrainedSelect

public ResultSetVector doConstrainedSelect(FieldValue[] fvEqual,
                                           FieldValue[] fvOrder,
                                           String sqlFilter,
                                           FieldValue[] sqlFilterParams,
                                           int compareMode,
                                           int maxRows,
                                           DbEventInterceptorData interceptorData)
                                    throws SQLException
Do a constrained select.

Parameters:
fvEqual - FieldValue array used to restrict a set in a subform where all "childFields" in the resultset match their respective "parentFields" in main form
fvOrder - FieldValue array used to build a cumulation of rules for ordering (sorting) and restricting fields
sqlFilter - sql condition to add to where clause
sqlFilterParams - DOCUMENT ME!
compareMode - the value of the compare mode
maxRows - the max number of rows to manage
interceptorData - the connection object
Returns:
a ResultSetVector object
Throws:
SQLException - if any error occurs

doFreeFormSelect

public ResultSetVector doFreeFormSelect(String whereClause,
                                        String tableList,
                                        int maxRows,
                                        DbEventInterceptorData interceptorData)
                                 throws SQLException
perform free-form select query

Parameters:
whereClause - free-form whereClause to be appended to query
tableList - the list of tables involved into the query
maxRows - how many rows should be stored in the resultSet (zero means unlimited)
interceptorData - the active db connection to use
Returns:
the ResultSetVector object
Throws:
SQLException - if any error occurs

fillWithValues

public void fillWithValues(FieldValue[] orderConstraint,
                           String aPosition)
in version 0.9 this method moved from FieldValue.fillWithValues to Table.fillWithValues

Parameters:
orderConstraint - FieldValue array used to build a cumulation of rules for ordering (sorting) and restricting fields
aPosition - resultset position

hasInterceptors

public boolean hasInterceptors()
Check if this table has got interceptors.

Returns:
true if the table contains interceptors, false otherwise

hasUserPrivileg

public boolean hasUserPrivileg(HttpServletRequest request,
                               int privileg)
Checks if there exists a granted-privileges object and if so it queries if access/operation is possible

Parameters:
request - the request object
privileg - the privilege value
Returns:
true if the user has got privileges over this table, false otherwise

initDefaultOrder

public void initDefaultOrder()
This method generates a datastructure holding sorting information from "orderBy" clause in XML-config.


mapChildFieldValues

public FieldValues mapChildFieldValues(Table parentTable,
                                       String parentFieldString,
                                       String childFieldString,
                                       String aPosition)
maps child fields to parent fields

Parameters:
parentTable - the parent table
parentFieldString - field names in parent table
childFieldString - field names in child table
aPosition - position to map as position string
Returns:
FieldValues with result
Throws:
IllegalArgumentException - DOCUMENT ME!

populateWhereClauseWithKeyFields

public void populateWhereClauseWithKeyFields(String keyValuesStr,
                                             PreparedStatement ps,
                                             int startColumn)
                                      throws SQLException
POPULATES a part of the SQL where clause needed to select a distinguished row form the table using values endcoded in a string.
#fixme: replace seperator-based tokenization by better algoithm!

Parameters:
keyValuesStr - the position string
ps - the PreparedStatement object
startColumn - PreparedStatement start column
Throws:
SQLException - if any error occurs

populateWhereEqualsClause

public int populateWhereEqualsClause(FieldValue[] fv,
                                     PreparedStatement ps,
                                     int curCol)
                              throws SQLException
situation: we have built a query (involving the getWhereEqualsClause() method) and now we want to prepare the statemtent - provide actual values for the the '?' placeholders

Parameters:
fv - the array of FieldValue objects
ps - the PreparedStatement object
curCol - the current PreparedStatement column; points to a PreparedStatement xxx value
Returns:
the current column value
Throws:
SQLException - if any error occurs

processInterceptors

public int processInterceptors(int action,
                               DbEventInterceptorData data)
                        throws MultipleValidationException
Process the interceptor objects related to this table.

Parameters:
action - the DbEventInterceptor identifier. See the DbEventInterceptor class for the real values. Example: DbEventInterceptor.PRE_UPDATE
data - the DbEventInterceptorData object
Returns:
the value that identifies if an operation should be granted, denied or ignored. See DbEventInterceptor.GRANT_OPERATION, DbEventInterceptor.DENY_OPERATION, DbEventInterceptor.IGNORE_OPERATION
Throws:
SQLException - if any error occurs
MultipleValidationException

toString

public String toString()
This metod is useful for logging / debugging purposes only.

Overrides:
toString in class Object
Returns:
a string containing the Table name and field values

getQueryOrderBy

protected String getQueryOrderBy(FieldValue[] fvOrder)
Returns the part of the orderby-clause represented by this FieldValue object.
(ASC will be not printed because it is defined DEFAULT in SQL if there are RDBMS which do not tolerate this please let me know; then i'll change it).

Parameters:
fvOrder - FieldValue array used to build a cumulation of rules for ordering (sorting) and restricting fields
Returns:
the part of the orderby-clause represented by this FieldValue object

getQueryToChange

protected String getQueryToChange()
Returns the FROM part of a insert/delete/update query.

Returns:
the FROM part of a insert/delete/update query

getQueryWhere

protected String getQueryWhere(FieldValue[] fvEqual,
                               FieldValue[] fvOrder,
                               int compareMode)
Returns the WHERE part of a query.

Parameters:
fvEqual - FieldValue array used to restrict a set in a subform where all "childFields" in the resultset match their respective "parentFields" in main form
fvOrder - FieldValue array used to build a cumulation of rules for ordering (sorting) and restricting fields
compareMode - compare mode value for generating the order clause
Returns:
the WHERE part of a query

checkFieldId

protected boolean checkFieldId(int type,
                               int aid)
DOCUMENT ME!

Parameters:
type - DOCUMENT ME!
id - DOCUMENT ME!
Returns:
DOCUMENT ME!

decodeFieldId

protected int decodeFieldId(int type,
                            int aid)
DOCUMENT ME!

Parameters:
type - DOCUMENT ME!
id - DOCUMENT ME!
Returns:
DOCUMENT ME!

encodeFieldId

protected int encodeFieldId(int type,
                            int aid)
DOCUMENT ME!

Parameters:
type - DOCUMENT ME!
id - DOCUMENT ME!
Returns:
DOCUMENT ME!

getConfig

protected static DbFormsConfig getConfig()


Copyright © 2002-2006 DbForms. All Rights Reserved.