Style Intelligence v12.0

inetsoft.uql.path
Class XSelection

java.lang.Object
  extended by inetsoft.uql.path.XSelection
All Implemented Interfaces:
Serializable, Cloneable

public class XSelection
extends Object
implements Serializable, Cloneable

An XSelection is a list of column selections. When applied to a tree, the XSelection selects nodes from the tree according to the column specification, and create a table node from the tree nodes.

See Also:
Serialized Form

Field Summary
protected  Vector aliasmap
           
protected  Hashtable bmap
           
protected  boolean expanded
           
protected  Vector expmap
           
protected  Hashtable fmtmap
           
protected  Vector metamap
           
protected  Vector opaths
           
protected  Vector paths
           
protected  Hashtable typemap
           
 
Constructor Summary
XSelection()
          Create an empty selection.
 
Method Summary
 int addColumn(String path)
          Add a column to the selection list.
 void clear()
          Remove all components from the path.
 Object clone()
           
 boolean contains(String path)
          Check if the specified column is in the selection.
 String findColumn(String name)
          Find the column with a name, which might be the alias, column or the suffix of the column.
 String getAlias(int col)
          Get the alias for a table column.
 String getAliasColumn(String alias)
          Get the column with the specified alias.
 String getBaseColumn(String exp)
          Set the base column of an expression.
 String getColumn(int idx)
          Get the specified column.
 int getColumnCount()
          Get the number of columns in this selection.
 String getFormat(String path)
          Get the format string used for converting the input node value to the specified type.
 String getOriginalColumn(int idx)
          Get the original column.
 String getType(String path)
          Get the type conversion for the column.
 XMetaInfo getXMetaInfo(int idx)
          Get the meta data.
 XMetaInfo getXMetaInfo(int idx, boolean create)
          Get the meta data.
 XMetaInfo getXMetaInfo(String path)
          Get the meta data.
 XMetaInfo getXMetaInfo(String path, boolean create)
          Get the meta data.
 Enumeration getXMetaInfos()
          Get the all meta data.
 int indexOf(String path)
          Get the index of the specified path.
 int indexOfColumn(String name)
          Get the column index with a name, which might be the alias, column or the suffix of the column.
 int indexOfColumn(String name, boolean upperCasedAlias)
          Get the column index with a name, which might be the alias, column or the suffix of the column.
 boolean isAlias(String alias)
          Check if a column name is an alias.
 boolean isExpandSubtree()
          Check if the subtrees should be expanded.
 boolean isExpression(int idx)
          Check the index is a expression column.
 boolean isExpression(String column)
          Check the column is a expression column.
 boolean isFormatFixed(String path)
          Gets the flag that determines if the format is fixed by the source of the data or may be modified by the user.
static XSelection parse(String select)
          Parse a selection string and create a selection object.
 boolean removeAliasColumn(String alias)
          Remove an alias column.
 boolean removeColumn(int idx)
          Remove a selected column.
 boolean removeColumn(String path)
          Remove a selected column.
 XTableNode select(XNode root)
          Apply the path to the tree, and return selected nodes from the tree as a table.
 void setAlias(int col, String alias)
          Set an alias for a table column.
 void setBaseColumn(String exp, String col)
          Set the base column of an expression.
 void setColumn(int idx, String col)
          Set the name of the specified column.
 void setConversion(String path, String type, String fmt)
          Set the type of a column.
 void setExpandSubtree(boolean expanded)
          If ExpandSubtree is set to true, all subtrees in a selected tree are expanded.
 void setExpression(int col, boolean b)
          Set a col is expression column.
 void setFormat(String path, String fmt)
          Set the format of a column.
 void setFormatFixed(String path, boolean formatFixed)
          Sets the flag that determines if the format is fixed by the source of the data or may be modified by the user.
 void setOriginalColumn(int idx, String col)
          Set the original name of the specified column.
 void setType(String path, String type)
          Set the type of a column.
 void setXMetaInfo(int idx, XMetaInfo meta)
          Set the meta data.
 String toIdentifier()
          Get the identifier.
 String toString()
          Convert to the string representation of this selection.
 String toString(boolean sql)
          Convert to a SQL compliant selection.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

expanded

protected boolean expanded

paths

protected Vector paths

aliasmap

protected Vector aliasmap

expmap

protected Vector expmap

bmap

protected Hashtable bmap

opaths

protected Vector opaths

metamap

protected Vector metamap

typemap

protected Hashtable typemap

fmtmap

protected Hashtable fmtmap
Constructor Detail

XSelection

public XSelection()
Create an empty selection.

Method Detail

parse

public static XSelection parse(String select)
                        throws ParseException
Parse a selection string and create a selection object.

Throws:
ParseException

setExpandSubtree

public void setExpandSubtree(boolean expanded)
If ExpandSubtree is set to true, all subtrees in a selected tree are expanded. For example, if a node contains a subtree constaining 5 children, the node generates 5 rows. If a node contains two subtrees containing 4 and 5 children respectively, it generates 20 rows.


isExpandSubtree

public boolean isExpandSubtree()
Check if the subtrees should be expanded.


select

public XTableNode select(XNode root)
                  throws Exception
Apply the path to the tree, and return selected nodes from the tree as a table.

Parameters:
root - tree root.
Returns:
selected nodes as table.
Throws:
Exception

clear

public void clear()
Remove all components from the path.


