com.sas.dataselectors.filters
Class OLAPMemberTreeModel

com.sas.dataselectors.filters.OLAPMemberTreeModel
All Implemented Interfaces:
FilterValuesInterface, OLAPMemberTreePathFactoryInterface, java.io.Serializable, javax.swing.tree.TreeModel
Direct Known Subclasses:
OLAPLevelMemberTreeModel, OLAPMemberValueAndTreeModel

public class OLAPMemberTreeModel
implements FilterValuesInterface, OLAPMemberTreePathFactoryInterface

This tree model extends the Swing DefaultTreeModel class to add population methods for OLAP members. By providing a DataItem or Dimension at construction, the tree model will populate itself with the appropriate nodes based on metadata found on the OLAP server. This class also acts as a value list within the filter model to provide selectable members as values for OLAP filters.

See Also:
Serialized Form

Field Summary
protected  java.util.Collection _itemValues
          A collection of values for use within the filter model.
protected  java.util.Iterator _itemValuesIterator
          An iterator over the filter model values list to provide sequential access.
protected  java.lang.String _label
          The label for this model.
protected  MetadataInterface _metadata
          The OLAP metadata interface object used to gather metadata from an OLAP source.
static java.lang.String RB_KEY
          The prefix used for resource properties associated with this class.
 
Fields inherited from interface com.sas.dataselectors.filters.FilterValuesInterface
GETTHRESHHOLDALLVALUES
 
Constructor Summary
OLAPMemberTreeModel(com.sas.iquery.metadata.business.DataItem dataItem, MetadataInterface metadata)
          Constructs a new tree model and prepopulates it using metadata gathered from the given DataItem and MetadataInterface objects.
OLAPMemberTreeModel(com.sas.iquery.metadata.business.DataItem dataItem, MetadataInterface metadata, int levelDepth)
           
OLAPMemberTreeModel(DimensionInterface dimension)
          Constructs a new tree model and prepopulates it using metadata gathered from the given DimensionInterface object.
OLAPMemberTreeModel(OLAPMemberTreeNode root)
          Constructs a new tree model with the given tree node as the root.
OLAPMemberTreeModel(OLAPMemberTreeNode root, boolean asksAllowsChildren)
          Constructs a new tree model with the given tree node as the root.
 
Method Summary
 java.util.List getFirstValues(long lThreshold)
          Returns the first list of values.
 java.lang.String getListLabel()
          Returns the current label for this list of values.
static MemberInterface[] getMemberArrayForPathNodeList(MetadataInterface metadata, java.lang.String cubeName, java.lang.String memberName)
          Retrieves an array of members from a metadata server based on the specified properties.
 MetadataInterface getMetadata()
          Returns the OLAP Metadata Interface object used to gather metadata from an OLAP source.
 java.util.List getNextValues(long lThreshold)
          Returns the next list of values.
 java.util.List getTreePathNodeList(com.sas.iquery.metadata.business.DataItem dataItem, java.lang.String memberName)
          Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.
 java.util.List getTreePathNodeList(FilterItemInterface filterItem, FilterValueInterface filterValue)
          Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member derived from the given parameters.
 java.util.List getTreePathNodeList(FilterValueInterface filterValue)
          Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member derived from the given parameters.
static void getTreePathNodeList(OLAPMemberTreeModel tree, MemberInterface[] members, java.util.List list)
          Constructs the path that correlates to the list of members by adding the tree nodes for each member to the supplied list.
static java.util.List getTreePathNodeList(OLAPMemberTreeModel tree, MetadataInterface metadata, java.lang.String cubeName, java.lang.String memberName)
          Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.
 java.util.List getTreePathNodeList(java.lang.String memberName)
          Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.
 java.util.List getTreePathNodeList(java.lang.String cubeName, java.lang.String memberName)
          Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.
 boolean hasMoreValues()
          Returns TRUE if more values are available, FALSE otherwise.
 void setListLabel(java.lang.String value)
          Allows setting a label for this list of values.
 void setMetadata(MetadataInterface metadata)
          Sets the OLAP Metadata Interface object to be used by this model when gathering metadata from an OLAP source.
 void setRoot(javax.swing.tree.TreeNode root)
          Sets the root node of this tree model.
 java.lang.String toString()
          Returns a text representation of this model.
 

Field Detail

RB_KEY

public static java.lang.String RB_KEY
The prefix used for resource properties associated with this class.


_label

protected transient java.lang.String _label
The label for this model.


_itemValues

