com.objectwave.persist.sqlConstruction
Class SqlModifierBuilder

java.lang.Object
  |
  +--com.objectwave.persist.sqlConstruction.SqlModifierBuilder

public class SqlModifierBuilder
extends java.lang.Object

Utility class to builder SQL statements that will modify database table entries.

Version:
$Id: SqlModifierBuilder.java,v 2.3 2001/11/02 16:07:56 dave_hoag Exp $
Author:
Dave Hoag

Nested Class Summary
static class SqlModifierBuilder.Test
           
 
Constructor Summary
SqlModifierBuilder()
           
 
Method Summary
protected  void buildAttributeModifierValues(SQLModifier sql, RDBPersistence pObj, Persistence p)
          Inserts and updates need to add the columns and the values of the columns to the sql object.
 void buildDeleteStatement(SQLDelete sql, RDBPersistence obj)
          Builds a delete sql object.
protected  void buildDeleteWhereClause(SQLDelete sql, RDBPersistence obj)
          Builds the where clause for a delete sql object.
protected  void buildForeignKeyModifierValues(SQLModifier sql, RDBPersistence pObj, Persistence p)
          Check all of the foreignKey fields in pObj for its update values.
 void buildInsertStatement(SQLInsert sql, RDBPersistence pObj, Persistence p)
          Create the SQLAssembler that will enable us to create an insert statement.
protected  void buildInstanceLinkModifierValues(SQLModifier sql, RDBPersistence pObj, Persistence p)
          Check all of the instance link references of pObj for its update values.
 void buildUpdateStatement(SQLUpdate sql, RDBPersistence pObj, Persistence p)
          Create a sql object that will be used to generate the sql statement.
protected  void buildUpdateWhereClause(SQLUpdate sql, RDBPersistence obj)
           
protected static void buildWhereClause(SQLObject sql, RDBPersistence obj)
          Builds the where clause for a sql object.
protected  java.lang.Object convertObjectReference(Persistence reference, RDBPersistence pObj, Persistence obj, java.lang.reflect.Field joinOn)
          Convert a "Persistence" object into the simple numeric value that is to go into the database.
 RDBBroker getBroker()
           
static SqlModifierBuilder getInstance(java.lang.String instanceType)
           
 void setBroker(RDBBroker newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlModifierBuilder

public SqlModifierBuilder()
Method Detail

getInstance

public static SqlModifierBuilder getInstance(java.lang.String instanceType)
Parameters:
instanceType -
Returns:
The Instance value

buildWhereClause

protected static void buildWhereClause(SQLObject sql,
                                       RDBPersistence obj)
Builds the where clause for a sql object. By default we use the primary key field to determine what to delete.

Parameters:
sql -
obj -

setBroker

public void setBroker(RDBBroker newValue)
Parameters:
newValue - com.objectwave.persist.RDBBroker

getBroker

public RDBBroker getBroker()
Returns:
com.objectwave.persist.RDBBroker

buildDeleteStatement

public void buildDeleteStatement(SQLDelete sql,
                                 RDBPersistence obj)
Builds a delete sql object.

Parameters:
obj - The object to delete.
sql - SQLDelete The instance that will be able to create the sql statement.

buildInsertStatement

public void buildInsertStatement(SQLInsert sql,
                                 RDBPersistence pObj,
                                 Persistence p)
Create the SQLAssembler that will enable us to create an insert statement.

Parameters:
sql -
pObj -
p -

buildUpdateStatement

public void buildUpdateStatement(SQLUpdate sql,
                                 RDBPersistence pObj,
                                 Persistence p)
Create a sql object that will be used to generate the sql statement.

Parameters:
sql -
pObj -
p -

buildAttributeModifierValues

protected void buildAttributeModifierValues(SQLModifier sql,
                                            RDBPersistence pObj,
                                            Persistence p)
Inserts and updates need to add the columns and the values of the columns to the sql object.

Parameters:
sql - The sql object that will ultimately generate the sql statement.
pObj - Object with which we are inserting/updating the database.
p -
See Also:
com.objectwave.persist.SQLUpdate, com.objectwave.persist.SQLInsert, com.objectwave.persist.SQLModifier

buildDeleteWhereClause

protected void buildDeleteWhereClause(SQLDelete sql,
                                      RDBPersistence obj)
Builds the where clause for a delete sql object. By default we use the primary key field to determine what to delete.

Parameters:
sql -
obj -

buildForeignKeyModifierValues

protected void buildForeignKeyModifierValues(SQLModifier sql,
                                             RDBPersistence pObj,
                                             Persistence p)
Check all of the foreignKey fields in pObj for its update values.

Parameters:
sql -
pObj -
p -

buildInstanceLinkModifierValues

protected void buildInstanceLinkModifierValues(SQLModifier sql,
                                               RDBPersistence pObj,
                                               Persistence p)
Check all of the instance link references of pObj for its update values. Only those instance links that have a database column will be added to this list.

Parameters:
sql -
pObj -
p -

buildUpdateWhereClause

protected void buildUpdateWhereClause(SQLUpdate sql,
                                      RDBPersistence obj)
Parameters:
sql -
obj -

convertObjectReference

protected java.lang.Object convertObjectReference(Persistence reference,
                                                  RDBPersistence pObj,
                                                  Persistence obj,
                                                  java.lang.reflect.Field joinOn)
Convert a "Persistence" object into the simple numeric value that is to go into the database.

Parameters:
reference -
pObj -
obj -
joinOn -
Returns: