info.informatica.data
Interface Dataset

All Known Implementing Classes:
AbstractDataset, ArrayIteratorDataset, EmptyDataset, GenericDataset, IteratorDataset, ListDataset, ResultsetDataset, SampleDataset

public interface Dataset

Interface to access sets of generic data.

Version:
1.03
Author:
amengual at informatica dot info

Method Summary
 void close()
          Closes the Dataset.
 Object evaluate(String id)
          Sometimes you want to directly access a field or method and evaluate it, instead of getting the object and then accessing the field or calling the method.
 int findColumn(FieldName name)
          Finds the index of the given column name of the dataset.
 String getCatalogName(int i)
          Gets the designated data item's catalog name.
 int getColumnCount()
           
 FieldName getColumnName(int i)
          Gets the designated data item's column name.
 Date getDate(FieldName id)
          Returns Date of name id.
 Date getDate(int i)
          Returns Date of index i.
 double getDouble(FieldName id)
          Returns double of name id
 double getDouble(int i)
          Returns int of index i
 Map<String,? extends Object> getEnviron()
          Gets a global "environment" Map, if available.
 int getInt(FieldName id)
          Returns int of name id
 int getInt(int i)
          Returns int of index i
 String getLabel()
          Gets the label of this Set, or null if not available.
 long getLong(FieldName id)
          Returns long of name id
 long getLong(int i)
          Returns long of index i
 Map<FieldName,Object> getMap()
          Gets a name -> values map containing the current data row.
 MetaData getMetaData()
          Gets the meta data for this data set.
 Dataset getNestedSet(String datasetName)
          It is allowed to have another Datasets nested to the current Dataset row.
 Object getObject(FieldName id)
          Returns Object of name id
 Object getObject(int i)
          Returns Object of index i
 String getString(FieldName id)
          Returns String of name id.
 String getString(int i)
          Returns String of index i.
 boolean isAfterLast()
          Retrieves wether the dataset is after its last row.
 boolean isEmpty()
           
 boolean isLast()
          Retrieves wether the dataset is on its last row.
 boolean next()
          Positions the Dataset at the next row of data.
 void reset()
          Puts the Dataset cursor in the initial state, regardless of the current cursor state.
 void setEnviron(Map<String,? extends Object> environ)
          Sets a global "environment" Map.
 

Method Detail

getDate

Date getDate(FieldName id)
             throws DatasetException
Returns Date of name id.

Returns:
the Date value of name id.
Throws:
DatasetException - if the data repository produced an error.

getDate

Date getDate(int i)
             throws DatasetException
Returns Date of index i.

Returns:
the Date value of index i.
Throws:
DatasetException - if the data repository produced an error.

getDouble

double getDouble(FieldName id)
                 throws DatasetException
Returns double of name id

Throws:
DatasetException - if the data repository produced an error.

getDouble

double getDouble(int i)
                 throws DatasetException
Returns int of index i

Throws:
DatasetException - if the data repository produced an error.

getInt

int getInt(FieldName id)
           throws DatasetException
Returns int of name id

Throws:
DatasetException - if the data repository produced an error.

getInt

int getInt(int i)
           throws DatasetException
Returns int of index i

Throws:
DatasetException - if the data repository produced an error.

getObject

Object getObject(FieldName id)
                 throws DatasetException
Returns Object of name id

Throws:
DatasetException - if the data repository produced an error.

getObject

Object getObject(int i)
                 throws DatasetException
Returns Object of index i

Throws:
DatasetException - if the data repository produced an error.

getLong

long getLong(FieldName id)
             throws DatasetException
Returns long of name id

Throws:
DatasetException - if the data repository produced an error.

getLong

long getLong(int i)
             throws DatasetException
Returns long of index i

Throws:
DatasetException - if the data repository produced an error.

getString

String getString(FieldName id)
                 throws DatasetException
Returns String of name id.

Throws:
DatasetException - if the data repository produced an error.

getString

String getString(int i)
                 throws DatasetException
Returns String of index i.

Throws:
DatasetException - if the data repository produced an error.

