deegree 2.2 (2008/12/22 11:33 build-3038-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: 9342 $, $Date: 2007-12-27 13:32:57 +0100 (Do, 27 Dez 2007) $
Author:
Markus Schneider, last edited by: $Author: apoth $

Field Summary
protected  Map<String,InsertField> columnMap
           
(package private) static ILogger LOG
           
protected  String table
           
 
Constructor Summary
InsertRow(String table)
          Creates a new InsertRow instance for the given table.
 
Method Summary
static Collection<InsertRow> findCycle(Collection<InsertRow> rows)
          Checks if the given InsertRows contain cyclic fk constraints.
 InsertField getColumn(String column)
          Returns the InsertField for the given column name.
 Collection<InsertField> getColumns()
          Returns all InsertFields.
 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.
static List<InsertRow> sortInsertRows(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.
 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

LOG

static final ILogger LOG

table

protected String table

columnMap

protected Map<String,InsertField> columnMap
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

sortInsertRows

public static List<InsertRow> sortInsertRows(List<InsertRow> inserts)
                                      throws TransactionException
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 given insert rows in topological order
Throws:
TransactionException - if there is no topological order (i.e. there is a cyclic constraint)

findCycle

public static Collection<InsertRow> findCycle(Collection<InsertRow> rows)
Checks if the given InsertRows contain cyclic fk constraints.

Parameters:
rows -
Returns:
steps of the cycle, or null if there is none

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.2 (2008/12/22 11:33 build-3038-official)

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