com.metamatrix.query.sql.lang
Class SetQuery

java.lang.Object
  extended by com.metamatrix.query.sql.lang.Command
      extended by com.metamatrix.query.sql.lang.QueryCommand
          extended by com.metamatrix.query.sql.lang.SetQuery
All Implemented Interfaces:
LanguageObject, java.io.Serializable, java.lang.Cloneable

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

See Also:
Serialized Form

Nested Class Summary
static class SetQuery.Operation
           
 
Field Summary
 
Fields inherited from class com.metamatrix.query.sql.lang.Command
tempGroupIDs, TYPE_BATCHED_UPDATE, TYPE_CREATE, TYPE_DELETE, TYPE_DROP, TYPE_DYNAMIC, TYPE_INSERT, TYPE_QUERY, TYPE_SQL, TYPE_STORED_PROCEDURE, TYPE_UNKNOWN, TYPE_UPDATE, TYPE_UPDATE_PROCEDURE, TYPE_XQUERY
 
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.
 java.lang.Object clone()
          Deep clone this object to produce a new identical query.
 boolean equals(java.lang.Object obj)
          Compare two queries for equality.
 QueryCommand getLeftQuery()
           
 SetQuery.Operation getOperation()
          Get operation for this set
 Query getProjectedQuery()
           
 java.util.List getProjectedSymbols()
          Get the ordered list of all elements returned by this query.
 java.util.List<java.lang.Class<?>> getProjectedTypes()
           
 java.util.List<QueryCommand> getQueryCommands()
           
 QueryCommand getRightQuery()
           
 int getType()
          Return type of command.
static java.util.List getTypedProjectedSymbols(java.util.List acutal, java.util.List projectedTypes)
           
 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(java.util.List<java.lang.Class<?>> projectedTypes)
           
 void setRightQuery(QueryCommand rightQuery)
           
 int updatingModelCount(QueryMetadataInterface metadata)
          Return the number of updates on physical sources by this command.
 
Methods inherited from class com.metamatrix.query.sql.lang.QueryCommand
getLimit, getOrderBy, setLimit, setOrderBy
 
Methods inherited from class com.metamatrix.query.sql.lang.Command
addExternalGroupsToContext, addExternalGroupToContext, copyMetadataState, getAllExternalGroups, getExternalGroupContexts, getOption, getSubCommands, getSubCommandsUpdatingModelCount, getSubCommandsUpdatingModelCount, getTemporaryMetadata, getUpdateCommandSymbol, getUpdatesCommandSymbol, getVariableValues, getVirtualGroup, isResolved, printCommandTree, printCommandTree, pushNewResolvingContext, setExternalGroupContexts, setIsResolved, setOption, setTemporaryMetadata, setVariableValues, setVirtualGroup, 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 java.util.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 java.util.List getTypedProjectedSymbols(java.util.List acutal,
                                                      java.util.List projectedTypes)

clone

public java.lang.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(java.lang.Object obj)
Compare two queries for equality.

Overrides:
equals in class java.lang.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 java.lang.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()

updatingModelCount

public int updatingModelCount(QueryMetadataInterface metadata)
                       throws MetaMatrixComponentException
Description copied from class: Command
Return the number of updates on physical sources by this command.

Specified by:
updatingModelCount in class Command
Parameters:
metadata - QueryMetadataInterface
Returns:
The number of updates on physical sources by this command.
Throws:
MetaMatrixComponentException

getQueryCommands

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

setProjectedTypes

public void setProjectedTypes(java.util.List<java.lang.Class<?>> projectedTypes)
Parameters:
projectedSymbols - The projectedSymbols to set.

getProjectedTypes

public java.util.List<java.lang.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 © 2009. All Rights Reserved.