Transfer version 1.1

transfer.com.tql.walkers
Class Join

WEB-INF.cftags.component
        extended by transfer.com.tql.walkers.AbstractBaseWalker
            extended by transfer.com.tql.walkers.Join

public class Join
extends AbstractBaseWalker

Walks the join expresion


Method Summary
private void buildManyToManyInterimJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, ManyToMany manytomany, boolean innerJoin, string outerJoinType, [boolean resolveFromTo='true'])
          Builds the from SQL for the intermim Many to Many table
private void buildManyToManyJoinSQL(Object objectFrom, string aliasFrom, any buffer, ManyToMany manytomany, [boolean resolveFromTo='true'])
          Builds the from SQL for the Many to Many join
private void buildManyToOneJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, ManyToOne manytoone, [boolean resolveFromTo='true'])
          Builds the from SQL for a Many To One
private void buildOneToManyJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, OneToMany oneToMany, [boolean resolveFromTo='true'])
          Builds the from SQL for a One to Many
private struct buildRelationShipCollection(Object objectFrom, Object objectTo)
          Buids the array of relationships that are possible between these two objects
private array evaluateAutoJoin(Object object, string alias, array evaluation, any buffer, any pastClassIdentifierNodes)
          evaluates auto joining for a particlar node
private array evaluateIdentifierJoinAST(any tree, struct aliasMap, array evaluation, any buffer, boolean aliasColumns, boolean distinctMode)
          walks the tree, and makes a array of structs that represent the Identifier join SQL and the mapped values
private void evaluateInterimAutoJoin(Object object, string alias, any buffer, any pastClassIdentifierNodes, boolean innerJoin, string outerJoinType)
          evaluates any joining that must be done before joining the actual Object table
private struct evaluateInterimCompositeJoin(any tree, Object object, string alias, struct aliasMap, any buffer, any pastClassIdentifierNodes, boolean innerJoin, string outerJoinType)
          evaluate a on composite join
 array evaluateJoinAST(any tree, struct aliasMap, array evaluation, any buffer, any pastClassIdentifierNodes, boolean aliasColumns, boolean distinctMode)
          evaluates a join AST
private struct evaluateOnCompositeJoin(any tree, Object object, string alias, struct aliasMap, any buffer, any pastClassIdentifierNodes)
          evaluate a on composite join
private struct getJoinState(any tree, [string context='auto'], [Object object], [string alias=''], [boolean innerJoin='true'], [string outerJoinType='left'], [any classIdentifierNode])
          returns a struct with 3 values in it state : [auto|composite|identifier], the object, and the alias (bad cohesian, good performance)
private string resolveAlias(string alias, string originalValue)
          if the alias is an empty string, returns the orignal value
private boolean resolveAutoJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, struct relationships, [boolean on='true'])
          resolves the joins found in the relationship collection
private void resolveCompositeInterimJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, boolean innerJoin, string outerJoinType, [string objectFromCompositeName], [string objectToCompositeName])
          resolves the intermin joins found in the relationship collection
private void resolveCompositeJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, [string objectFromCompositeName], [string objectToCompositeName])
          resolves the joins found in the relationship collection
private void resolveManyToManyInterimAutoJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, boolean innerJoin, string outerJoinType)
          Builds the from Auto join SQL for the intermim Many to Many table
private string searchPastIdentifierNodesForAlias(any pastClassIdentifierNodes, string className)
          Travels back up to past nodes, to see if an alias exists. If one doesn't, then return "
 
Methods inherited from class transfer.com.tql.walkers.AbstractBaseWalker
getJoin, getObject, getObjectManager, getProperty, getSelectStatement, getTQLParser, init, setJoin, setObject, setObjectManager, setProperty, setSelectStatement, setTQLParser, throw
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(TQLParser tqlParser, ObjectManager objectManager, [Property property], [Object object], [Join join], [SelectStatement selectStatement])
Constructor

Parameters:
tqlParser - The tqlParser to generate the AST for the TQL
objectManager - The object manager to query
property - property walker
object - Object walker
join - join walker
selectStatement - Select statement for sub selects
Method Detail

