com.metamatrix.query.mapping.relational
Class QueryNode

java.lang.Object
  extended by com.metamatrix.query.mapping.relational.QueryNode
All Implemented Interfaces:
java.io.Serializable

public class QueryNode
extends java.lang.Object
implements java.io.Serializable

The QueryNode represents a virtual or temporary group in the modeler. QueryNodes may be nested to indicate data queries built from other virtual or temporary groups. The root node of a tree of QueryNode objects should be defining a virtual group. Leaves should be other physical or virtual groups. Internal nodes of the tree are temporary groups.

A QueryNode must have a group name and a query. It may have a command (just used for convenient storage during conversion - this is not persisted). It may optionally have children and bindings.

See Also:
Serialized Form

Constructor Summary
QueryNode(java.lang.String groupName, java.lang.String query)
          Construct a query node with the required parameters.
 
Method Summary
 void addBinding(java.lang.String binding)
          Add parameter binding to this node.
 boolean equals(java.lang.Object obj)
          Check whether nodes are equal based on their group name and children.
 java.util.List getBindings()
          Get list of bindings.
 Command getCommand()
          Get command corresponding to query, may be null
 java.lang.String getGroupName()
          Get fully-qualified group name
 java.lang.String getQuery()
          Get SQL query
 int hashCode()
          Get hash code for node
 void setBindings(java.util.List bindings)
          Set all of the bindings (existing are dropped)
 void setCommand(Command command)
          Set command - this is provided as a convenient place to cache this command during conversion.
 void setQuery(java.lang.String query)
          Set the SQL query
 java.lang.String toString()
          Print plantree structure starting at this node
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryNode

public QueryNode(java.lang.String groupName,
                 java.lang.String query)
Construct a query node with the required parameters.

Parameters:
groupName - Fully qualified group name
query - SQL query
Method Detail

getGroupName

public java.lang.String getGroupName()
Get fully-qualified group name

Returns:
group name

getQuery

public java.lang.String getQuery()
Get SQL query

Returns:
SQL query

setQuery

public void setQuery(java.lang.String query)
Set the SQL query

Parameters:
String - query

addBinding

public void addBinding(java.lang.String binding)
Add parameter binding to this node. Bindings should be added in the order they appear in the query.

Parameters:
binding - Binding reference

getBindings

public java.util.List getBindings()
Get list of bindings.

Returns:
bindings

setBindings

public void setBindings(java.util.List bindings)
Set all of the bindings (existing are dropped)

Parameters:
bindings - New bindings

setCommand

public void setCommand(Command command)
Set command - this is provided as a convenient place to cache this command during conversion.

Parameters:
command - Command corresponding to query

getCommand

public Command getCommand()
Get command corresponding to query, may be null

Returns:
command Command corresponding to query

hashCode

public int hashCode()
Get hash code for node

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

equals

public boolean equals(java.lang.Object obj)
Check whether nodes are equal based on their group name and children.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other node to compare with
Returns:
True if equal

toString

public java.lang.String toString()
Print plantree structure starting at this node

Overrides:
toString in class java.lang.Object
Returns:
String representing this node and all children under this node


Copyright © 2009. All Rights Reserved.