com.crystaldecisions.sdk.occa.report.data
Class Rowset

java.lang.Object
  extended by com.crystaldecisions.sdk.occa.report.data.Rowset
All Implemented Interfaces:
IRowset, IClone

public class Rowset
extends java.lang.Object
implements IRowset

This object stores a set of rows from a table of data. The Rowset object is used to store the raw data it has retrieved and filtered in a flat format. When the RAS SDK retrieves rows from the RAS server, it does so in batches, which are of equal size except the last batch. A batch is only retrieved when it is needed or when you explicitly state you want a batch. The batches are stored in the RecordBatches object; access this collection using the getRecordBatches() method.

Use the RowsetController object's createCursor method to create, navigate, and retrieve the rowset for a report. Note, however, that when you call this function, it does not automatically retrieve all the record batches: it was intended to retrieve records in batches. For example, it could be used to display a certain number of records per web page. To retrieve record batches in the rowset, do the following:

To retrieve record batches:

  1. Set the record batch size in the RowsetController using the setBatchSize method, and the number of batches to be cached in the cursor using the setNumOfCachedBatches method.
  2. Call the createCursor method.
  3. Use the moveTo method to fetch the batch that you want.
  4. Repeat step three until you reach the getRecordCount method, or when isEOF method returns true.
For example, suppose that RowsetBatchSize is 100, RecordCount is 500, and NumOfCachedBatches is 2.

When reading the records in the batches, be aware that the records may be filtered or sorted and thus the record keys may not be consecutive or may not be there at all: the row number, however, is always consecutive. Use the getIsRecordKeyConsecutive() method to determine whether the record keys are in consecutive order or not. The batches that have been retrieved may also be stored in an XML format. You may do this using the saveToXML method.

Note: When you save the data to XML only the data that has been retrieved is saved. This means that only a part of the record set may be saved if you have not retrieved all batches.

When possible, use the {IRowset} interface to manipulate this object.


Constructor Summary
Rowset()
           
Rowset(IRowset src)
           
 
Method Summary
 java.lang.Object clone(boolean deepClone)
           
 void copyTo(java.lang.Object destObject, boolean deepCopy)
           
 java.lang.Object createMember(java.lang.String eleName, org.xml.sax.Attributes attrs, XMLSerializationContext ctxt, java.util.Map objState, boolean[] bLoaded)
           For internal use only.
 void endElement(java.lang.String eleName, java.util.Map objState)
           For internal use only.
 int getBatchSize()
           Returns the size of the record batches.
 int getFirstRecordKey()
           Returns the key of the first record in the set.
 boolean getIsRecordKeyConsecutive()
           Returns true if the record keys are consecutive, and false otherwise.
 boolean getIsTotalRecordKnown()
           Returns true if the total number of records in the rowset is known, and false otherwise.
 IRowsetMetaData getMetaData()
           Returns the rowset's column headings.
 RecordBatches getRecordBatches()
           Returns the record batches that have been retrieved.
 int getTotalRecordCount()
           Returns the total number of rows in the rowset.
 java.lang.String getXMLData()
           Returns a string that stores the data in the rowset in XML format.
 boolean hasContent(java.lang.Object srcRowset)
           
 void loadFromXML(java.lang.Object xmlSource)
           Loads data from an XML file into the rowset.
 void readElement(java.lang.String eleName, java.lang.String sVal, org.xml.sax.Attributes attrs, java.util.Map objState)
           For internal use only.
 void save(XMLWriter writer, java.lang.String sTag, XMLSerializationContext ctxt)
           For internal use only.
 void save(XMLWriter writer, XMLSerializationContext ctxt)
           For internal use only.
 void saveContents(com.crystaldecisions.xml.serialization.XMLWriter writer, com.crystaldecisions.xml.serialization.XMLSerializationContext ctxt)
           For internal use only.
 void saveToXML(java.lang.Object desination)
           Saves the data in the RecordBatches collection to a file in XML format.
 void setBatchSize(int batchSize)
           Sets the size of the record batches.
 void setFirstRecordKey(int recordKey)
           Sets the key of the first record in the set.
 void setIsRecordKeyConsecutive(boolean isRecordKeyConsecutive)
           Sets> if the record keys are consecutive.
 void setMetaData(IRowsetMetaData metaData)
           Sets the rowset's column headings.
 void setRecordBatches(RecordBatches recordBatches)
           Sets the record batches that have been retrieved.
 void setTotalRecordCount(int totalRecordCount)
           Sets the total number of rows in the rowset.
 void setXMLData(java.lang.String source)
           Sets the string that stores the data in the rowset in XML format.
 void startElement(java.lang.String eleName, java.util.Map objState, org.xml.sax.Attributes attrs)
           For internal use only.
 void writeRowsetSchema(XMLWriter writer, XMLSerializationContext ctxt, java.lang.String schemaNamespaceTag)
           For internal use only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rowset

