Style Intelligence v12.0

inetsoft.uql
Class XQuery

java.lang.Object
  extended by inetsoft.uql.XQuery
All Implemented Interfaces:
inetsoft.util.XMLSerializable, Serializable, Cloneable
Direct Known Subclasses:
HierQuery, JDBCQuery, TabularQuery, TextQuery, XMLAQuery

public abstract class XQuery
extends Object
implements Serializable, Cloneable, inetsoft.util.XMLSerializable

XQuery object represents a query in the query registry. Each query must have an unique name in a registry.

See Also:
Serialized Form

Field Summary
static String DERIVED
          A derived query type.
static String HINT_DEFAULT_MAX_ROWS
          A hint indicates that the max rows is the default value defined internally.
static String HINT_IGNORE_MAX_ROWS
          A hint indicates that the max rows definition should be ignored.
static String HINT_MAX_ROWS
          A hint to change the query max rows setting.
static String HINT_TIMEOUT
          A hint to change the query timeout setting.
 
Constructor Summary
protected XQuery(String type)
          Create a query object with the specified type.
 
Method Summary
 void addVariable(XVariable var)
          Add a variable to this query.
 Object clone()
          Create a clone of this object.
 boolean equals(Object obj)
          Check if equals another object.
protected  void findVariables(Map varmap)
          Find all variables used in this query.
protected  void findVariables(inetsoft.uql.jdbc.XExpression expression, Map varmap)
          Find all variables in the string and add to the variable list.
 void findVariables(XNode root)
           
protected  void findVariables(XNode root, Map varmap)
          Find all variables in the value tree and add to the variable list.
protected  void findVariables(XNodePath path)
          Find all variables in the path and add to the variable list.
 Enumeration getAllDefinedVariables()
          Get the names of all variables need to be defined in this query, include all variables, such as build in variable.
 XDataSource getDataSource()
          Get the data source this query is associated with.
 Enumeration getDefinedVariables()
          Get the names of all variables need to be defined in this query.
 String getDescription()
          Get the description of this data source.
 long getEstimatedTime()
          Get the estimated occupied time.
 String getFolder()
          Get the query folder.
 int getMaxRows()
          Get the row limit (maximum number of rows) of this query.
 String getName()
          Get the query name.
 XTypeNode getOutputType(Object session)
          Get the output type of the query.
abstract  XTypeNode getOutputType(Object session, boolean full)
          Get the output type of the query.
 String getPartition()
          Gets the name of the partition used to apply VPM conditions to this query.
 Object getProperty(String name)
          Get a property value.
abstract  XSelection getSelection()
          Get the XSelection object.
 int getTimeout()
          Get query timeout value in seconds.
 String getType()
          Get the query type.
 XVariable getVariable(String name)
          Get a variable defined in this query.
 Enumeration getVariableNames()
          Get the names of all variables used in this query.
 int hashCode()
          Get the hash code value.
 boolean isOutputTypeAvailable()
          Check if is output type of the query is available.
 boolean isVisible()
          Check if this query is visible to end user.
 void parseXML(Element root)
          Parse the XML element that contains information on this query.
 void removeVariable(String name)
          Remove a variable from this query.
 void revalidate()
          Revalidate the query object if context changes, for example, data source registry changes.
 void setDataSource(XDataSource datasource)
          Set the data source this query is associated with.
 void setDescription(String desc)
          Set the description of this data source.
 void setEstimatedTime(long estimated)
          Set the estimated occupied time.
 void setFolder(String folder)
          Set the query folder.
 void setMaxRows(int rowlimit)
          Set the row limit (maximum number of rows) of this query.
 void setName(String name)
          Set the query name.
 void setPartition(String partition)
          Sets the name of the partition used to apply VPM conditions to this query.
 void setProperty(String name, Object val)
          Set a property value.
 void setTimeout(int seconds)
          Set query timeout value in seconds.
 void setVisible(boolean vis)
          Set if this query should be visible to end user (composer).
 String toString()
          Get the string representation.
 void updateQueryVariable(XQueryRepository repository)
          Update the query to set the local query repository to the query variable, so that the local query can be found at runtime.
 void writeXML(PrintWriter writer)
          Generate the XML segment to represent this query.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HINT_MAX_ROWS

public static final String HINT_MAX_ROWS
A hint to change the query max rows setting. This can be passed in as a query parameter to override the static setting in the query.

See Also:
Constant Field Values

HINT_TIMEOUT

public static final String HINT_TIMEOUT
A hint to change the query timeout setting. This can be passed in as a query parameter to override the static setting in the query.

See Also:
Constant Field Values

HINT_DEFAULT_MAX_ROWS

public static final String HINT_DEFAULT_MAX_ROWS
A hint indicates that the max rows is the default value defined internally.

See Also:
Constant Field Values

DERIVED

public static final String DERIVED
A derived query type.

See Also:
Constant Field Values

HINT_IGNORE_MAX_ROWS

public static final String HINT_IGNORE_MAX_ROWS
A hint indicates that the max rows definition should be ignored.

