| java.lang.Object net.xoetrope.xui.data.XModel net.xoetrope.xui.data.XBaseModel net.xoetrope.optional.data.sql.DatabaseTableModel
DatabaseTableModel | public class DatabaseTableModel extends XBaseModel implements DumpWriter,XRowSelector(Code) | | A wrapper for a database table allowing it to integrate with the XModel
Copyright: Copyright (c) 2003
License: see license.txt
$Revision: 1.5 $
|
Method Summary | |
public Object | append(String id) | public void | dump(Writer w) | public int | executeUpdate(String sqlStr) | public DatabaseRowModel | findRow(int fieldIdx, String value) Find a row with a specified field value
Parameters: fieldIdx - the index of the search field Parameters: value - the search value the table row model containing the selected row. | public DatabaseRowModel | findRow(String where) Find a row with a specified field value
Parameters: where - the search criteria the table row model containing the selected row. | public DatabaseTableModel | findRows(int fieldIdx, String value) Find a set of rows with a specified field value
Parameters: fieldIdx - the index of the search field Parameters: value - the search value the table model containing the selected rows. | public DatabaseTableModel | findRows(String where) Find a set of rows with a specified field value
Parameters: where - the search criteria the table model containing the selected rows. | public DatabaseTableModel | findRows(String requestFields, String where) Find a set of rows with a specified field value
Parameters: requestFields - the fields to return Parameters: where - the search criteria the table model containing the selected rows. | public void | first() | public Object | get(String element) | public XModel | get(int i) | public Object | get() | public String | getAttribName(int i) Gets the attribute name for field i. | public Object | getAttribValue(int i) | public double | getAttribValueAsDouble(int i) | public int | getAttribValueAsInt(int i) | public String | getAttribValueAsString(int i) | public int | getAttribute(String attribName) | public String | getFieldValue(int colIdx) Provides iterative access to the table values. | public String | getFieldValue(int rowIdx, int colIdx) Provides random access to the table values. | public String | getId() | public int | getNumAttributes() | public int | getNumChildren() | public int | getSelectedRow() | public static DatabaseTableModel | getTable(String tableName) Look up a table by name in the overall model. | public String | getTagName() Gets the model element tag name, e.g. | public String | getValue() Provides iterative access to the table values. | public XModel | getValue(int i) | public double | getValueAsDouble(String elementName) | public int | getValueAsInt(String elementName) Gets the value attribute of the specified node as an int. | public int | hashCode() | public boolean | isDistinct() | public void | last() | public boolean | next() | public boolean | previous() | public void | retrieve() Get the table data. | public void | set(String elementName, String attribName, Object newObject) | public void | set(String attribName, Object newObject) | public void | set(Object s) | public void | setAttribValue(int i, Object value) | public void | setDistinct(boolean isDistinct) | public void | setFieldValue(int colIdx, String newValue) | public void | setName(String newName) | public void | setOrderField(String fld) | public void | setReadOnly(boolean b) | public void | setSelectedRow(int rowIdx) | public void | setSqlStatement(String sqlStr, String connName, boolean writable) | public void | setupTable(String tableName) | public void | setupTable(String tableName, String fields, String whereClause) | public void | setupTable(String tableName, String fields, String whereClause, String connName, boolean writable) | public void | setupTable(String tableName, String fields, String whereClause, boolean writable) | protected void | sync() Syncs the model with the service response is the xtable has been changed
or if the node has timed out. |
readOnly | boolean readOnly(Code) | | |
DatabaseTableModel | public DatabaseTableModel()(Code) | | Create a new model node for a database table
|
dump | public void dump(Writer w)(Code) | | Write teh contents of this model node to a stream
Parameters: w - the write/stream |
executeUpdate | public int executeUpdate(String sqlStr) throws Exception(Code) | | Update the underlying database table using the specified SQL statement
Parameters: sqlStr - the full UPDATE SQL statement the number of rows affected by the update |
findRow | public DatabaseRowModel findRow(int fieldIdx, String value)(Code) | | Find a row with a specified field value
Parameters: fieldIdx - the index of the search field Parameters: value - the search value the table row model containing the selected row. null is returned ifthis table has uncommitted updates |
findRow | public DatabaseRowModel findRow(String where)(Code) | | Find a row with a specified field value
Parameters: where - the search criteria the table row model containing the selected row. null is returned ifthis table has uncommitted updates |
findRows | public DatabaseTableModel findRows(int fieldIdx, String value)(Code) | | Find a set of rows with a specified field value
Parameters: fieldIdx - the index of the search field Parameters: value - the search value the table model containing the selected rows. null is returned ifthis table has uncommitted updates |
findRows | public DatabaseTableModel findRows(String where)(Code) | | Find a set of rows with a specified field value
Parameters: where - the search criteria the table model containing the selected rows. null is returned ifthis table has uncommitted updates |
findRows | public DatabaseTableModel findRows(String requestFields, String where)(Code) | | Find a set of rows with a specified field value
Parameters: requestFields - the fields to return Parameters: where - the search criteria the table model containing the selected rows. null is returned ifthis table has uncommitted updates |
first | public void first()(Code) | | Moves the table's cursor to the first row
|
get | public Object get(String element)(Code) | | Get the value of the element located at the path in the element parameter
If the attribName parameter is not null we get the value of the
attributeValues
Parameters: element - The path to the XModel we require Parameters: attribName - The name of the attribute we require or null if we justwant the XModel value The value of the XModel or the attribute |
get | public XModel get(int i)(Code) | | Get the XModel at element i
Parameters: i - The index of the values array The XModel at location i |
get | public Object get()(Code) | | gets the value attribute
the value of the model |
getAttribName | public String getAttribName(int i)(Code) | | Gets the attribute name for field i. For this node the table field name is
returned.
Parameters: i - The index of the attributeNames array whose value we want The string value of the attributeNames array at position i |
getAttribValue | public Object getAttribValue(int i)(Code) | | Get the value of an attribute (row)
Parameters: i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i |
getAttribValueAsDouble | public double getAttribValueAsDouble(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i |
getAttribValueAsInt | public int getAttribValueAsInt(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i |
getAttribValueAsString | public String getAttribValueAsString(int i)(Code) | | Parameters: i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i |
getAttribute | public int getAttribute(String attribName)(Code) | | returns the index of the attribiteNames array whose value is the same
as the attribName
Parameters: attribName - The name of the attribute we are trying to locate The index of the attributeNames array containg the name |
getFieldValue | public String getFieldValue(int colIdx)(Code) | | Provides iterative access to the table values. The current row in the table
is used to index the data. This method does not implicitly
retrieve the data so you must call the retrieve method explicitly.
Parameters: colIdx - the column of field index the data |
getFieldValue | public String getFieldValue(int rowIdx, int colIdx)(Code) | | Provides random access to the table values. This method does not implicitly
retrieve the data so you must call the retrieve method explicitly.
Parameters: rowIdx - the row index Parameters: colIdx - the column of field index the data |
getNumAttributes | public int getNumAttributes()(Code) | | Get the number of fields in this TableModel
the number of fields |
getNumChildren | public int getNumChildren()(Code) | | Gets the number of rows for this table
the number of rows |
getSelectedRow | public int getSelectedRow()(Code) | | Get the row selection index
the current row selection index (zero based) |
getTable | public static DatabaseTableModel getTable(String tableName)(Code) | | Look up a table by name in the overall model.
Parameters: tableName - the table name the table node |
getTagName | public String getTagName()(Code) | | Gets the model element tag name, e.g. 'Component' from the XML fragment
|
getValue | public String getValue()(Code) | | Provides iterative access to the table values. The current row in the table
is used to index the data. This method does not implicitly
retrieve the data so you must call the retrieve method explicitly.
the data |
getValue | public XModel getValue(int i)(Code) | | Parameters: i - The index into the values array The XModel at position i of the values array. |
getValueAsDouble | public double getValueAsDouble(String elementName)(Code) | | Gets the value attribute as a Double value
Parameters: elementName - |
getValueAsInt | public int getValueAsInt(String elementName)(Code) | | Gets the value attribute of the specified node as an int.
Parameters: elementName - |
hashCode | public int hashCode()(Code) | | Get the hashcode for this model node
the hashcode |
isDistinct | public boolean isDistinct()(Code) | | Check if the table is set to retrieve distinct rows
the distinct flag |
last | public void last()(Code) | | Moves the table's cursor to the last row
|
next | public boolean next()(Code) | | Moves the table's cursor to the next row
|
previous | public boolean previous()(Code) | | Moves the table's cursor to the previous row
|
retrieve | public void retrieve()(Code) | | Get the table data.
|
set | public void set(String elementName, String attribName, Object newObject)(Code) | | Set the value of the attribute in the XModel located at the elementName
Parameters: elementName - The path to the XModel in the format 'base/foo Parameters: attribName - The name of the attribute whose value we require Parameters: newObject - The new value of the attribute |
set | public void set(String attribName, Object newObject)(Code) | | Set the value of the XModel located at the elementName
Parameters: elementName - The path to the XModel in the format 'base/foo Parameters: newObject - The new value of the XModel |
set | public void set(Object s)(Code) | | Sets the model value
Parameters: s - the new value |
setAttribValue | public void setAttribValue(int i, Object value)(Code) | | Sets the attribute value
Parameters: i - The index of the attributeValues array whose value we want Parameters: value - the value object |
setDistinct | public void setDistinct(boolean isDistinct)(Code) | | Set the table to retrieve distinct rows
|
setFieldValue | public void setFieldValue(int colIdx, String newValue)(Code) | | |
setName | public void setName(String newName)(Code) | | Sets the name attribute and constructs a new table of that name
Parameters: newName - the new name |
setOrderField | public void setOrderField(String fld)(Code) | | Set the field(s) used ORDER clause of the SQL query
Parameters: fld - the field name(s) |
setReadOnly | public void setReadOnly(boolean b)(Code) | | Sets the read only flag indicating whether or not the underlying table
is read-only
Parameters: b - true for a read-only table. |
setSelectedRow | public void setSelectedRow(int rowIdx)(Code) | | Set the row selection index
Parameters: rowIdx - the new row selection index (zero based) |
setSqlStatement | public void setSqlStatement(String sqlStr, String connName, boolean writable)(Code) | | Specify the sql statement in its entirety
Parameters: sqlStr - the full SQL statement Parameters: connName - the connection name |
setupTable | public void setupTable(String tableName)(Code) | | List the fields retrieved from the table
Parameters: tableName - the database table name |
setupTable | public void setupTable(String tableName, String fields, String whereClause)(Code) | | List the fields retrieved from the table
Parameters: tableName - the database table name Parameters: fields - the database field names, or null if all fields are to be retrieved Parameters: whereClause - the where clause, or null if all rows are to be selected |
setupTable | public void setupTable(String tableName, String fields, String whereClause, String connName, boolean writable)(Code) | | List the fields retrieved from the table
Parameters: tableName - the database table name Parameters: fields - the database field names, or null if all fields are to be retrieved Parameters: whereClause - the where clause, or null if all rows are to be selected Parameters: connName - the connection name |
setupTable | public void setupTable(String tableName, String fields, String whereClause, boolean writable)(Code) | | List the fields retrieved from the table
Parameters: tableName - the database table name Parameters: fields - the database field names, or null if all fields are to be retrieved Parameters: whereClause - the where clause, or null if all rows are to be selected Parameters: writable - sets the table as writable, normally this should be false |
sync | protected void sync()(Code) | | Syncs the model with the service response is the xtable has been changed
or if the node has timed out.
|
|
|