evaluate

Object evaluate(String id)
                throws DatasetException
Sometimes you want to directly access a field or method and evaluate it, instead of getting the object and then accessing the field or calling the method. The evaluate method provides a way to do that, and when called it will either return a variable named id or a method evaluation of the style package.object.method.

Parameters:
id - Fully qualified function name (package.object.function) or fqfn
Returns:
the result given by the function, or the object itself if there is no function (dot not specified in fqfn), or null if the function or method are not available.
Throws:
DatasetException - if the data repository produced an error.

getLabel

String getLabel()
Gets the label of this Set, or null if not available.


isEmpty

boolean isEmpty()
                throws DatasetException
Returns:
true if the Dataset is empty, false otherwise.
Throws:
DatasetException

next

boolean next()
             throws DatasetException
Positions the Dataset at the next row of data.

Returns:
false if there were no more rows, true otherwise.
Throws:
DatasetException - if the data repository produced an error.

getColumnCount

int getColumnCount()
                   throws DatasetException
Returns:
the number of columns of this Dataset.
Throws:
DatasetException - if the data repository produced an error.

getCatalogName

String getCatalogName(int i)
                      throws DatasetException
Gets the designated data item's catalog name.

Throws:
DatasetException - if the data repository produced an error.

getColumnName

FieldName getColumnName(int i)
                        throws DatasetException
Gets the designated data item's column name.

Throws:
DatasetException

getMetaData

MetaData getMetaData()
                     throws DataException
Gets the meta data for this data set.

Returns:
the meta data for this data set, or null if not available.
Throws:
DataException - if the data repository produced an error.

isAfterLast

boolean isAfterLast()
                    throws DatasetException
Retrieves wether the dataset is after its last row.

Returns:
true if the dataset is after its last row, false otherwise.
Throws:
DatasetException - if the data repository produced an error.

isLast

boolean isLast()
               throws DatasetException
Retrieves wether the dataset is on its last row.

Evaluation of this method could be expensive.

Returns:
true if the dataset is on its last row, false otherwise.
Throws:
DatasetException - if the data repository produced an error.

reset

void reset()
           throws DatasetException
Puts the Dataset cursor in the initial state, regardless of the current cursor state.

This method allows the reuse of a Dataset object after all rows have been extracted by the use of the next() function.

This method is optional. Implementations are required to throw an UnsupportedOperationException in case they do not implement it.

Throws:
DatasetException - if an error happened when resetting the data.
UnsupportedOperationException - if method is not implemented.

close

void close()
           throws DatasetException
Closes the Dataset.

No further work is possible with the Dataset after closing it.

Throws:
DatasetException - if an error happens when closing the Dataset.

findColumn

int findColumn(FieldName name)
               throws DatasetException
Finds the index of the given column name of the dataset.

Returns:
the index of the given column name of the dataset, or -1 if the column name is not known.
Throws:
DatasetException - if an error happens when accessing the data.

getMap

Map<FieldName,Object> getMap()
                             throws DatasetException
Gets a name -> values map containing the current data row.

Optional operation.

Returns:
a Map with the current data row. Cannot return null.
Throws:
DatasetException - if an error happens when creating the Map.
IllegalStateException - if data is not available because of a state problem (for example, next() not been called).
UnsupportedOperationException - if the class does not support this method.

getEnviron

Map<String,? extends Object> getEnviron()
Gets a global "environment" Map, if available.

Returns:
a Map with the environment, or null if no environment is available.

setEnviron

void setEnviron(Map<String,? extends Object> environ)
Sets a global "environment" Map.

Parameters:
environ - a Map with the environment.

getNestedSet

Dataset getNestedSet(String datasetName)
                     throws DatasetException
It is allowed to have another Datasets nested to the current Dataset row.

This is an optional operation. Datasets not supporting it must throw an UnsupportedOperationException.

Parameters:
datasetName - the name of the requested Dataset.
Returns:
the Dataset nested into the current row.
Throws:
DatasetException - if the data repository produced an error.
UnsupportedOperationException - if this Dataset does not support nested Datasets.