wt.query
Class CompositeWhereExpression

java.lang.Object
  extended bywt.query.CompositeWhereExpression
All Implemented Interfaces:
Externalizable, Serializable, WhereExpression

public class CompositeWhereExpression
extends Object
implements WhereExpression, Externalizable

This class represents a number of WHERE expressions connected using a logical operator (i.e. AND/OR).

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private  boolean advancedQueryEnabled
           
private static String CLASSNAME
           
private  Vector components
           
static boolean DEBUG
           
private  Vector expressions
           
static long EXTERNALIZATION_VERSION_UID
           
private static DebugWriter LOG
           
protected static long OLD_FORMAT_VERSION_UID
           
private  LogicalOperator operator
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
 
Fields inherited from interface wt.query.WhereExpression
ADVANCED_QUERY, ADVANCED_QUERY_ENABLED, BIND_PARAMETER, CORRELATED_CLASS_ATTRIBUTES, FROM_COUNT, FROM_INDICIES
 
Constructor Summary
CompositeWhereExpression()
          

Supported API: false
CompositeWhereExpression(LogicalOperator a_logicalOperator)
          Constructs a CompositeWhereExpression.
 
Method Summary
 void append(WhereExpression a_whereExpression)
          Appends the specified expression.
 void append(WhereExpression a_whereExpression, int[] a_fromIndicies)
          Appends the specified expression.
 void clear()
           
 Object getBindParameter()
          Gets the value of the attribute: bindParameter; Returns a bind parameter for this expression (if supported).
 Object getBindParameterFrom(Vector a_singleBindParameter)
          

Supported API: false
 List getClassAttributes()
          

Supported API: false
 WhereExpression getComponentAt(int a_index)
           
 int getComponentCount()
           
protected  Vector getComponents()
           
 List getCorrelatedClassAttributes()
          Gets the value of the attribute: correlatedClassAttributes.
 String getExpression(boolean a_useBind, Vector a_tableInfos, Vector a_aliases)
          Return string representation of this expression.
 Vector getExpressions()
          Gets the object for the association that plays role: expressions.
 int getFromCount()
          Gets the value of the attribute: fromCount; Number of FromClause TableExpressions/Aliases that this expression requires.
 int[] getFromIndicies()
          Gets the value of the attribute: fromIndicies; Indicies for all current expressions relative to a FromClause that will be used for validating and setting aliases when this compostie expression is appended to a statement.
 WhereExpression getJoinConditions(JoinIndex a_joinIndex)
          This method is to return the join search condition.
 WhereExpression getJoinConditions(Set a_joinIndexSet)
          This method is to return the join search condition.
 WhereExpression getJoinConditions(String a_alias)
          This method is to return the join search condition.
 WhereExpression getJoinConditions(String a_alias, boolean a_removed)
          This method is to return the join search condition.
 WhereExpression getJoinConditions(String a_alias, int a_outerNonJoinFromIndex, boolean a_removed)
          This method is to return the join search condition.
 Set getJoinIndex()
          

Supported API: false
 LogicalOperator getOperator()
          Gets the object for the association that plays role: operator.
 void handleCorrelatedAttributes(Vector a_tableInfos, Vector a_aliases)
          

Supported API: false
 boolean isAdvancedQuery()
          Gets the value of the attribute: advancedQuery; Indicates if the expression uses advanced query capabilities.
 boolean isAdvancedQueryEnabled()
          Gets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.
 boolean isAllJoinConditions(JoinIndex a_joinIndex)
          

Supported API: false
 boolean isAllJoinConditions(Set a_joinIndexSet)
          

Supported API: false
 boolean isAllJoinConditions(String a_alias)
          

Supported API: false
 boolean isAllJoinConditions(String a_alias, boolean a_removed)
          

Supported API: false
 boolean isAllOuterNonJoinConditions()
          

