com.semarchy.mdm.runtime.model.dataaccess
Class JoinClause

java.lang.Object
  extended by com.semarchy.mdm.runtime.model.dataaccess.JoinClause

public class JoinClause
extends Object

Represent a SQL join hierarchy

Author:
skamel

Constructor Summary
JoinClause(boolean pSubQueryClause, String pJoinCondition, JoinType pJoinType)
          Creates a join clause object
JoinClause(String pTableName, String pTableAlias, String pJoinCondition, JoinType pJoinType)
          Creates a join clause object
 
Method Summary
 void addJoinClause(JoinClause pJoinClause)
          adds a join clause to this join clause
 List<JoinClause> getJoinClauses()
           
 String getJoinCondition()
           
 JoinType getJoinType()
           
 String getSubQuerySQL()
           
 String getTableAlias()
           
 String getTableName()
           
 boolean isSubQueryClause()
           
 void setSubQuerySQL(String pSubQuerySQL)
          Sets the sub query Select statement clause.
 void setTableAlias(String pTableAlias)
          Sets the table alias
 void setTableName(String pTableName)
          Set the table name of this from clause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoinClause

public JoinClause(String pTableName,
                  String pTableAlias,
                  String pJoinCondition,
                  JoinType pJoinType)
Creates a join clause object

Parameters:
pTableName - joined table
pTableAlias - joined alias in the join condition
pJoinCondition - join condition SQL
pJoinType - type of join

JoinClause

public JoinClause(boolean pSubQueryClause,
                  String pJoinCondition,
                  JoinType pJoinType)
Creates a join clause object

Parameters:
pSubQueryClause - indicates whether this join clause is based on a sub-query or not
pJoinCondition - join condition SQL
pJoinType - type of join
Method Detail

getTableAlias

public String getTableAlias()
Returns:
the alias used to identiy this join table in the join condition

getTableName

public String getTableName()
Returns:
the table name to join to

getJoinCondition

public String getJoinCondition()
Returns:
the SQL condition for the join clause

getJoinType

public JoinType getJoinType()
Returns:
the join type

getJoinClauses

public List<JoinClause> getJoinClauses()
Returns:
the non-null list of join clauses. Can be empty if join clause does not join to any other table

addJoinClause

public void addJoinClause(JoinClause pJoinClause)
adds a join clause to this join clause

Parameters:
pJoinClause -

isSubQueryClause

public boolean isSubQueryClause()
Returns:
whether this join clause is based on a sub-query rather than on a table

getSubQuerySQL

public String getSubQuerySQL()
Returns:
the sub-query SQL or null if the join clause is not sub-query based (use isSubQueryClause() to figure out)

setSubQuerySQL

public void setSubQuerySQL(String pSubQuerySQL)
Sets the sub query Select statement clause.

Parameters:
pSubQuerySQL - select statement to set
Throws:
RuntimeException - a runtime exception if the join clause was not built with isSubQueryClause() set to true

setTableName

public void setTableName(String pTableName)
Set the table name of this from clause

Parameters:
pTableName - table name to set
Throws:
RuntimeException - a runtime exception if the join clause was not built with isSubQueryClause() set to false

setTableAlias

public void setTableAlias(String pTableAlias)
Sets the table alias

Parameters:
pTableAlias - table alias to use for the sub-query or table in this join clause


Copyright © 2015. All Rights Reserved.