com.wrq.apptrieve.appconn
Class AppConnRecordSet

java.lang.Object
  extended by com.wrq.apptrieve.appconn.AppConnRecordSet
All Implemented Interfaces:
java.io.Serializable

public class AppConnRecordSet
extends java.lang.Object
implements java.io.Serializable

An AppConnRecordSet contains data and metadata from a recordset or table. If an AppConnRecordSet is returned from AppConnModel.fetchRecords(int, java.util.List, java.lang.String), then it contains AppConnModelRecord records. If the AppconnRecordSet is return from AppConnTable.performTableProcedure(java.lang.String, java.lang.String, java.util.Map, java.util.Map, boolean, java.util.List, int) or AppConnTable.executeSQLStatement(java.lang.String), then it contains AppConnRecord records.

See Also:
Serialized Form

Constructor Summary
AppConnRecordSet()
          Constructor for internal use only.
 
Method Summary
 void fromXMLString(java.lang.String xmlString)
          Converts from an XML String to an AppConnRecordSet.
 AppConnRecord get(int recordNumber)
          Gets a record of the record set.
 int getCount()
          Gets the number of records in the record set.
 AppConnMetaData getElementMetaDataByIndex(int elementIndex)
          Returns the metadata object for a indexed element in the record set.
 AppConnMetaData getElementMetaDataByName(java.lang.String elementName)
          Returns the metadata object for a named element in the record set.
 java.util.List getElementsMetaData()
          Returns the metadata for all elements in the record set.
 java.util.Locale getLocale()
          Gets the locale for the AppConnRecordSet.
 int getNumElements()
          Gets the number of elements in a record of the record set.
 java.util.List getRecords()
          Gets all of the records in the record set.
 int getRecordType()
          Gets the type of records store in this record set object.
 void setLocale(java.util.Locale locale)
          Sets the locale for this AppConnRecordSet.
 java.lang.String toString()
          Converts AppConnRecordSet to a string.
 java.lang.String toXMLString()
          Converts AppConnRecordSet to an XML string.
 java.lang.String toXMLString(java.net.URL urlDTD)
          Converts AppConnRecordSet to an XML string, according to a specified DTD.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppConnRecordSet

public AppConnRecordSet()
Constructor for internal use only.

Method Detail

fromXMLString

public void fromXMLString(java.lang.String xmlString)
                   throws ApptrieveException
Converts from an XML String to an AppConnRecordSet.

Example XML string: <appconn><recordset><record> <column name="LastName">Smith</column></record><recordset></appconn>

Parameters:
xmlString - java.lang.String - The XML string to convert
Throws:
ApptrieveException - - if a conversion error occurs
See Also:
toXMLString()

get

public AppConnRecord get(int recordNumber)
Gets a record of the record set. The first record number is 0.

Parameters:
recordNumber - int - The 0-based record number to get
Returns:
AppConnRecord - null if no record found for recordNumber
See Also:
List.get(int)

getCount

public int getCount()
Gets the number of records in the record set.

Returns:
int the number of records in the record set

getElementsMetaData

public java.util.List getElementsMetaData()
Returns the metadata for all elements in the record set.

Returns:
java.util.List - a List of AppConnMetaData objects, which will be either FieldMetaData or ColumnMetaData depending on the type of records contained in the record set.

getElementMetaDataByIndex

public AppConnMetaData getElementMetaDataByIndex(int elementIndex)
Returns the metadata object for a indexed element in the record set. The first element has an index of 0;

Parameters:
elementIndex - int - The 0-based index of the element
Returns:
either a FieldMetaData or ColumnMetaData object depending on the type of records contained in the record set.

getElementMetaDataByName

public AppConnMetaData getElementMetaDataByName(java.lang.String elementName)
Returns the metadata object for a named element in the record set.

Parameters:
elementName - String - The name of the element (field or column)
Returns:
either a FieldMetaData or ColumnMetaData object depending on the type of records contained in the record set.

getLocale

public java.util.Locale getLocale()
Gets the locale for the AppConnRecordSet.

Returns:
Locale - the current locale.
See Also:
setLocale(java.util.Locale)

getNumElements

public int getNumElements()
Gets the number of elements in a record of the record set.

These are the columns or fields of the record, depending upon the type of records stored in the recordset.

Returns:
int the number of fields of columns in each record

getRecords

public java.util.List getRecords()
Gets all of the records in the record set.

The returned object is an object that implements the java.util.List interface. Each element of the list is a record of the record set, AppConnRecord objects if the record was generated from an AppConnTable interface method or AppConnModelRecord objects if the record set was generated from an AppConnModel interface method.

Returns:
java.util.List a List containing AppConnRecord or AppConnModelRecord objects

getRecordType

public int getRecordType()
Gets the type of records store in this record set object.

Returns:
int - AppConnRecord.RECORD_TYPE_MODEL or AppConnRecord.RECORD_TYPE_TABLE

setLocale

public void setLocale(java.util.Locale locale)
               throws ApptrieveException
Sets the locale for this AppConnRecordSet.

Parameters:
locale - Locale - the Locale to use in the AppConnRecordSet.
Throws:
ApptrieveException - - if locale is null
See Also:
getLocale()

toString

public java.lang.String toString()
Converts AppConnRecordSet to a string.

Note: This method requires that xercesImpl.jar and xmlParserAPIs.jar are present in the classpath. The JRE supplied with VHI supplies these added jars in the lib/endorsed directory, but they are not present by default.

Overrides:
toString in class java.lang.Object
Returns:
An xml string that represents the data and metadata stored in the recordset.

toXMLString

public java.lang.String toXMLString()
                             throws ApptrieveException
Converts AppConnRecordSet to an XML string.

Returns:
An xml string that represents the data and metadata stored in the recordset.
Throws:
ApptrieveException - - if a conversion error occurs
See Also:
fromXMLString(java.lang.String)

toXMLString

public java.lang.String toXMLString(java.net.URL urlDTD)
                             throws ApptrieveException
Converts AppConnRecordSet to an XML string, according to a specified DTD.

Example XML output: <appconn><recordset><record> <attribute name="LastName">Smith</attribute></record><recordset></appconn>

Note: This method requires that xercesImpl.jar and xmlParserAPIs.jar are present in the classpath. The JRE supplied with VHI supplies these added jars in the lib/endorsed directory, but they are not present by default.

Parameters:
urlDTD - a DTD URL that will be embedded in the generated XML string
Returns:
An xml string that represents the data and metadata stored in the recordset.
Throws:
ApptrieveException - - if a conversion error occurs
See Also:
toXMLString()