com.scooterframework.orm.activerecord
Class IncludeNode

java.lang.Object
  extended by com.scooterframework.orm.activerecord.IncludeNode

public class IncludeNode
extends java.lang.Object

IncludeData holds details about an include option element.


Constructor Summary
IncludeNode(java.lang.String include, ActiveRecord controlHome, int order, IncludeNode previous, Relation relation, boolean useTableAlias, java.lang.String joinType)
          Constructs an IncludeNode instance.
 
Method Summary
 ActiveRecord getControlHome()
          Returns home intance of the control entity.
 java.lang.String getEndAMappingName()
           
 ActiveRecord getHomeInstance()
          Returns home instance.
 java.lang.String getIncludeName()
           
 java.lang.String getMappingName()
          Returns mapping name of the underlying table.
 int getOrder()
          Returns include order.
 Relation getRelation()
          Returns relation from endA entity to (this) entity.
static java.lang.StringBuilder getSqlSelectPart(java.lang.String tableMappingName, java.lang.String[] columnNames)
           
protected static java.lang.String getTableLinks(java.lang.String tableA, java.lang.String mappingAB, java.lang.String tableB)
           
 boolean hasNext()
          Checks if there is a next IncludeNode.
 boolean hasPrevious()
          Checks if there is a previous IncludeNode.
 IncludeNode next()
          Returns next IncludeNode.
 IncludeNode previous()
          Returns previous IncludeNode.
 void setNext(IncludeNode next)
          Sets next IncludeNode.
 void setTableAlias(java.lang.String tableAlias)
          Sets alias name of the underlying table.
 java.lang.StringBuilder toSqlJoinPart()
           
 java.lang.StringBuilder toSqlSelectPart()
          Returns a sql select part of an ActiveRecord class in the following format: tableName.columnName AS tableName_columnName, ...
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IncludeNode

public IncludeNode(java.lang.String include,
                   ActiveRecord controlHome,
                   int order,
                   IncludeNode previous,
                   Relation relation,
                   boolean useTableAlias,
                   java.lang.String joinType)
Constructs an IncludeNode instance.

Parameters:
include - name of the include node
controlHome - home instance of the main entity of the sql query
order - index of the include node starting from 1
previous - previous include node instance
relation - relation linking to this include node
useTableAlias - true if table alias is used
joinType - type of join
Method Detail

getIncludeName

public java.lang.String getIncludeName()

getControlHome

public ActiveRecord getControlHome()
Returns home intance of the control entity.

Returns:
home intance of the control entity

getOrder

public int getOrder()
Returns include order.

Returns:
include order

getRelation

public Relation getRelation()
Returns relation from endA entity to (this) entity.

Returns:
relation from endA entity to (this) entity

getHomeInstance

public ActiveRecord getHomeInstance()
Returns home instance.

Returns:
home instance

setTableAlias

public void setTableAlias(java.lang.String tableAlias)
Sets alias name of the underlying table.


hasPrevious

public boolean hasPrevious()
Checks if there is a previous IncludeNode.


previous

public IncludeNode previous()
Returns previous IncludeNode.


hasNext

public boolean hasNext()
Checks if there is a next IncludeNode.


next

public IncludeNode next()
Returns next IncludeNode.


setNext

public void setNext(IncludeNode next)
Sets next IncludeNode.


getMappingName

public java.lang.String getMappingName()
Returns mapping name of the underlying table.

Returns:
mapping name

toSqlSelectPart

public java.lang.StringBuilder toSqlSelectPart()
Returns a sql select part of an ActiveRecord class in the following format: tableName.columnName AS tableName_columnName, ... for all columns of this entity.

Returns:
part of select statement

getSqlSelectPart

public static java.lang.StringBuilder getSqlSelectPart(java.lang.String tableMappingName,
                                                       java.lang.String[] columnNames)

toSqlJoinPart

public java.lang.StringBuilder toSqlJoinPart()

getEndAMappingName

public java.lang.String getEndAMappingName()

getTableLinks

protected static java.lang.String getTableLinks(java.lang.String tableA,
                                                java.lang.String mappingAB,
                                                java.lang.String tableB)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object