buildManyToManyInterimJoinSQL

private void buildManyToManyInterimJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, ManyToMany manytomany, boolean innerJoin, string outerJoinType, [boolean resolveFromTo='true'])
Builds the from SQL for the intermim Many to Many table

Parameters:
objectFrom - The object to go from
aliasFrom - The from alias
objectTo - The object to go to
aliasTo - The to alias
buffer - java.lang.StringBuffer for preSQL building
manytomany - The one to many connector
innerJoin - if the join is an inner join
outerJoinType - if the join is an inner join
resolveFromTo - whether to resolve From -> To, or To -> From

buildManyToManyJoinSQL

private void buildManyToManyJoinSQL(Object objectFrom, string aliasFrom, any buffer, ManyToMany manytomany, [boolean resolveFromTo='true'])
Builds the from SQL for the Many to Many join

Parameters:
objectFrom - The object to go from
aliasFrom - The from alias
buffer - java.lang.StringBuffer for preSQL building
manytomany - The one to many connector
resolveFromTo - whether to resolve From -> To, or To -> From

buildManyToOneJoinSQL

private void buildManyToOneJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, ManyToOne manytoone, [boolean resolveFromTo='true'])
Builds the from SQL for a Many To One

Parameters:
objectFrom - The object to go from
aliasFrom - The fro alias
objectTo - The object to go to
aliasTo - The fro alias
buffer - java.lang.StringBuffer for preSQL building
manytoone - The one to many connector
resolveFromTo - whether to resolve From -> To, or To -> From

buildOneToManyJoinSQL

private void buildOneToManyJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, OneToMany oneToMany, [boolean resolveFromTo='true'])
Builds the from SQL for a One to Many

Parameters:
objectFrom - The object to go from
aliasFrom - The fro alias
objectTo - The object to go to
aliasTo - The fro alias
buffer - java.lang.StringBuffer for preSQL building
oneToMany - The one to many connector
resolveFromTo - whether to resolve From -> To, or To -> From

buildRelationShipCollection

private struct buildRelationShipCollection(Object objectFrom, Object objectTo)
Buids the array of relationships that are possible between these two objects

Parameters:
objectFrom - The object to go from
objectTo - The object to go to

evaluateAutoJoin

private array evaluateAutoJoin(Object object, string alias, array evaluation, any buffer, any pastClassIdentifierNodes)
evaluates auto joining for a particlar node

Parameters:
object - The object to
alias - The alias
evaluation - The array of evaluated values
buffer - java.lang.StringBuffer for preSQL building
pastClassIdentifierNodes - keeps track of all previous class identifiers

evaluateIdentifierJoinAST

private array evaluateIdentifierJoinAST(any tree, struct aliasMap, array evaluation, any buffer, boolean aliasColumns, boolean distinctMode)
walks the tree, and makes a array of structs that represent the Identifier join SQL and the mapped values

Parameters:
tree - The tree node to walk
aliasMap - The from map
evaluation - The array of evaluated values
buffer - java.lang.StringBuffer for preSQL building
aliasColumns - to alias columns or not
distinctMode - If to make the select distinct or not

evaluateInterimAutoJoin

private void evaluateInterimAutoJoin(Object object, string alias, any buffer, any pastClassIdentifierNodes, boolean innerJoin, string outerJoinType)
evaluates any joining that must be done before joining the actual Object table

Parameters:
object - The object to
alias - The alias
buffer - java.lang.StringBuffer for preSQL building
pastClassIdentifierNodes - keeps track of all previous class identifiers
innerJoin - if the join is an inner join
outerJoinType - if the join is an inner join

evaluateInterimCompositeJoin

private struct evaluateInterimCompositeJoin(any tree, Object object, string alias, struct aliasMap, any buffer, any pastClassIdentifierNodes, boolean innerJoin, string outerJoinType)
evaluate a on composite join

Parameters:
tree - The tree node to walk
object - The object to
alias - The alias
aliasMap - The from map
buffer - java.lang.StringBuffer for preSQL building
pastClassIdentifierNodes - keeps track of all previous class identifiers
innerJoin - if the join is an inner join
outerJoinType - if the join is an inner join