addColumn

public int addColumn(String path)
Add a column to the selection list. The column can be a node path, e.g., employee.name, or a node attribute, e.g., employee@title.

Parameters:
path - tree node path to select as a table column.

removeAliasColumn

public boolean removeAliasColumn(String alias)
Remove an alias column.


removeColumn

public boolean removeColumn(String path)
Remove a selected column.

Parameters:
path - tree node path selected as a table column.

removeColumn

public boolean removeColumn(int idx)
Remove a selected column.

Parameters:
idx - column index in the list.

setAlias

public void setAlias(int col,
                     String alias)
Set an alias for a table column.

Parameters:
col - the column index.
alias - column alias.

getAlias

public String getAlias(int col)
Get the alias for a table column.

Parameters:
col - the column index.
Returns:
column alias.

setExpression

public void setExpression(int col,
                          boolean b)
Set a col is expression column.


isExpression

public boolean isExpression(String column)
Check the column is a expression column.


isExpression

public boolean isExpression(int idx)
Check the index is a expression column.


setBaseColumn

public void setBaseColumn(String exp,
                          String col)
Set the base column of an expression.


getBaseColumn

public String getBaseColumn(String exp)
Set the base column of an expression.


setConversion

public void setConversion(String path,
                          String type,
                          String fmt)
Set the type of a column. The value of the tree node is converted to the specified type during selection.

Parameters:
path - tree node path.
type - type name. One of the value defined in XSchema class.
fmt - format used to create a java.text.Format object.

setType

public void setType(String path,
                    String type)
Set the type of a column. Setting a column type could force the column values to be converted to the specified type if the datasource returns string instead of the specified value type.


getType

public String getType(String path)
Get the type conversion for the column.

Parameters:
path - tree node path.

getFormat

public String getFormat(String path)
Get the format string used for converting the input node value to the specified type. The format depends on the type. For date related types, the format is a SimpleDateFormat specification. For numeric types, the format is a DecimalFormat specification.

Parameters:
path - tree node path.
Returns:
format string or null.

setFormat

public void setFormat(String path,
                      String fmt)
Set the format of a column. The format is used to parse data if the type is also set for this column.


isFormatFixed

public boolean isFormatFixed(String path)
Gets the flag that determines if the format is fixed by the source of the data or may be modified by the user.

Parameters:
path - the column path.
Returns:
true if fixed; false otherwise.

setFormatFixed

public void setFormatFixed(String path,
                           boolean formatFixed)
Sets the flag that determines if the format is fixed by the source of the data or may be modified by the user.

Parameters:
path - the column path.
formatFixed - true if fixed; false otherwise.

getColumnCount

public int getColumnCount()
Get the number of columns in this selection.


getColumn

public String getColumn(int idx)
Get the specified column.


getOriginalColumn

public String getOriginalColumn(int idx)
Get the original column.


setOriginalColumn

public void setOriginalColumn(int idx,
                              String col)
Set the original name of the specified column.


setColumn

public void setColumn(int idx,
                      String col)
Set the name of the specified column.


getXMetaInfos

public Enumeration getXMetaInfos()
Get the all meta data.

Returns:
all mete data.

getXMetaInfo

public XMetaInfo getXMetaInfo(int idx)
Get the meta data.

Parameters:
idx - the column index.
Returns:
mete data.

getXMetaInfo

public XMetaInfo getXMetaInfo(int idx,
                              boolean create)
Get the meta data.

Parameters:
idx - the column index.
Returns:
mete data.

setXMetaInfo

public void setXMetaInfo(int idx,
                         XMetaInfo meta)
Set the meta data.

Parameters:
idx - the column index.
meta - the mete data.

getXMetaInfo

public XMetaInfo getXMetaInfo(String path)
Get the meta data.

Parameters:
path - tree node path.
Returns:
mete data.

getXMetaInfo

public XMetaInfo getXMetaInfo(String path,
                              boolean create)
Get the meta data.

Parameters:
path - tree node path.
Returns:
mete data.

contains

public boolean contains(String path)
Check if the specified column is in the selection.


getAliasColumn

public String getAliasColumn(String alias)
Get the column with the specified alias.


isAlias

public boolean isAlias(String alias)
Check if a column name is an alias. A column name is an alias if and only if it's an existing alias and the corresponding column is not equal to it.


indexOf

public int indexOf(String path)
Get the index of the specified path.


toString

public String toString()
Convert to the string representation of this selection. The string can be used in the parse() method to reconstruct the object.

Overrides:
toString in class Object

toIdentifier

public String toIdentifier()
Get the identifier.


toString

public String toString(boolean sql)
Convert to a SQL compliant selection.


indexOfColumn

public int indexOfColumn(String name)
Get the column index with a name, which might be the alias, column or the suffix of the column.

Parameters:
name - the specified name.
Returns:
the column index if found, null otherwise.

indexOfColumn

public int indexOfColumn(String name,
                         boolean upperCasedAlias)
Get the column index with a name, which might be the alias, column or the suffix of the column.

Parameters:
name - the specified name.
Returns:
the column index if found, null otherwise.

findColumn

public String findColumn(String name)
Find the column with a name, which might be the alias, column or the suffix of the column.

Parameters:
name - the specified name.
Returns:
the column if found, null otherwise.

clone

public Object clone()
Overrides:
clone in class Object

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