|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Object | +--intradoc.data.DataResultSet
This class is used as the database independent representation of a table. It implements the intradoc.data.ResultSet interface so that database queries and internal application tables can be handled through the same interface.
| Field Summary | |
protected boolean |
m_copyAborted
Flag to indicate whether a copy has been prematurely aborted. |
protected int |
m_currentRow
The currently selected row. |
protected IdcDateFormat[] |
m_dateFormat
|
protected java.util.Vector |
m_fieldList
Vector containing the field or column information in the order in which they appear. |
protected java.util.Hashtable |
m_fieldMapping
Mapping of field name to field information. |
protected boolean |
m_isMutable
|
protected int |
m_numRows
Number of rows in the result set. |
protected java.util.Vector |
m_values
Vector containing the values for each row in the result set. |
| Constructor Summary | |
DataResultSet()
Default constructor. |
|
DataResultSet(java.lang.String[] fieldNames)
Used to create a simple in memory data result set. |
|
| Method Summary | |
void |
addRow(java.util.Vector vect)
Appends the specified row to the result set. |
void |
appendFields(java.util.Vector finfo)
Appends columns to the result set. |
void |
closeInternals()
Closes the result set. |
void |
copy(ResultSet rset)
Copies all the rows in the specified result set. |
void |
copy(ResultSet rset,
int maxRows)
Copies a given result set into this result set up to the maximum number of rows (if non-zero). |
void |
copyEx(ResultSet rset,
int maxRows,
boolean useDbFormat)
|
void |
copyFieldInfo(ResultSet rset)
Copy only the field information of the specified result set into this result set. |
void |
copyFiltered(ResultSet rset,
java.lang.String key,
ResultSetFilter filter)
Copy only the rows that match the criteria as specified by the passed in filter. |
void |
copyFilteredEx(ResultSet rset,
java.lang.String key,
ResultSetFilter filter,
boolean startAtFirst)
Copies a the rows of a specifed result set that match the filter. |
void |
copySimpleFiltered(ResultSet rset,
java.lang.String key,
java.lang.String val)
Copy only the rows matching the simple criteria where a specified field must equal a specified value. |
java.util.Vector |
createEmptyRow()
Creates an empty row for the result set. |
ResultSetFilter |
createMaxNumResultSetFilter(int maxnum)
Creates a filter that limits the number of rows to copy. |
java.util.Vector |
createRow(Parameters params)
Creates a row from the passed in values |
ResultSetFilter |
createSimpleResultSetFilter(java.lang.String lookupVal)
Creates a result set filter based on a look up value. |
boolean |
deleteCurrentRow()
Deletes the current row. |
void |
deleteRow(int index)
Deletes the specified row. |
java.util.Vector |
findRow(int colIndex,
java.lang.String val)
Finds the row whose field value at the given index is equal to the given value. |
boolean |
first()
Sets the result set to the first row. |
int |
getCurrentRow()
Returns the index of the current row. |
java.util.Properties |
getCurrentRowProps()
Returns the current row as a properties. |
java.util.Vector |
getCurrentRowValues()
Returns the current row values. |
IdcDateFormat |
getDateFormat()
Gets the IdcDateFormat object for this ResultSet. |
java.util.Date |
getDateValue(int index)
Gets the field value as a date, only works for fields which are actually dates. |
boolean |
getFieldInfo(java.lang.String fieldName,
FieldInfo fieldInfo)
Gets field information for a particular field. |
java.lang.String |
getFieldName(int index)
Gets the name of field located at a particular field index (from 0 to getNumFields() - 1). |
void |
getIndexFieldInfo(int index,
FieldInfo fieldInfo)
Gets field information for a particular field at a specified index. |
int |
getNumFields()
Returns number of fields. |
int |
getNumRows()
Returns the number of rows in the result set. |
protected java.util.Vector |
getResultSetValues(ResultSet rset,
int numFields)
Gets the result set values from the result set at the current row. |
protected java.util.Vector |
getResultSetValuesEx(ResultSet rset,
int numFields,
boolean useDbFormat)
|
java.util.Vector |
getRowValues(int index)
Returns the row at the given index. |
java.lang.String |
getStringValue(int index)
Gets the value for a current field as a string for the currently loaded resultset row. |
Workspace |
getWorkspace()
Returns null. |
boolean |
hasRawObjects()
Returns true if this ResultSet contains real objects, not String representations of the data. |
void |
init(java.io.Reader reader,
DataDecode decoder)
Initialize the result set from a stream. |
boolean |
init(Table tble)
Initialize a result set using a table to constuct its fields. |
void |
initEx(java.io.Reader reader,
DataDecode decoder,
boolean isHeaderOnly)
Initializes the result set from a stream. |
void |
initShallow(DataResultSet rset)
Makes a shallow copy of one data result set into another. |
void |
insertRowAt(java.util.Vector vect,
int i)
Inserts the specified row at the specified index. |
boolean |
isCopyAborted()
Indicates whether or not the copy was aborted. |
boolean |
isEmpty()
Checks to see if result set is empty. |
boolean |
isMutable()
Returns true if it is legal for someone to mutate the contents of this ResultSet. |
boolean |
isRowPresent()
Checks to see if we have gone past last valid record. |
boolean |
last()
Advances to the last row. |
void |
merge(java.lang.String colKey,
ResultSet rset,
boolean replaceOnly)
This method merges a result set into this object. |
void |
mergeDelete(java.lang.String colKey,
ResultSet rset,
boolean isCaseSensitive)
This method removes the rows from this result set where the colunn value matches a column value in the passed in result set. |
void |
mergeFields(DataResultSet rset)
Appends a field to the result set making sure that it is not a duplicate. |
boolean |
next()
Advances to the next row. |
boolean |
previous()
Sets the result set to the previous row. |
int |
readHeader(java.io.BufferedReader bReader,
DataDecode decoder)
Parses the column information for the result set from a character stream |
void |
readSimple(java.io.BufferedReader bReader,
DataDecode decoder,
boolean isHeaderOnly)
Parses a result set from a character stream. |
void |
removeAll()
Removes all rows from the result set. |
void |
removeFields(java.lang.String[] fieldNames)
Removes fields from a DataResulSet. |
boolean |
renameField(java.lang.String from,
java.lang.String to)
Renames a field from a DataResultSet. |
void |
reset()
Resets the result set back to an empty result set, i.e. |
void |
setCurrentRow(int currentRow)
Sets the current row to the specified index. |
void |
setCurrentValue(int index,
java.lang.String val)
Sets the current row values. |
void |
setDateFormat(IdcDateFormat fmt)
Sets the IdcDateFormat object for this ResultSet. |
void |
setRowValues(java.util.Vector vect,
int i)
Sets the specified row values. |
DataResultSet |
shallowClone()
Creates a shallow clone of the result set. |
int |
skip(int numRows)
Skip number of rows. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected IdcDateFormat[] m_dateFormat
protected boolean m_isMutable
protected java.util.Hashtable m_fieldMapping
FieldInfoprotected java.util.Vector m_fieldList
FieldInfoprotected java.util.Vector m_values
protected int m_currentRow
protected int m_numRows
protected boolean m_copyAborted
| Constructor Detail |
public DataResultSet()
public DataResultSet(java.lang.String[] fieldNames)
fieldNames - an array of strings from which the fields/columns will be
generated.| Method Detail |
public boolean isMutable()
ResultSet
isMutable in interface ResultSetpublic boolean hasRawObjects()
ResultSet
hasRawObjects in interface ResultSetpublic void setDateFormat(IdcDateFormat fmt)
ResultSet
setDateFormat in interface ResultSetpublic IdcDateFormat getDateFormat()
ResultSet
getDateFormat in interface ResultSetpublic boolean init(Table tble)
tble - Table containing column information
Table
public void init(java.io.Reader reader,
DataDecode decoder)
throws java.io.IOException
reader - Character stream containing result set definition and values.decoder - Mechanism used for parsing escaped characters.
java.io.IOExceptioninitEx(java.io.Reader, intradoc.data.DataDecode, boolean),
DataDecode,
Reader
public void initEx(java.io.Reader reader,
DataDecode decoder,
boolean isHeaderOnly)
throws java.io.IOException
reader - Character stream containing result set definition and values.decoder - Mechanism used for parsing escaped characters.isHeaderOnly - If set to true, reads only the field information and not the values.
Useful for determining the definition of a result set.
java.io.IOExceptionreadSimple(java.io.BufferedReader, intradoc.data.DataDecode, boolean),
DataDecode,
Readerpublic DataResultSet shallowClone()
public void initShallow(DataResultSet rset)
public void copy(ResultSet rset,
int maxRows)
rset - Result set to copy from.maxRows - If non-zero, indicates the maximum number of rows to copy. Otherwise
all rows are copied.
public void copyEx(ResultSet rset,
int maxRows,
boolean useDbFormat)
protected java.util.Vector getResultSetValues(ResultSet rset,
int numFields)
rset - Result set containing row values.numFields - The number of field values to copy over.
protected java.util.Vector getResultSetValuesEx(ResultSet rset,
int numFields,
boolean useDbFormat)
public void copy(ResultSet rset)
rset - Result set to copy.copy(intradoc.data.ResultSet, int)
public void copyFiltered(ResultSet rset,
java.lang.String key,
ResultSetFilter filter)
rset - Result set to copy.key - Field name to use for filter.filter - Filter that determines the criteria a row must match to be copied.ResultSetFilter,
copyFilteredEx(intradoc.data.ResultSet, java.lang.String, intradoc.data.ResultSetFilter, boolean),
copy(intradoc.data.ResultSet, int)
public void copySimpleFiltered(ResultSet rset,
java.lang.String key,
java.lang.String val)
rset - Result set to copykey - Field for simple filterval - Value for simple filter, i.e. the field value must equal val for the
row to be match the filter and be copied.copyFilteredEx(intradoc.data.ResultSet, java.lang.String, intradoc.data.ResultSetFilter, boolean)public ResultSetFilter createSimpleResultSetFilter(java.lang.String lookupVal)
lookupVal - Value to use for lookup.
SimpleResultSetFilter,
ResultSetFilterpublic ResultSetFilter createMaxNumResultSetFilter(int maxnum)
maxnum - Maximum number of rows to copy.
MaxNumResultSetFilter,
ResultSetFilter,
copyFiltered(intradoc.data.ResultSet, java.lang.String, intradoc.data.ResultSetFilter)
public void copyFilteredEx(ResultSet rset,
java.lang.String key,
ResultSetFilter filter,
boolean startAtFirst)
rset - Result set to copy from.key - Column used by filter. The column value will be passed to
the filter for each row.filter - The criteria that a row must match to be copied.startAtFirst - Flag indicates whether the copied result set
will be set to the first row.copy(intradoc.data.ResultSet, int)public boolean isCopyAborted()
public void copyFieldInfo(ResultSet rset)
rset - Result set to copy from.FieldInfo
public void merge(java.lang.String colKey,
ResultSet rset,
boolean replaceOnly)
throws DataException
colKey - Column to merge on if non-null. Otherwise all rows in rset will be
merged in.rset - Result set to merge fromreplaceOnly - Specifies if this will only do a replace of the existing rows, where
existence is determined by colKey. If replaceOnly if false, then
rows will be appended.
DataException - If the non-null colKey does not exist in either the from
or to result set.
public void mergeDelete(java.lang.String colKey,
ResultSet rset,
boolean isCaseSensitive)
throws DataException
colKey - Column to use to test for matches.rset - Result set that should be used as source of rows to remove.isCaseSensitive - Specifies whether the colunm values should be tested in a case sensitive fashion.
DataException - If the colKey does not exist in either the from
or to result set.public java.util.Vector createEmptyRow()
public java.util.Vector findRow(int colIndex,
java.lang.String val)
colIndex - Column index for lookup.val - Value the column must match.
public void appendFields(java.util.Vector finfo)
finfo - Vector containing the field information for the new columns.FieldInfopublic void mergeFields(DataResultSet rset)
rset - Result set containing the fields to append.public void removeFields(java.lang.String[] fieldNames)
public boolean renameField(java.lang.String from,
java.lang.String to)
from - Previous name of field.to - New name of field.
public void reset()
public void removeAll()
public void readSimple(java.io.BufferedReader bReader,
DataDecode decoder,
boolean isHeaderOnly)
throws java.io.IOException
decoder - Mechanism used for parsing escaped characters.isHeaderOnly - If set to true, reads only the field information and not the values.
Useful for determining the definition of a result set.
java.io.IOExceptionDataDecode,
BufferedReader
public int readHeader(java.io.BufferedReader bReader,
DataDecode decoder)
throws java.io.IOException
bReader - Character stream containing the result set informationdecoder - Mechanism used for parsing escaped characters.
java.io.IOException - If an I/O error occurs.public int getCurrentRow()
public void setCurrentRow(int currentRow)
public int getNumRows()
public java.util.Vector getRowValues(int index)
public java.util.Vector getCurrentRowValues()
public java.util.Properties getCurrentRowProps()
public void setRowValues(java.util.Vector vect,
int i)
public void setCurrentValue(int index,
java.lang.String val)
throws DataException
DataException - If row does not exist or column index is not valid.public void deleteRow(int index)
public boolean deleteCurrentRow()
public void addRow(java.util.Vector vect)
public void insertRowAt(java.util.Vector vect,
int i)
public java.util.Vector createRow(Parameters params)
throws DataException
params - Mapping of columns and values for the new row.
DataException - If a column is not found in the params.Parameterspublic Workspace getWorkspace()
ResultSetpublic int getNumFields()
getNumFields in interface ResultSetResultSetpublic boolean isEmpty()
isEmpty in interface ResultSetResultSetpublic boolean isRowPresent()
isRowPresent in interface ResultSetResultSetpublic java.lang.String getFieldName(int index)
getFieldName in interface ResultSetindex - Index into array of fields associated with this result set.
ResultSet
public boolean getFieldInfo(java.lang.String fieldName,
FieldInfo fieldInfo)
getFieldInfo in interface ResultSetfieldName - Name of field being looked up.fieldInfo - Holds information about the field after this method
is called. Note: fieldInfo.m_index will hold the field index usable as
a parameter to the calls 'getStringValue' and 'getDateValue'.
ResultSet
public void getIndexFieldInfo(int index,
FieldInfo fieldInfo)
getIndexFieldInfo in interface ResultSetindex - Index into array of fields assocated with this result set.fieldInfo - Holds information about the field after this method
is called.ResultSetpublic java.lang.String getStringValue(int index)
getStringValue in interface ResultSetindex - Index into array of fields assocated with this result set.
ResultSetpublic java.util.Date getDateValue(int index)
getDateValue in interface ResultSetindex - Index into array of fields assocated with this result set.
ResultSetpublic boolean next()
next in interface ResultSetResultSetpublic boolean previous()
public boolean first()
first in interface ResultSetResultSetpublic boolean last()
public int skip(int numRows)
skip in interface ResultSetpublic void closeInternals()
closeInternals in interface ResultSetResultSetpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
(c) 1996-2005 All rights reserved. Stellent, Inc. |