evaluateJoinAST

public array evaluateJoinAST(any tree, struct aliasMap, array evaluation, any buffer, any pastClassIdentifierNodes, boolean aliasColumns, boolean distinctMode)
evaluates a join AST

Parameters:
tree - The tree node to walk
aliasMap - The from map
evaluation - The array of evaluated values
buffer - java.lang.StringBuffer for preSQL building
pastClassIdentifierNodes - keeps track of all previous class identifiers
aliasColumns - to alias columns or not
distinctMode - If to make the select distinct or not

evaluateOnCompositeJoin

private struct evaluateOnCompositeJoin(any tree, Object object, string alias, struct aliasMap, any buffer, any pastClassIdentifierNodes)
evaluate a on composite join

Parameters:
tree - The tree node to walk
object - The object to
alias - The alias
aliasMap - The from map
buffer - java.lang.StringBuffer for preSQL building
pastClassIdentifierNodes - keeps track of all previous class identifiers

getJoinState

private struct getJoinState(any tree, [string context='auto'], [Object object], [string alias=''], [boolean innerJoin='true'], [string outerJoinType='left'], [any classIdentifierNode])
returns a struct with 3 values in it state : [auto|composite|identifier], the object, and the alias (bad cohesian, good performance)

Parameters:
tree - The tree node to walk
context - The join context
object - The object for the join
alias - The alias for the object
innerJoin - if an inner join
outerJoinType - The outer join type, if it exists
classIdentifierNode - The class identifier node to append

resolveAlias

private string resolveAlias(string alias, string originalValue)
if the alias is an empty string, returns the orignal value

Parameters:
alias - The alias that is being used
originalValue - The original value

resolveAutoJoinSQL

private boolean resolveAutoJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, struct relationships, [boolean on='true'])
resolves the joins found in the relationship collection

Parameters:
objectFrom - The object to go from
aliasFrom - The fro alias
objectTo - The object to go to
aliasTo - The fro alias
buffer - java.lang.StringBuffer for preSQL building
relationships - The relationship collection
on - if it's an on statement, or a and statement

resolveCompositeInterimJoinSQL

private void resolveCompositeInterimJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, boolean innerJoin, string outerJoinType, [string objectFromCompositeName], [string objectToCompositeName])
resolves the intermin joins found in the relationship collection

Parameters:
objectFrom - The object to go from
aliasFrom - The fro alias
objectTo - The object to go to
aliasTo - The fro alias
buffer - java.lang.StringBuffer for preSQL building
innerJoin - if the join is an inner join
outerJoinType - if the join is an inner join
objectFromCompositeName - The object composite name for the from object
objectToCompositeName - The object composite name for the to object

resolveCompositeJoinSQL

private void resolveCompositeJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, [string objectFromCompositeName], [string objectToCompositeName])
resolves the joins found in the relationship collection

Parameters:
objectFrom - The object to go from
aliasFrom - The fro alias
objectTo - The object to go to
aliasTo - The fro alias
buffer - java.lang.StringBuffer for preSQL building
objectFromCompositeName - The object composite name for the from object
objectToCompositeName - The object composite name for the to object

resolveManyToManyInterimAutoJoinSQL

private void resolveManyToManyInterimAutoJoinSQL(Object objectFrom, string aliasFrom, Object objectTo, string aliasTo, any buffer, boolean innerJoin, string outerJoinType)
Builds the from Auto join SQL for the intermim Many to Many table

Parameters:
objectFrom - The object to go from
aliasFrom - The from alias
objectTo - The object to go to
aliasTo - The to alias
buffer - java.lang.StringBuffer for preSQL building
innerJoin - if the join is an inner join
outerJoinType - if the join is an inner join

searchPastIdentifierNodesForAlias

private string searchPastIdentifierNodesForAlias(any pastClassIdentifierNodes, string className)
Travels back up to past nodes, to see if an alias exists. If one doesn't, then return "

Parameters:
pastClassIdentifierNodes - keeps track of all previous class identifiers
className - The name of the object class to look for

Transfer version 1.1