protected java.util.Collection _itemValues
A collection of values for use within the filter model. The collection is made up of the members within the tree model.


_itemValuesIterator

protected java.util.Iterator _itemValuesIterator
An iterator over the filter model values list to provide sequential access.


_metadata

protected MetadataInterface _metadata
The OLAP metadata interface object used to gather metadata from an OLAP source.

Constructor Detail

OLAPMemberTreeModel

public OLAPMemberTreeModel(OLAPMemberTreeNode root,
                           boolean asksAllowsChildren)
Constructs a new tree model with the given tree node as the root.

Parameters:
root - the root node of the new tree model
askAllowsChildren - a boolean, false if any node can have children, true if each node is asked to see if it can have children
See Also:
DefaultTreeModel.asksAllowsChildren

OLAPMemberTreeModel

public OLAPMemberTreeModel(OLAPMemberTreeNode root)
Constructs a new tree model with the given tree node as the root.

Parameters:
root - the root node of the new tree model

OLAPMemberTreeModel

public OLAPMemberTreeModel(com.sas.iquery.metadata.business.DataItem dataItem,
                           MetadataInterface metadata)
                    throws com.sas.iquery.metadata.MetadataException
Constructs a new tree model and prepopulates it using metadata gathered from the given DataItem and MetadataInterface objects.

Parameters:
dataItem - the entry point in the OLAP member tree
metadata - the interface to use when getting metadata from an OLAP source
Throws:
com.sas.iquery.metadata.MetadataException - if any errors occur while retrieving data from the OLAP metadata server

OLAPMemberTreeModel

public OLAPMemberTreeModel(com.sas.iquery.metadata.business.DataItem dataItem,
                           MetadataInterface metadata,
                           int levelDepth)
                    throws com.sas.iquery.metadata.MetadataException
Throws:
com.sas.iquery.metadata.MetadataException

OLAPMemberTreeModel

public OLAPMemberTreeModel(DimensionInterface dimension)
                    throws OLAPException
Constructs a new tree model and prepopulates it using metadata gathered from the given DimensionInterface object.

Parameters:
dimension - the entry point in the OLAP member tree
Throws:
OLAPException - if any errors occur while retrieving data from the OLAP metadata server
Method Detail

getMetadata

public MetadataInterface getMetadata()
Returns the OLAP Metadata Interface object used to gather metadata from an OLAP source.

Specified by:
getMetadata in interface OLAPMemberTreePathFactoryInterface
Returns:
the metadata interface

setMetadata

public void setMetadata(MetadataInterface metadata)
Sets the OLAP Metadata Interface object to be used by this model when gathering metadata from an OLAP source.

Parameters:
metadata - the new interface

hasMoreValues

public boolean hasMoreValues()
Returns TRUE if more values are available, FALSE otherwise.

Specified by:
hasMoreValues in interface FilterValuesInterface
Returns:
TRUE if more values are available, FALSE otherwise

getFirstValues

public java.util.List getFirstValues(long lThreshold)
                              throws DataRetrievalError
Returns the first list of values.

Specified by:
getFirstValues in interface FilterValuesInterface
Parameters:
lThreshold - the maximum number of values to return
Returns:
the first list of values
Throws:
DataRetrievalError - if any errors occur while retrieving data from the OLAP metadata server

getNextValues

public java.util.List getNextValues(long lThreshold)
                             throws DataRetrievalError
Returns the next list of values.

Specified by:
getNextValues in interface FilterValuesInterface
Parameters:
lThreshold - the maximum number of values to return
Returns:
the next list of values
Throws:
DataRetrievalError - if any errors occur while retrieving data from the OLAP metadata server

setRoot

public void setRoot(javax.swing.tree.TreeNode root)
Sets the root node of this tree model.

Overrides:
setRoot in class javax.swing.tree.DefaultTreeModel
Parameters:
root - the new root node for this model

setListLabel

public void setListLabel(java.lang.String value)
Allows setting a label for this list of values.

Parameters:
value - The new label for this list

getListLabel

public java.lang.String getListLabel()
Returns the current label for this list of values.

Specified by:
getListLabel in interface FilterValuesInterface
Returns:
the label for this list

toString

public java.lang.String toString()
Returns a text representation of this model.

Overrides:
toString in class java.lang.Object
Returns:
a text representation of this model

getMemberArrayForPathNodeList

public static MemberInterface[] getMemberArrayForPathNodeList(MetadataInterface metadata,
                                                              java.lang.String cubeName,
                                                              java.lang.String memberName)
                                                       throws OLAPException
