org.deegree_impl.services.wfs
Class RowSelector

java.lang.Object
  extended byorg.deegree_impl.services.wfs.RowSelector
Direct Known Subclasses:
PointRowSelector, PostgisRowSelector

public class RowSelector
extends java.lang.Object

Encapsulates selected rows of a table that are identified by a table, a Set of key values, and a keyfield. Used in the processing of WFSDelete-requests.

Due to the use of PreparedStatements this class should be generic, but for Geometry-fields, the updateRows()-method has to be overwritten in a specific class.

Version:
$Revision: 1.6 $ $Date: 2004/03/07 09:32:49 $
Author:
Field Summary
protected  java.sql.Connection con
           
protected  FeatureType ft
           
protected  java.lang.String keyfield
           
protected  java.util.Set keys
           
protected  DBAccess osa
           
protected  TableDescription table
           
protected  int type
           
 
Constructor Summary
RowSelector(TableDescription table, java.lang.String keyfield, java.util.Set keys, DBAccess osa, FeatureType ft)
          Creates a new instance of RowSelector
 
Method Summary
 void deleteRows()
          Deletes the selected rows from the table.
 RowSelector[] getReferencedRows()
          Creates new RowSelector-objects that represent the rows in other tables that are referenced from the current table's rows.
 java.lang.String getTableName()
          Returns the associated table name.
protected  void setFieldValue(java.sql.PreparedStatement stmt, int i, int type, java.lang.String value, java.lang.String field)
          Convenience method that calls the right setXXX ()-method for the given PreparedStatment.
 java.lang.String toString()
          Produces a String representation of this object.
 void updateRows(java.util.ArrayList changeList)
          Updates the selected rows of the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

table

protected TableDescription table

keys

protected java.util.Set keys

keyfield

protected java.lang.String keyfield

type

protected int type

osa

protected DBAccess osa

ft

protected FeatureType ft

con

protected java.sql.Connection con
Constructor Detail

RowSelector

public RowSelector(TableDescription table,
                   java.lang.String keyfield,
                   java.util.Set keys,
                   DBAccess osa,
                   FeatureType ft)
            throws java.sql.SQLException
Creates a new instance of RowSelector

Method Detail

getTableName

public java.lang.String getTableName()
Returns the associated table name.

Returns:
the name of the table

getReferencedRows

public RowSelector[] getReferencedRows()
                                throws java.sql.SQLException
Creates new RowSelector-objects that represent the rows in other tables that are referenced from the current table's rows.

Returns:
the referenced rows represented by new RowSelectors
Throws:
java.sql.SQLException

deleteRows

public void deleteRows()
                throws java.sql.SQLException
Deletes the selected rows from the table.

Throws:
java.sql.SQLException

updateRows

public void updateRows(java.util.ArrayList changeList)
                throws java.sql.SQLException
Updates the selected rows of the table. The changes to be performed are given as an ArrayList of String-Arrays s [] of the following form:
  • s [0]: fieldName (name of the field of the table)
  • s [1]: new value for the field

Parameters:
changeList - list of changes to be performed
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Produces a String representation of this object.

Returns:
the textual representation

setFieldValue

protected void setFieldValue(java.sql.PreparedStatement stmt,
                             int i,
                             int type,
                             java.lang.String value,
                             java.lang.String field)
                      throws java.sql.SQLException
Convenience method that calls the right setXXX ()-method for the given PreparedStatment.

Parameters:
stmt - the PreparedStatement to be "filled"
i - index of the field to be set
type - java.sql.Types-constant for the field type
value - new String value for the field
Throws:
java.sql.SQLException - if the conversion of the String failed (for example in the case of Integers or Dates)