deegree 2.3 (2010/04/09 10:10 build-4-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 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  Map<String,InsertField> columnMap
          Maps column names to their corresponding InsertField instance.
protected  String table
          Database table
 
Constructor Summary
InsertRow(String table)
          Creates a new InsertRow instance for the given table.
 
Method Summary
 InsertField getColumn(String column)
          Returns the InsertField for the given column name.
 Collection<InsertField> getColumns()
          Returns all InsertFields.
static List<InsertRow> getInsertOrder(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)  List<InsertField> getReferencedFields()
          Returns all InsertFields that are referenced by a field from this InsertRow.
 List<InsertField> getReferencingFields()
          Returns all InsertField that reference a column in this InsertRow.
(package private)  Collection<InsertRow> getReferencingRows()
          Returns all InsertRows that reference a column in this InsertRow.
 String getTable()
          Returns the name of table.
 void linkColumn(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(String column, Object value, int sqlType, boolean isPK)
          Sets the value to be inserted in the given table column.
 InsertGeometryField setGeometryColumn(String column, Object value, int sqlType, boolean isPK, int internalSrsCode)
          Sets the value to be inserted in the given geometry column.
 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 String table
Database table


columnMap

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

Constructor Detail

InsertRow

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

Parameters:
table -
Method Detail

getTable

public String getTable()
Returns the name of table.

Returns:
the name of table

setColumn

public InsertField setColumn(String column,
                             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(String column,
                                             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(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 Collection<InsertField> getColumns()
Returns all InsertFields.

Returns:
all InsertFields

getColumn

public InsertField getColumn(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 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

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

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 List<InsertRow> getInsertOrder(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 String toString()
Returns a string representation of the object.

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

deegree 2.3 (2010/04/09 10:10 build-4-official)

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