ca.sqlpower.wabit.rs.olap
Class OlapUtils

java.lang.Object
  extended by ca.sqlpower.wabit.rs.olap.OlapUtils

public class OlapUtils
extends java.lang.Object

This is a class full of static helper methods to assist with the execution of olap queries

Author:
thomas

Method Summary
static org.olap4j.query.Query copyMDXQuery(org.olap4j.query.Query query)
          This method returns a deep copy of an MDX Query because there is no such method in the API.
static boolean isChild(org.olap4j.metadata.Member parent, org.olap4j.metadata.Member testForChildishness)
          Tests whether or not the given parent member has the other member as one of a direct child.
static boolean isDescendant(org.olap4j.metadata.Member parent, org.olap4j.metadata.Member testForDescendituitivitiness)
          Tests whether or not the given parent member has the other member as one of its descendants--either a direct child, or a child of a child, and so on.
static boolean isDescendantOrEqualTo(org.olap4j.metadata.Member parent, org.olap4j.metadata.Member testForEquidescendituitivitiness)
          Tests whether or not the given parent member is the same as or has the other member as one of its descendants--either a direct child, or a child of a child, and so on.
static OlapResultSet toResultSet(org.olap4j.CellSet cellSet)
          Creates and populates an OlapResultSet from the given CellSet, which must not be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isDescendant

public static boolean isDescendant(org.olap4j.metadata.Member parent,
                                   org.olap4j.metadata.Member testForDescendituitivitiness)
Tests whether or not the given parent member has the other member as one of its descendants--either a direct child, or a child of a child, and so on. Does not consider parent to be a descendant of itself, so in the case both arguments are equal, this method returns false.

Parameters:
parent - The parent member
testForDescendituitivitiness - The member to check if it has parent as an ancestor

isDescendantOrEqualTo

public static boolean isDescendantOrEqualTo(org.olap4j.metadata.Member parent,
                                            org.olap4j.metadata.Member testForEquidescendituitivitiness)
Tests whether or not the given parent member is the same as or has the other member as one of its descendants--either a direct child, or a child of a child, and so on.

Parameters:
parent - The parent member
testForDescendituitivitiness - The member to check if it is parent or has parent as an ancestor

isChild

public static boolean isChild(org.olap4j.metadata.Member parent,
                              org.olap4j.metadata.Member testForChildishness)
Tests whether or not the given parent member has the other member as one of a direct child. Does not consider parent to be a direct child of itself, so in the case both arguments are equal, this method returns false.

Parameters:
parent - The potential parent member
testForChildishness - The member to check if it has parent as its parent member
Returns:
True if testForChildishness is a direct child of parent. False otherwise.

copyMDXQuery

public static org.olap4j.query.Query copyMDXQuery(org.olap4j.query.Query query)
                                           throws java.sql.SQLException
This method returns a deep copy of an MDX Query because there is no such method in the API.

Parameters:
query - This is the Query that is being copied
Returns:
This returns the copied Query, it is a new copy that only shares Dimensions and Member
Throws:
java.sql.SQLException

toResultSet

public static OlapResultSet toResultSet(@Nonnull
                                        org.olap4j.CellSet cellSet)
Creates and populates an OlapResultSet from the given CellSet, which must not be null.

Parameters:
execute -
Returns:
Throws:
java.lang.RuntimeException - in the unlikely event that the OlapResultSet throws SQLException while it's being populated.
See Also:
OlapResultSet


Copyright © 2009. All Rights Reserved.