deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.io.datastore.sql.transaction.insert
Class InsertRow

java.lang.Object
  extended by org.deegree.io.datastore.sql.transaction.insert.InsertRow
Direct Known Subclasses:
FeatureRow

public class InsertRow
extends java.lang.Object

Represents a table row (columns + values) which has to be inserted as part of an Insert operation.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Field Summary
protected  java.util.Map<java.lang.String,InsertField> columnMap
          Maps column names to their corresponding InsertField instance.
protected  java.lang.String table
          Database table
 
Constructor Summary
InsertRow(java.lang.String table)
          Creates a new InsertRow instance for the given table.
 
Method Summary
 InsertField getColumn(java.lang.String column)
          Returns the InsertField for the given column name.
 java.util.Collection<InsertField> getColumns()
          Returns all InsertFields.
static java.util.List<InsertRow> getInsertOrder(java.util.List<InsertRow> inserts)
          Sorts the given InsertRows topologically (respecting the foreign key constraints), so they can be inserted in the resulting order without causing foreign key violations.
 InsertField getPKColumn()
          Returns the InsertField for the primary key column.
(package private)  java.util.List<InsertField> getReferencedFields()
          Returns all InsertFields that are referenced by a field from this InsertRow.
 java.util.List<InsertField> getReferencingFields()
          Returns all InsertField that reference a column in this InsertRow.
(package private)  java.util.Collection<InsertRow> getReferencingRows()
          Returns all InsertRows that reference a column in this InsertRow.
 java.lang.String getTable()
          Returns the name of table.
 void linkColumn(java.lang.String column, InsertField referencedField)
          Sets the value to be inserted in the given table column - the column references the given InsertField and thus must have the same value as the referenced column.
 InsertField setColumn(java.lang.String column, java.lang.Object value, int sqlType, boolean isPK)
          Sets the value to be inserted in the given table column.
 InsertGeometryField setGeometryColumn(java.lang.String column, java.lang.Object value, int sqlType, boolean isPK, int internalSrsCode)
          Sets the value to be inserted in the given geometry column.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

table

protected java.lang.String table
Database table


columnMap

protected java.util.Map<java.lang.String,InsertField> columnMap
Maps column names to their corresponding InsertField instance.

Constructor Detail

InsertRow

public InsertRow(java.lang.String table)
Creates a new InsertRow instance for the given table.

Parameters:
table -
Method Detail

getTable

public java.lang.String getTable()
Returns the name of table.

Returns:
the name of table

setColumn

public InsertField setColumn(java.lang.String column,
                             java.lang.Object value,
                             int sqlType,
                             boolean isPK)
                      throws TransactionException
Sets the value to be inserted in the given table column.

In complex + erroneous mappings (or feature instances), it may happen that different property values (mapped to the same column) imply different values. This is checked for and in case an TransactionException is thrown.

Parameters:
column -
value -
sqlType -
isPK -
Returns:
column + value to be set
Throws:
TransactionException - if the value for the column clashes

setGeometryColumn

public InsertGeometryField setGeometryColumn(java.lang.String column,
                                             java.lang.Object value,
                                             int sqlType,
                                             boolean isPK,
                                             int internalSrsCode)
                                      throws TransactionException
Sets the value to be inserted in the given geometry column.

In complex + erroneous mappings (or feature instances), it may happen that different property values (mapped to the same column) imply different values. This is checked for and in case an TransactionException is thrown.

Parameters:
column -
value -
sqlType -
isPK -
internalSrsCode -
Returns:
column + value to be set
Throws:
TransactionException - if the value for the column clashes

linkColumn

public void linkColumn(java.lang.String column,
                       InsertField referencedField)
                throws TransactionException
Sets the value to be inserted in the given table column - the column references the given InsertField and thus must have the same value as the referenced column.

In complex + erroneous mappings (or feature instances), it may happen that different property values (mapped to the same column) imply different values. This is checked for and in case an TransactionException is thrown.

Parameters:
column -
referencedField -
Throws:
TransactionException - if the value for the column clashes

getColumns

public java.util.Collection<InsertField> getColumns()
Returns all InsertFields.

Returns:
all InsertFields

getColumn

public InsertField getColumn(java.lang.String column)
Returns the InsertField for the given column name.

Parameters:
column - requested column name
Returns:
the InsertField for the given column name, or null if it does not exist

getPKColumn

public InsertField getPKColumn()
Returns the InsertField for the primary key column.

Returns:
the InsertField for the primary key column

getReferencingFields

public java.util.List<InsertField> getReferencingFields()
Returns all InsertField that reference a column in this InsertRow. The fields may well be from other tables.

Returns:
all InsertFields that reference a column in this InsertRow

getReferencingRows

java.util.Collection<InsertRow> getReferencingRows()
Returns all InsertRows that reference a column in this InsertRow. The rows may well be from other tables.

Returns:
all InsertRows that reference a column in this InsertRow

getReferencedFields

java.util.List<InsertField> getReferencedFields()
Returns all InsertFields that are referenced by a field from this InsertRow. The fields may well be from other tables.

Returns:
all InsertField that are referenced by a field from this InsertRow

getInsertOrder

public static java.util.List<InsertRow> getInsertOrder(java.util.List<InsertRow> inserts)
Sorts the given InsertRows topologically (respecting the foreign key constraints), so they can be inserted in the resulting order without causing foreign key violations.

Number of precedessors (pre): number of fields that *are referenced by* this row Number of successors (post) : number of fields that *reference* this row

Parameters:
inserts - insert rows to sort
Returns:
the nodes of the graph in topological order if no cycle is present, else in arbitrary order

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org