public Rowset(IRowset src)

Rowset

public Rowset()
Method Detail

clone

public java.lang.Object clone(boolean deepClone)

copyTo

public void copyTo(java.lang.Object destObject,
                   boolean deepCopy)

createMember

public java.lang.Object createMember(java.lang.String eleName,
                                     org.xml.sax.Attributes attrs,
                                     XMLSerializationContext ctxt,
                                     java.util.Map objState,
                                     boolean[] bLoaded)

For internal use only.


endElement

public void endElement(java.lang.String eleName,
                       java.util.Map objState)

For internal use only.


getBatchSize

public int getBatchSize()
Description copied from interface: IRowset

Returns the size of the record batches.

Specified by:
getBatchSize in interface IRowset
Returns:
An int that specifies the size of the record batches.

getFirstRecordKey

public int getFirstRecordKey()
Description copied from interface: IRowset

Returns the key of the first record in the set.

Specified by:
getFirstRecordKey in interface IRowset
Returns:
An int that specifies the key of the first record in the set.

getIsRecordKeyConsecutive

public boolean getIsRecordKeyConsecutive()
Description copied from interface: IRowset

Returns true if the record keys are consecutive, and false otherwise.

Specified by:
getIsRecordKeyConsecutive in interface IRowset
Returns:
true if the record keys are consecutive, and false otherwise.

getIsTotalRecordKnown

public boolean getIsTotalRecordKnown()
Description copied from interface: IRowset

Returns true if the total number of records in the rowset is known, and false otherwise.

Specified by:
getIsTotalRecordKnown in interface IRowset
Returns:
true if the total number of records in the rowset is known, and false otherwise.

getMetaData

public IRowsetMetaData getMetaData()
Description copied from interface: IRowset

Returns the rowset's column headings.

Specified by:
getMetaData in interface IRowset
Returns:
An IRowsetMetaData object containing the rowset's column headings.

getRecordBatches

public RecordBatches getRecordBatches()
Description copied from interface: IRowset

Returns the record batches that have been retrieved.

Specified by:
getRecordBatches in interface IRowset
Returns:
A RecordBatches object that contains the record batches that have been retrieved.

getTotalRecordCount

public int getTotalRecordCount()
Description copied from interface: IRowset

Returns the total number of rows in the rowset. If the total number of records is not known, this number is 7FFFFFFF hex (2147483647 decimal).

Specified by:
getTotalRecordCount in interface IRowset
Returns:
An int that specifies the total number of rows in the rowset.

getXMLData

public java.lang.String getXMLData()
                            throws java.io.IOException
Description copied from interface: IRowset

Returns a string that stores the data in the rowset in XML format. To save the XML data to a file use the saveToXML method.

Specified by:
getXMLData in interface IRowset
Returns:
A String that stores the data in the rowset in XML format.
Throws:
java.io.IOException

hasContent

public boolean hasContent(java.lang.Object srcRowset)

loadFromXML

public void loadFromXML(java.lang.Object xmlSource)
                 throws java.io.FileNotFoundException,
                        java.io.IOException,
                        org.xml.sax.SAXException