Retrieves an array of members from a metadata server based on the specified properties. The returned members are those along the path from the root to the target member and also the member's siblings.

Parameters:
metadata - the MetadataInterface connected to the OLAP cube metadata server
cubeName - the name of the cube the target member is a part of
memberName - the target member
Returns:
an array of MemberInterface instances describing the path to the root of the member tree from the target member and the member's siblings
Throws:
OLAPException - in the event of a communication error with the metadata server

getTreePathNodeList

public static java.util.List getTreePathNodeList(OLAPMemberTreeModel tree,
                                                 MetadataInterface metadata,
                                                 java.lang.String cubeName,
                                                 java.lang.String memberName)
                                          throws FilterException
Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.

Parameters:
tree - the source tree model
metadata - the MetadataInterface connected to the OLAP cube metadata server
cubeName - the name of the cube the target member is a part of
memberName - the target member
Returns:
a List of OLAPMemberTreeNodes defining the path from the root to the target node
Throws:
FilterException - in the event of a communications failure or any error with the metadata server

getTreePathNodeList

public static void getTreePathNodeList(OLAPMemberTreeModel tree,
                                       MemberInterface[] members,
                                       java.util.List list)
                                throws OLAPException
Constructs the path that correlates to the list of members by adding the tree nodes for each member to the supplied list.

Parameters:
tree - the tree model to work with
members - the list of members to retrieve tree nodes for (the rough path through the member tree)
list - the list of tree nodes forming the path from the root of the model along the supplied list of members
Throws:
OLAPException - if any errors occur while retrieving data from the OLAP metadata server

getTreePathNodeList

public java.util.List getTreePathNodeList(com.sas.iquery.metadata.business.DataItem dataItem,
                                          java.lang.String memberName)
                                   throws FilterException
Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.

Parameters:
dataItem - a BIQ DataItem from the OLAP cube to be searched
memberName - the unique member name of the target cube member
Returns:
a List of OLAPMemberTreeNodes defining the path from the root to the target node
Throws:
FilterException - in the event of a communications failure or any error with the metadata server

getTreePathNodeList

public java.util.List getTreePathNodeList(java.lang.String cubeName,
                                          java.lang.String memberName)
                                   throws FilterException
Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties.

Specified by:
getTreePathNodeList in interface OLAPMemberTreePathFactoryInterface
Parameters:
cubeName - the name of the OLAP cube to be searched
memberName - the unique member name of the target cube member
Returns:
a List of OLAPMemberTreeNodes defining the path from the root to the target node
Throws:
FilterException - in the event of a communications failure or any error with the metadata server

getTreePathNodeList

public java.util.List getTreePathNodeList(java.lang.String memberName)
                                   throws FilterException
Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member with the specified properties. The cube name is based on the root node of the tree.

Specified by:
getTreePathNodeList in interface OLAPMemberTreePathFactoryInterface
Parameters:
cubeName - the name of the OLAP cube to be searched
memberName - the unique member name of the target cube member
Returns:
a List of OLAPMemberTreeNodes defining the path from the root to the target node
Throws:
FilterException - in the event of a communications failure or any error with the metadata server

getTreePathNodeList

public java.util.List getTreePathNodeList(FilterItemInterface filterItem,
                                          FilterValueInterface filterValue)
                                   throws FilterException
Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member derived from the given parameters.

Specified by:
getTreePathNodeList in interface OLAPMemberTreePathFactoryInterface
Parameters:
filterItem - a FilterItemInterface representing a BIQ DataItem from the OLAP cube to be searched
filterValue - a FilterValueInterface representing the target member of an OLAP cube
Returns:
a List of OLAPMemberTreeNodes defining the path from the root to the target node
Throws:
FilterException - in the event of a communications failure or any error with the metadata server

getTreePathNodeList

public java.util.List getTreePathNodeList(FilterValueInterface filterValue)
                                   throws FilterException
Returns a List of the OLAPMemberTreeNodes in order from the root of the tree model to the target node representing the unique cube member derived from the given parameters.

Specified by:
getTreePathNodeList in interface OLAPMemberTreePathFactoryInterface
Parameters:
filterValue - a FilterValueInterface representing the target member of an OLAP cube
Returns:
a List of OLAPMemberTreeNodes defining the path from the root to the target node
Throws:
FilterException - in the event of a communications failure or any error with the metadata server



Copyright © 2009 SAS Institute Inc. All Rights Reserved.