Transfer version 1.1

transfer.com.sql
Class TransferInserter

WEB-INF.cftags.component
        extended by transfer.com.sql.AbstractBaseTransfer
            extended by transfer.com.sql.TransferInserter
Direct Known Subclasses:
TransferInserter , TransferInserter , TransferInserter , TransferInserter

public class TransferInserter
extends AbstractBaseTransfer

Inserts a transfer's details into the DB


Constructor Summary
init(Datasource datasource, ObjectManager objectManager, XMLFileReader xmlFileReader, Utility utility, Nullable nullable, QueryExecutionPool queryExecutionPool, QueryCache queryCache, Transaction transaction)
          Constructor
 
Method Summary
private Query buildInsertBasicQuery(TransferObject transfer, boolean primaryKeyHasValue, string generateKey, boolean populatePrimaryKey)
          builds a basic query
 Query buildInsertManyToMany(Object object, ManyToMany manytomany)
          builds tehe query for inserting a many to many
private any buildSQLBeforeInsert(Object object)
          Overwrite to run SQL directly before the insert query (no generation). Should select a 'id' column for id population
private void buildSqlInsideInsert(Query query, Object object)
          Overwrite method to run SQL inside the insert query (with no generation), and before the end of the cfquery block. Should select a 'id' column for id population
private any buildsqlAfterInsert(Object object)
          Overwrite to run SQL directly after the insert query (no generation). Should select a 'id' column for id population
 void create(TransferObject transfer, boolean useTransaction)
          Inserts the transfer into the DB
private string createColumnList(Object object, boolean primaryKeyHasValue, string generateKey)
          Creates the column list to insert
private any executeBasicInsert(TransferObject transfer, Query query, boolean primaryKeyHasValue, string generateKey, boolean populatePrimaryKey)
          executes the basic insert
private IDGenerator getIDGenerator()
private Nullable getNullable()
private void insertBasic(TransferObject transfer)
          Insert the single table part of the query. populates the transfer with it's primary key
private void insertBlock(TransferObject transfer)
          run the insert
private void insertManyToMany(TransferObject transfer)
          Updates the many to many portion of the transfer
private void invokeSetPrimaryKey(TransferObject transfer, string primarykeyvalue)
          Invokes the setPrimaryKey method on the transfer object
private boolean primaryKeyHasValue(TransferObject transfer)
          Checks to see if the object's primary key has a value other than default
private void setGeneratedPrimaryKey(TransferObject transfer)
          sets the TransferObject's primary key value with one generated by Transfer
private void setIDGenerator(IDGenerator IDGenerator)
private void setNullable(Nullable Nullable)
 
Methods inherited from class transfer.com.sql.AbstractBaseTransfer
andSeperator, commaSeperator, equalsString, getDatasource, getMethodInvoker, getObjectManager, getQueryCache, getQueryExecutionPool, getTransaction, invokeGetPrimaryKey, isString, mapCompositeKey, mapPrimaryKey, mapSingularKey, nullString, setCompositeKey, setDatasource, setMethodInvoker, setObjectManager, setPrimaryKey, setQueryCache, setQueryExecutionPool, setSingularKey, setTransaction, throw
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(Datasource datasource, ObjectManager objectManager, XMLFileReader xmlFileReader, Utility utility, Nullable nullable, QueryExecutionPool queryExecutionPool, QueryCache queryCache, Transaction transaction)
Constructor

Parameters:
datasource - The datasource BO
objectManager - Need to object manager for making queries
xmlFileReader - The file path to the config file
utility - The utility class
nullable - The nullable class
queryExecutionPool - the query execution pool
queryCache - the query object cache
transaction
Method Detail

buildInsertBasicQuery

private Query buildInsertBasicQuery(TransferObject transfer, boolean primaryKeyHasValue, string generateKey, boolean populatePrimaryKey)
builds a basic query

Parameters:
transfer - The transfer object to insert
primaryKeyHasValue - whether the primary key already has a value
generateKey - whether or not to generate a key
populatePrimaryKey - whether or not to populate the primary key with a value

buildInsertManyToMany

public Query buildInsertManyToMany(Object object, ManyToMany manytomany)
builds tehe query for inserting a many to many

Parameters:
object - the object that the insert is for
manytomany - the many to many that is being inserted

buildSQLBeforeInsert

private any buildSQLBeforeInsert(Object object)
Overwrite to run SQL directly before the insert query (no generation). Should select a 'id' column for id population

Parameters:
object - The object that is being inserted

buildSqlInsideInsert

private void buildSqlInsideInsert(Query query, Object object)
Overwrite method to run SQL inside the insert query (with no generation), and before the end of the cfquery block. Should select a 'id' column for id population

Parameters:
query - the query object
object - The oject that is being inserted

buildsqlAfterInsert

private any buildsqlAfterInsert(Object object)
Overwrite to run SQL directly after the insert query (no generation). Should select a 'id' column for id population

Parameters:
object - The oject that is being inserted

create

public void create(TransferObject transfer, boolean useTransaction)
Inserts the transfer into the DB

Parameters:
transfer - The transfer object to insert
useTransaction - Whether or not to use an internal transaction block

createColumnList

private string createColumnList(Object object, boolean primaryKeyHasValue, string generateKey)
Creates the column list to insert

Parameters:
object - The oject that is being inserted
primaryKeyHasValue - Pass through if the primary key has value already
generateKey - whether or not to generate a key

executeBasicInsert

private any executeBasicInsert(TransferObject transfer, Query query, boolean primaryKeyHasValue, string generateKey, boolean populatePrimaryKey)
executes the basic insert

Parameters:
transfer - The transfer object to insert
query - The query to execute
primaryKeyHasValue - whether the primary key already has a value
generateKey - whether or not to generate a key
populatePrimaryKey - whether or not to populate the primary key with a value

getIDGenerator

private IDGenerator getIDGenerator()


getNullable

private Nullable getNullable()


insertBasic

private void insertBasic(TransferObject transfer)
Insert the single table part of the query. populates the transfer with it's primary key

Parameters:
transfer - The transfer object to insert

insertBlock

private void insertBlock(TransferObject transfer)
run the insert

Parameters:
transfer - The transfer object to insert

insertManyToMany

private void insertManyToMany(TransferObject transfer)
Updates the many to many portion of the transfer

Parameters:
transfer - The transferObject to update

invokeSetPrimaryKey

private void invokeSetPrimaryKey(TransferObject transfer, string primarykeyvalue)
Invokes the setPrimaryKey method on the transfer object

Parameters:
transfer - The transfer object to insert
primarykeyvalue - The primary key value

primaryKeyHasValue

private boolean primaryKeyHasValue(TransferObject transfer)
Checks to see if the object's primary key has a value other than default

Parameters:
transfer - The transfer object

setGeneratedPrimaryKey

private void setGeneratedPrimaryKey(TransferObject transfer)
sets the TransferObject's primary key value with one generated by Transfer

Parameters:
transfer - The transfer object to insert

setIDGenerator

private void setIDGenerator(IDGenerator IDGenerator)

Parameters:
IDGenerator

setNullable

private void setNullable(Nullable Nullable)

Parameters:
Nullable

Transfer version 1.1