com.hardcode.gdbms.engine.strategies
Class FilteredDataSource

java.lang.Object
  extended by com.hardcode.gdbms.engine.strategies.OperationDataSource
      extended by com.hardcode.gdbms.engine.strategies.FilteredDataSource
All Implemented Interfaces:
DataSource, ReadAccess

public class FilteredDataSource
extends OperationDataSource

Representa una fuente de datos que contiene una cláusula where mediante la cual se filtran los campos

Author:
Fernando González Cortés

Field Summary
 
Fields inherited from interface com.hardcode.gdbms.engine.data.DataSource
COHERENT_ROW_ORDER, DIRECT_MODE, DISPATCH, IGNORE, STORE
 
Constructor Summary
FilteredDataSource(DataSource source, Expression whereExpression)
          Creates a new FilteredDataSource object.
 
Method Summary
 Value[] aggregatedFilter(Expression[] fields)
           
 void filtrar()
          Método que construye el array de índices de las posiciones que las filas filtradas ocupan en el DataSource origen
 Metadata getDataSourceMetadata()
          Gets the meta data about the source of this DataSource
 int getFieldIndexByName(java.lang.String fieldName)
          Obtiene el indice de un campo a partir de su nombre o -1 si no existe un campo con ese nombre
 Value getFieldValue(long rowIndex, int fieldId)
          Obtiene el valor que se encuentra en la fila y columna indicada
 Memento getMemento()
          Gets a memento object with the current status of the DataSource
 long getRowCount()
          Obtiene el número de registros del DataSource
 long[] getWhereFilter()
          DOCUMENT ME!
 void start()
          Opens the DataSource to access the data it contains.
 void stop()
          Closes the DataSource.
 
Methods inherited from class com.hardcode.gdbms.engine.strategies.OperationDataSource
addEditionListener, addField, addField, addMetadataEditionListener, addSelectionListener, beginTrans, canRedo, canUndo, check, commitTrans, deleteRow, getAlias, getAsString, getDataSourceFactory, getDispatchingMode, getDriver, getDriverMetadata, getFieldNames, getName, getRow, getSelectedRows, getSQL, insertEmptyRow, insertEmptyRowAt, insertFilledRow, insertFilledRowAt, isModified, redo, remove, removeEditionListener, removeField, removeMetadataEditionListener, removeSelectionListener, rollBackTrans, saveData, setAlias, setDataSourceFactory, setDispatchingMode, setFieldName, setFieldValue, setName, setSelectedRows, setSQL, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredDataSource

public FilteredDataSource(DataSource source,
                          Expression whereExpression)
Creates a new FilteredDataSource object.

Parameters:
source - DataSource que se va a filtrar
whereExpression - Expresión de la cláusula where
Method Detail

aggregatedFilter

public Value[] aggregatedFilter(Expression[] fields)
                         throws IncompatibleTypesException,
                                DriverException,
                                EvaluationException,
                                java.io.IOException
Throws:
IncompatibleTypesException
DriverException
EvaluationException
java.io.IOException

filtrar

public void filtrar()
             throws DriverException,
                    java.io.IOException,
                    SemanticException,
                    EvaluationException
Método que construye el array de índices de las posiciones que las filas filtradas ocupan en el DataSource origen

Throws:
DriverException - Si se produce un fallo en el driver al acceder a los datos
java.io.IOException - Si se produce un error usando las estructuras de datos internas
SemanticException - Si se produce algún error semántico al evaluar la expresión
IncompatibleTypesException - Si la expresión where no evalua a booleano
EvaluationException - If the expression evaluation fails

start

public void start()
           throws DriverException
Description copied from interface: DataSource
Opens the DataSource to access the data it contains. If the data is accessed without a previous opening a ClosedDataSourceException is thrown. If this method is invoked twice then only the second call to stop will close the DataSource.
If the DataSource was obtained with an AUTOMATIC_OPENING mode, there's no need to open the DataSource. Indeed start calls are ignored. It's possible to close the DataSource by a single call to the close method

Throws:
DriverException - if the operation fails
See Also:
com.hardcode.gdbms.engine.data.DataSource#open()

stop

public void stop()
          throws DriverException
Description copied from interface: DataSource
Closes the DataSource. After a DataSource is closed it's data cannot be retrieved. Any attempt to do so will result in a DataSourceClosedException

Throws:
DriverException - If the operation fails
See Also:
com.hardcode.gdbms.engine.data.DataSource#close()

getFieldIndexByName

public int getFieldIndexByName(java.lang.String fieldName)
                        throws DriverException
Description copied from interface: DataSource
Obtiene el indice de un campo a partir de su nombre o -1 si no existe un campo con ese nombre

Specified by:
getFieldIndexByName in interface DataSource
Overrides:
getFieldIndexByName in class OperationDataSource
Parameters:
fieldName - Nombre del campo
Returns:
Indice del campo con el nombre dado o -1 si el campo no existe
Throws:
DriverException - Si se produce un error accediendo a los datos
See Also:
com.hardcode.gdbms.engine.data.FieldNameAccess#getFieldIndexByName(java.lang.String)

getFieldValue

public Value getFieldValue(long rowIndex,
                           int fieldId)
                    throws DriverException
Description copied from interface: ReadAccess
Obtiene el valor que se encuentra en la fila y columna indicada

Parameters:
rowIndex - fila
fieldId - columna
Returns:
subclase de Value con el valor del origen de datos. Never null (use ValueFactory.createNullValue() instead)
Throws:
DriverException - Si se produce un error accediendo al DataSource
See Also:
ReadAccess.getFieldValue(long, int)

getRowCount

public long getRowCount()
                 throws DriverException
Description copied from interface: ReadAccess
Obtiene el número de registros del DataSource

Returns:
Throws:
DriverException - Si se produce algún error accediendo al DataSource
See Also:
ReadAccess.getRowCount()

getWhereFilter

public long[] getWhereFilter()
                      throws java.io.IOException
DOCUMENT ME!

Specified by:
getWhereFilter in interface DataSource
Overrides:
getWhereFilter in class OperationDataSource
Returns:
DOCUMENT ME!
Throws:
java.io.IOException
See Also:
DataSource.getWhereFilter()

getMemento

public Memento getMemento()
                   throws MementoException
Description copied from interface: DataSource
Gets a memento object with the current status of the DataSource

Specified by:
getMemento in interface DataSource
Overrides:
getMemento in class OperationDataSource
Returns:
DataSourceMemento
Throws:
MementoException - If the state cannot be obtained
See Also:
DataSource.getMemento()

getDataSourceMetadata

public Metadata getDataSourceMetadata()
                               throws DriverException
Description copied from interface: DataSource
Gets the meta data about the source of this DataSource

Returns:
DataSourceMetadata
Throws:
DriverException - If cannot get the DataSource metadata


Copyright © 2005-2006 . All Rights Reserved.