See Also:
Constant Field Values
Constructor Detail

XQuery

protected XQuery(String type)
Create a query object with the specified type.

Parameters:
type - data source type. One of values defined in XDataSource.
Method Detail

setName

public void setName(String name)
Set the query name.


getName

public String getName()
Get the query name.


setFolder

public void setFolder(String folder)
Set the query folder. The folder is only used for displaying a query and does not change the name scope of a query.


getFolder

public String getFolder()
Get the query folder. If the folder is null or empty, the query is displayed under the datasource root.


getType

public String getType()
Get the query type.


setDataSource

public void setDataSource(XDataSource datasource)
Set the data source this query is associated with.


getDataSource

public XDataSource getDataSource()
Get the data source this query is associated with.


getOutputType

public abstract XTypeNode getOutputType(Object session,
                                        boolean full)
Get the output type of the query. The return value is either the root of a subtree of the a type tree, or a one level tree with each child representing a table column.

Parameters:
session - the session object
full - true to fetch full name

isOutputTypeAvailable

public boolean isOutputTypeAvailable()
Check if is output type of the query is available. For a non-parse SQL, output type may not be available.


getOutputType

public XTypeNode getOutputType(Object session)
Get the output type of the query. The return value is either the root of a subtree of the a type tree, or a one level tree with each child representing a table column.

Parameters:
session - the session object

getDefinedVariables

public Enumeration getDefinedVariables()
Get the names of all variables need to be defined in this query.


getAllDefinedVariables

public Enumeration getAllDefinedVariables()
Get the names of all variables need to be defined in this query, include all variables, such as build in variable.


getVariableNames

public Enumeration getVariableNames()
Get the names of all variables used in this query. The variables are either UserVariable or QueryVariable.


getVariable

public XVariable getVariable(String name)
Get a variable defined in this query.

Parameters:
name - variable name.
Returns:
variable definition.

addVariable

public void addVariable(XVariable var)
Add a variable to this query.

Parameters:
var - variable definition.

removeVariable

public void removeVariable(String name)
Remove a variable from this query.

Parameters:
name - variable name.

setDescription

public void setDescription(String desc)
Set the description of this data source.


getDescription

public String getDescription()
Get the description of this data source.


getEstimatedTime

public long getEstimatedTime()
Get the estimated occupied time.

Returns:
the estimated occupied time.

setEstimatedTime

public void setEstimatedTime(long estimated)
Set the estimated occupied time.

Parameters:
estimated - the estimated occupied time.

setMaxRows

public void setMaxRows(int rowlimit)
Set the row limit (maximum number of rows) of this query. No limit is placed on the number of rows if the value is zero.


getMaxRows

public int getMaxRows()
Get the row limit (maximum number of rows) of this query.


setTimeout

public void setTimeout(int seconds)
Set query timeout value in seconds. No limit is placed on the query if the value is zero.


getTimeout

public int getTimeout()
Get query timeout value in seconds.


setVisible

public void setVisible(boolean vis)
Set if this query should be visible to end user (composer).


isVisible

public boolean isVisible()
Check if this query is visible to end user.


getPartition

public String getPartition()
Gets the name of the partition used to apply VPM conditions to this query.

Returns:
the name of a partition or null if no VPM conditions should be applied.
Since:
6.0

setPartition

public void setPartition(String partition)
Sets the name of the partition used to apply VPM conditions to this query.

Parameters:
partition - the name of a partition or null if no VPM conditions should be applied.
Since:
6.0

revalidate

public void revalidate()
Revalidate the query object if context changes, for example, data source registry changes.


setProperty

public void setProperty(String name,
                        Object val)
Set a property value. Property is generic interface for attaching additional information to a query object. Properties are transient and is not saved as part of the query definition.


getProperty

public Object getProperty(String name)
Get a property value.


getSelection

public abstract XSelection getSelection()
Get the XSelection object.


parseXML

public void parseXML(Element root)
              throws Exception
Parse the XML element that contains information on this query.

Specified by:
parseXML in interface inetsoft.util.XMLSerializable
Throws:
Exception

writeXML

public void writeXML(PrintWriter writer)
Generate the XML segment to represent this query.

Specified by:
writeXML in interface inetsoft.util.XMLSerializable

findVariables

protected void findVariables(Map varmap)
Find all variables used in this query.


findVariables

public void findVariables(XNode root)

findVariables

protected void findVariables(XNode root,
                             Map varmap)
Find all variables in the value tree and add to the variable list.


findVariables

protected void findVariables(inetsoft.uql.jdbc.XExpression expression,
                             Map varmap)
Find all variables in the string and add to the variable list.


findVariables

protected void findVariables(XNodePath path)
Find all variables in the path and add to the variable list.


updateQueryVariable

public void updateQueryVariable(XQueryRepository repository)
Update the query to set the local query repository to the query variable, so that the local query can be found at runtime.


clone

public Object clone()
Create a clone of this object.

Overrides:
clone in class Object

hashCode

public int hashCode()
Get the hash code value.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Check if equals another object.

Overrides:
equals in class Object

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.