org.teiid.query.sql.lang
Class SetQuery

java.lang.Object
  extended by org.teiid.query.sql.lang.Command
      extended by org.teiid.query.sql.lang.QueryCommand
          extended by org.teiid.query.sql.lang.SetQuery
All Implemented Interfaces:
Cloneable, LanguageObject

public class SetQuery
extends QueryCommand

This object acts as a Set operator on multiple Queries - UNION, INTERSECT, and EXCEPT can be implemented with this Class


Nested Class Summary
static class SetQuery.Operation
           
 
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
 
Field Summary
 
Fields inherited from class org.teiid.query.sql.lang.Command
tempGroupIDs, TYPE_ALTER_PROC, TYPE_ALTER_TRIGGER, TYPE_ALTER_VIEW, TYPE_BATCHED_UPDATE, TYPE_CREATE, TYPE_DELETE, TYPE_DROP, TYPE_DYNAMIC, TYPE_INSERT, TYPE_QUERY, TYPE_SQL, TYPE_STORED_PROCEDURE, TYPE_TRIGGER_ACTION, TYPE_UNKNOWN, TYPE_UPDATE, TYPE_UPDATE_PROCEDURE
 
Constructor Summary
SetQuery(SetQuery.Operation operation)
          Construct query with operation type
SetQuery(SetQuery.Operation operation, boolean all, QueryCommand leftQuery, QueryCommand rightQuery)
           
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 boolean areResultsCachable()
          Whether the results are cachable.
 Object clone()
          Deep clone this object to produce a new identical query.
 boolean equals(Object obj)
          Compare two queries for equality.
 QueryCommand getLeftQuery()
           
 SetQuery.Operation getOperation()
          Get operation for this set
 Query getProjectedQuery()
           
 List getProjectedSymbols()
          Get the ordered list of all elements returned by this query.
 List<Class<?>> getProjectedTypes()
           
 List<QueryCommand> getQueryCommands()
           
 QueryCommand getRightQuery()
           
 int getType()
          Return type of command.
static List getTypedProjectedSymbols(List acutal, List projectedTypes, QueryMetadataInterface metadata)
           
 int hashCode()
          Get hashcode for query.
 boolean isAll()
           
 void setAll(boolean all)
           
 void setLeftQuery(QueryCommand leftQuery)
           
 void setOperation(SetQuery.Operation operation)
          Set type of operation
 void setProjectedTypes(List<Class<?>> projectedTypes, QueryMetadataInterface metadata)
           
 void setRightQuery(QueryCommand rightQuery)
           
 
Methods inherited from class org.teiid.query.sql.lang.QueryCommand
getLimit, getOrderBy, getWith, returnsResultSet, setLimit, setOrderBy, setWith
 
Methods inherited from class org.teiid.query.sql.lang.Command
addExternalGroupsToContext, addExternalGroupToContext, copyMetadataState, getAllExternalGroups, getCacheHint, getCorrelatedReferences, getExternalGroupContexts, getOption, getProcessorPlan, getSourceHint, getTemporaryMetadata, getUpdateCommandSymbol, isResolved, printCommandTree, printCommandTree, pushNewResolvingContext, sameOptionAndHint, setCacheHint, setCorrelatedReferences, setExternalGroupContexts, setIsResolved, setOption, setProcessorPlan, setSourceHint, setTemporaryMetadata, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetQuery

public SetQuery(SetQuery.Operation operation)
Construct query with operation type

Parameters:
operation - Operation as specified like SetQuery.Operation.UNION

SetQuery

public SetQuery(SetQuery.Operation operation,
                boolean all,
                QueryCommand leftQuery,
                QueryCommand rightQuery)
Method Detail

getProjectedQuery

public Query getProjectedQuery()
Specified by:
getProjectedQuery in class QueryCommand

getType

public int getType()
Return type of command.

Specified by:
getType in class Command
Returns:
TYPE_QUERY

setOperation

public void setOperation(SetQuery.Operation operation)
Set type of operation

Parameters:
operation - Operation constant as defined in this class

getOperation

public SetQuery.Operation getOperation()
Get operation for this set

Returns:
Operation as defined in this class

acceptVisitor

public void acceptVisitor(LanguageVisitor visitor)
Description copied from interface: LanguageObject
Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.

Parameters:
visitor - Visitor being used

getProjectedSymbols

public List getProjectedSymbols()
Get the ordered list of all elements returned by this query. These elements may be ElementSymbols or ExpressionSymbols but in all cases each represents a single column.

Specified by:
getProjectedSymbols in class Command
Returns:
Ordered list of SingleElementSymbol

getTypedProjectedSymbols

public static List getTypedProjectedSymbols(List acutal,
                                            List projectedTypes,
                                            QueryMetadataInterface metadata)

clone

public Object clone()
Deep clone this object to produce a new identical query.

Specified by:
clone in interface LanguageObject
Specified by:
clone in class Command
Returns:
Deep clone

equals

public boolean equals(Object obj)
Compare two queries for equality.

Overrides:
equals in class Object
Parameters:
obj - Other object
Returns:
True if equal

hashCode

public int hashCode()
Get hashcode for query. WARNING: This hash code relies on the hash codes of the Select and Criteria clauses. If the query changes, it's hash code will change and it can be lost from collections. Hash code is only valid after query has been completely constructed.

Overrides:
hashCode in class Object
Returns:
Hash code

areResultsCachable

public boolean areResultsCachable()
Description copied from class: Command
Whether the results are cachable.

Specified by:
areResultsCachable in class Command
Returns:
True if the results are cachable; false otherwise.
See Also:
Command.areResultsCachable()

getQueryCommands

public List<QueryCommand> getQueryCommands()
Returns:
the left and right queries as a list. This list cannot be modified.

setProjectedTypes

public void setProjectedTypes(List<Class<?>> projectedTypes,
                              QueryMetadataInterface metadata)
Parameters:
projectedSymbols - The projectedSymbols to set.

getProjectedTypes

public List<Class<?>> getProjectedTypes()
Returns:
Returns the projectedTypes.

isAll

public boolean isAll()

setAll

public void setAll(boolean all)

getLeftQuery

public QueryCommand getLeftQuery()

setLeftQuery

public void setLeftQuery(QueryCommand leftQuery)

getRightQuery

public QueryCommand getRightQuery()

setRightQuery

public void setRightQuery(QueryCommand rightQuery)


Copyright © 2012. All Rights Reserved.