Supported API: false
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(CompositeWhereExpression thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void removeComponentAt(int a_index)
           
 void setAdvancedQueryEnabled(boolean a_AdvancedQueryEnabled)
          Sets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.
 int setAliases(String[] a_aliases, int a_offset)
          This method sets the aliases for components of the expression.
 void setAliases(Vector a_aliases)
           
static void setAliases(WhereExpression a_where, Vector a_aliases)
           
 int setBindParameterIndicies(int a_offset)
          

Supported API: false
 int setFromIndicies(int[] a_fromIndicies, int a_offset)
          This method sets the From clause indicies for components of the expression.
 void setOperator(LogicalOperator a_Operator)
          Sets the object for the association that plays role: operator.
 String toString()
           
 int validate(TableExpression[] a_fromTables, int a_offset)
          This method validates the expression against the FROM clause.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

expressions

private Vector expressions

operator

private LogicalOperator operator

advancedQueryEnabled

private transient boolean advancedQueryEnabled

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

components

private transient Vector components

DEBUG

public static final boolean DEBUG

LOG

private static final DebugWriter LOG
Constructor Detail

CompositeWhereExpression

public CompositeWhereExpression()


Supported API: false


CompositeWhereExpression

public CompositeWhereExpression(LogicalOperator a_logicalOperator)
Constructs a CompositeWhereExpression.

Supported API: true

Parameters:
a_logicalOperator - Logical operator used to connect expressions
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(CompositeWhereExpression thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getExpressions

public Vector getExpressions()
Gets the object for the association that plays role: expressions.

Supported API: false

Returns:
Vector

getOperator

public LogicalOperator getOperator()
Gets the object for the association that plays role: operator.

Supported API: false

Returns:
LogicalOperator

setOperator

public void setOperator(LogicalOperator a_Operator)
Sets the object for the association that plays role: operator.

Supported API: false

Parameters:
a_Operator -

append

public void append(WhereExpression a_whereExpression,
                   int[] a_fromIndicies)
Appends the specified expression. The specified FROM indicies are applied to the specified WhereExpression.

Supported API: true

Parameters:
a_whereExpression - WhereExpression instance to append
a_fromIndicies - Indicies relative to a FromClause that will be used for validating and setting aliases when this expression is appended to a statement

append

public void append(WhereExpression a_whereExpression)
Appends the specified expression. The FROM indicies of the specified WhereExpression are applied to that WhereExpressionf.

Supported API: true

Parameters:
a_whereExpression - WhereExpression instance to append

getBindParameter

public Object getBindParameter()
                        throws WTException
Gets the value of the attribute: bindParameter; Returns a bind parameter for this expression (if supported).

Supported API: false

Specified by:
getBindParameter in interface WhereExpression
Returns:
Object
Throws:
WTException

getFromCount

public int getFromCount()
Gets the value of the attribute: fromCount; Number of FromClause TableExpressions/Aliases that this expression requires.

Supported API: false

Specified by:
getFromCount in interface WhereExpression
Returns:
int

getFromIndicies

public int[] getFromIndicies()
Gets the value of the attribute: fromIndicies; Indicies for all current expressions relative to a FromClause that will be used for validating and setting aliases when this compostie expression is appended to a statement.

Supported API: true

Specified by:
getFromIndicies in interface WhereExpression
Returns:
int[]

isAdvancedQuery

public boolean isAdvancedQuery()
                        throws WTException
Gets the value of the attribute: advancedQuery; Indicates if the expression uses advanced query capabilities.

Supported API: false

Specified by:
isAdvancedQuery in interface WhereExpression
Returns:
boolean
Throws:
WTException

getCorrelatedClassAttributes

public List getCorrelatedClassAttributes()
Gets the value of the attribute: correlatedClassAttributes.

Supported API: false

Specified by:
getCorrelatedClassAttributes in interface WhereExpression
Returns:
List

isAdvancedQueryEnabled

public boolean isAdvancedQueryEnabled()
Gets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.

Supported API: false

Specified by:
isAdvancedQueryEnabled in interface WhereExpression
Returns:
boolean

setAdvancedQueryEnabled

public void setAdvancedQueryEnabled(boolean a_AdvancedQueryEnabled)
Sets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.

Supported API: false

Specified by:
setAdvancedQueryEnabled in interface WhereExpression
Parameters:
a_AdvancedQueryEnabled -

validate

public int validate(TableExpression[] a_fromTables,
                    int a_offset)
             throws QueryException
This method validates the expression against the FROM clause.

Supported API: false

Specified by:
validate in interface WhereExpression
Parameters:
a_fromTables - TableExpressions to validate against.
a_offset - Offset index into the TableExpression array for the next valid TableExpression
Returns:
number of TableExpressions validated
Throws:
QueryException

setAliases

public int setAliases(String[] a_aliases,
                      int a_offset)
               throws QueryException
This method sets the aliases for components of the expression.

Supported API: false

Specified by:
setAliases in interface WhereExpression
Parameters:
a_aliases - Aliases to set.
a_offset - Offset index into the alias array for the next valid alias
Returns:
number of aliases used
Throws:
QueryException

getExpression

public String getExpression(boolean a_useBind,
                            Vector a_tableInfos,
                            Vector a_aliases)
                     throws QueryException
Return string representation of this expression.

Supported API: false

Specified by:
getExpression in interface WhereExpression
Parameters:
a_useBind - Indicates if bind parameters should be used.
a_tableInfos -
a_aliases -
Returns:
String
Throws:
QueryException

setFromIndicies

public int setFromIndicies(int[] a_fromIndicies,
                           int a_offset)
This method sets the From clause indicies for components of the expression.

Supported API: true

Specified by:
setFromIndicies in interface WhereExpression
Parameters:
a_fromIndicies - From indicies to set.
a_offset - Offset index into the From indicies array for the next valid From index
Returns:
number of indicies used

getClassAttributes

public List getClassAttributes()


Supported API: false

Specified by:
getClassAttributes in interface WhereExpression
Returns:
List

getJoinConditions

public WhereExpression getJoinConditions(String a_alias)
                                  throws QueryException
This method is to return the join search condition.

Supported API: false

Specified by:
getJoinConditions in interface WhereExpression
Parameters:
a_alias -
Returns:
WhereExpression
Throws:
QueryException

isAllJoinConditions

public boolean isAllJoinConditions(String a_alias)
                            throws QueryException


Supported API: false

Specified by:
isAllJoinConditions in interface WhereExpression
Parameters:
a_alias -
Returns:
boolean
Throws:
QueryException

getJoinIndex

public Set getJoinIndex()


Supported API: false

Specified by:
getJoinIndex in interface WhereExpression
Returns:
Set

getJoinConditions

public WhereExpression getJoinConditions(JoinIndex a_joinIndex)
This method is to return the join search condition.

Supported API: false

Specified by:
getJoinConditions in interface WhereExpression
Parameters:
a_joinIndex -
Returns:
WhereExpression

isAllOuterNonJoinConditions

public boolean isAllOuterNonJoinConditions()


Supported API: false

Specified by:
isAllOuterNonJoinConditions in interface WhereExpression
Returns:
boolean

getBindParameterFrom

public Object getBindParameterFrom(Vector a_singleBindParameter)


Supported API: false

Specified by:
getBindParameterFrom in interface WhereExpression
Parameters:
a_singleBindParameter -
Returns:
Object

setBindParameterIndicies

public int setBindParameterIndicies(int a_offset)


Supported API: false

Specified by:
setBindParameterIndicies in interface WhereExpression
Parameters:
a_offset -
Returns:
int

getJoinConditions

public WhereExpression getJoinConditions(Set a_joinIndexSet)
This method is to return the join search condition.

Supported API: false

Specified by:
getJoinConditions in interface WhereExpression
Parameters:
a_joinIndexSet -
Returns:
WhereExpression

isAllJoinConditions

public boolean isAllJoinConditions(Set a_joinIndexSet)


Supported API: false

Specified by:
isAllJoinConditions in interface WhereExpression
Parameters:
a_joinIndexSet -
Returns:
boolean

isAllJoinConditions

public boolean isAllJoinConditions(JoinIndex a_joinIndex)


Supported API: false

Specified by:
isAllJoinConditions in interface WhereExpression
Parameters:
a_joinIndex -
Returns:
boolean

getJoinConditions

public WhereExpression getJoinConditions(String a_alias,
                                         boolean a_removed)
                                  throws QueryException
This method is to return the join search condition.

Supported API: false

Specified by:
getJoinConditions in interface WhereExpression
Parameters:
a_alias -
a_removed -
Returns:
WhereExpression
Throws:
QueryException

isAllJoinConditions

public boolean isAllJoinConditions(String a_alias,
                                   boolean a_removed)
                            throws QueryException


Supported API: false

Specified by:
isAllJoinConditions in interface WhereExpression
Parameters:
a_alias -
a_removed -
Returns:
boolean
Throws:
QueryException

getJoinConditions

public WhereExpression getJoinConditions(String a_alias,
                                         int a_outerNonJoinFromIndex,
                                         boolean a_removed)
                                  throws QueryException
This method is to return the join search condition.

Supported API: false

Specified by:
getJoinConditions in interface WhereExpression
Parameters:
a_alias -
a_outerNonJoinFromIndex -
a_removed -
Returns:
WhereExpression
Throws:
QueryException

handleCorrelatedAttributes

public void handleCorrelatedAttributes(Vector a_tableInfos,
                                       Vector a_aliases)


Supported API: false

Specified by:
handleCorrelatedAttributes in interface WhereExpression
Parameters:
a_tableInfos -
a_aliases -

toString

public String toString()

setAliases

public static void setAliases(WhereExpression a_where,
                              Vector a_aliases)
                       throws WTException
Throws:
WTException

setAliases

public void setAliases(Vector a_aliases)
                throws WTException
Throws:
WTException

getComponents

protected Vector getComponents()

getComponentAt

public WhereExpression getComponentAt(int a_index)

removeComponentAt

public void removeComponentAt(int a_index)

getComponentCount

public int getComponentCount()

clear

public void clear()