Description copied from interface: IRowset

Loads data from an XML file into the rowset.

Specified by:
loadFromXML in interface IRowset
Parameters:
xmlSource - The path and filename of the XML file. In Java this may also be an InputStream.
Throws:
java.io.FileNotFoundException
java.io.IOException
org.xml.sax.SAXException

readElement

public void readElement(java.lang.String eleName,
                        java.lang.String sVal,
                        org.xml.sax.Attributes attrs,
                        java.util.Map objState)

For internal use only.


save

public void save(XMLWriter writer,
                 XMLSerializationContext ctxt)
          throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

save

public void save(XMLWriter writer,
                 java.lang.String sTag,
                 XMLSerializationContext ctxt)
          throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

saveContents

public void saveContents(com.crystaldecisions.xml.serialization.XMLWriter writer,
                         com.crystaldecisions.xml.serialization.XMLSerializationContext ctxt)
                  throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

saveToXML

public void saveToXML(java.lang.Object desination)
               throws java.io.IOException,
                      ReportSDKException
Description copied from interface: IRowset

Saves the data in the RecordBatches collection to a file in XML format.

When you save to XML only the record batches that have been retrieved from the server are saved. The XML format is ADO RecordSet compatible.

Specified by:
saveToXML in interface IRowset
Parameters:
desination - An Object that specifies the path and filename of the XML file.
Throws:
java.io.IOException
ReportSDKException

setBatchSize

public void setBatchSize(int batchSize)
Description copied from interface: IRowset

Sets the size of the record batches.

Specified by:
setBatchSize in interface IRowset
Parameters:
batchSize - An int that specifies the size of the record batches.

setFirstRecordKey

public void setFirstRecordKey(int recordKey)
Description copied from interface: IRowset

Sets the key of the first record in the set.

Specified by:
setFirstRecordKey in interface IRowset
Parameters:
recordKey - An int that specifies the key of the first record in the set.

setIsRecordKeyConsecutive

public void setIsRecordKeyConsecutive(boolean isRecordKeyConsecutive)
Description copied from interface: IRowset

Sets> if the record keys are consecutive.

Specified by:
setIsRecordKeyConsecutive in interface IRowset
Parameters:
isRecordKeyConsecutive - true if the record keys are consecutive, and false otherwise.

setMetaData

public void setMetaData(IRowsetMetaData metaData)
Description copied from interface: IRowset

Sets the rowset's column headings.

Specified by:
setMetaData in interface IRowset
Parameters:
metaData - An IRowsetMetaData object containing the rowset's column headings.

setRecordBatches

public void setRecordBatches(RecordBatches recordBatches)
Description copied from interface: IRowset

Sets the record batches that have been retrieved.

Specified by:
setRecordBatches in interface IRowset
Parameters:
recordBatches - A RecordBatches object that contains the record batches that have been retrieved.

setTotalRecordCount

public void setTotalRecordCount(int totalRecordCount)
Description copied from interface: IRowset

Sets the total number of rows in the rowset. If the total number of records is not known, this number is 7FFFFFFF hex (2147483647 decimal).

Specified by:
setTotalRecordCount in interface IRowset
Parameters:
totalRecordCount - An int that specifies the total number of rows in the rowset.

setXMLData

public void setXMLData(java.lang.String source)
                throws java.io.IOException
Description copied from interface: IRowset

Sets the string that stores the data in the rowset in XML format. To save the XML data to a file use the saveToXML method.

Specified by:
setXMLData in interface IRowset
Parameters:
source - A String that stores the data in the rowset in XML format.
Throws:
java.io.IOException

startElement

public void startElement(java.lang.String eleName,
                         java.util.Map objState,
                         org.xml.sax.Attributes attrs)

For internal use only.


writeRowsetSchema

public void writeRowsetSchema(XMLWriter writer,
                              XMLSerializationContext ctxt,
                              java.lang.String schemaNamespaceTag)
                       throws java.io.IOException

For internal use only.

Throws:
java.io.IOException