org.koala.koalautil
Class RowCollection

java.lang.Object
  |
  +--org.koala.koalautil.RowCollection

public class RowCollection
extends java.lang.Object

Allows the storing in memory of the result of a query on a data repository. It is structured like java.sql.ResultSet, provides a similar interface, but does not depend on the DBMS conection to provide information


Constructor Summary
RowCollection()
          Creates an empty RowCollection
RowCollection(java.sql.ResultSet rs)
          Creates a new RowCollection obtaining data from a ResultSet
 
Method Summary
 void addRow()
           
 void firstRow()
          Positions the cursor on the first record
 java.math.BigInteger getBigInteger(java.lang.String fieldName)
           
 double getDouble(java.lang.String fieldName)
           
 java.util.GregorianCalendar getGregorianCalendar(java.lang.String fieldName)
           
 int getInt(java.lang.String fieldName)
           
 java.lang.Object getObject(java.lang.String fieldName)
          Given a fields name, it returns it's value in the current record.
 java.lang.String getString(java.lang.String fieldName)
           
 void insert(java.lang.String fieldName, java.lang.Object object)
           
 boolean next()
          If there is a next element, we move one position
 int position()
          returns the current record's index
 void removeRow()
           
 int rowCount()
          Returns the ammount of rows in the object
 boolean search(java.lang.String fieldName, java.lang.String keyValue)
           
 java.lang.String toCSV()
          converts the RowCollection into a csv String
 org.koala.koalaxml.XML toXML()
          Converts data to XML, generating a ... for each row in the list, being N the row number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowCollection

public RowCollection()
              throws ChainedException
Creates an empty RowCollection

Throws:
ChainedException

RowCollection

public RowCollection(java.sql.ResultSet rs)
              throws ChainedException
Creates a new RowCollection obtaining data from a ResultSet

Parameters:
rs - ResultSet from which we obtain data
Throws:
ChainedException
Method Detail

toCSV

public java.lang.String toCSV()
                       throws ChainedException
converts the RowCollection into a csv String

Returns:
Throws:
ChainedException

toXML

public org.koala.koalaxml.XML toXML()
                             throws ChainedException
Converts data to XML, generating a ... for each row in the list, being N the row number

Returns:
XML generated
Throws:
ChainedException

next

public boolean next()
             throws ChainedException
If there is a next element, we move one position

Returns:
True if there is a next element, False otherwise
Throws:
ChainedException

rowCount

public int rowCount()
             throws ChainedException
Returns the ammount of rows in the object

Returns:
number of rows in the object
Throws:
ChainedException

getObject

public java.lang.Object getObject(java.lang.String fieldName)
                           throws ChainedException
Given a fields name, it returns it's value in the current record.

Parameters:
fieldName - Nombre del fieldName.
Returns:
the key's value or null if the key is not mapped
Throws:
ChainedException

getInt

public int getInt(java.lang.String fieldName)
           throws ChainedException
Parameters:
fieldName - Nombre del fieldName.
Returns:
Throws:
ChainedException

getGregorianCalendar

public java.util.GregorianCalendar getGregorianCalendar(java.lang.String fieldName)
                                                 throws ChainedException
Parameters:
fieldName -
Returns:
Throws:
ChainedException

getDouble

public double getDouble(java.lang.String fieldName)
                 throws ChainedException
Parameters:
fieldName -
Returns:
Throws:
ChainedException

getString

public java.lang.String getString(java.lang.String fieldName)
                           throws ChainedException
Parameters:
fieldName - Nombre del fieldName.
Returns:
Throws:
ChainedException

getBigInteger

public java.math.BigInteger getBigInteger(java.lang.String fieldName)
                                   throws ChainedException
Parameters:
fieldName - Nombre del fieldName.
Returns:
Throws:
ChainedException

addRow

public void addRow()
            throws ChainedException
Throws:
ChainedException

insert

public void insert(java.lang.String fieldName,
                   java.lang.Object object)
            throws ChainedException
Parameters:
object -
fieldName - Nombre del fieldName.
Throws:
ChainedException

search

public boolean search(java.lang.String fieldName,
                      java.lang.String keyValue)
               throws ChainedException
Parameters:
keyValue -
fieldName -
Returns:
Throws:
ChainedException

removeRow

public void removeRow()
               throws ChainedException
Throws:
ChainedException

firstRow

public void firstRow()
Positions the cursor on the first record


position

public int position()
returns the current record's index

Returns: