Example #1
0
 public boolean dependsOn(Hierarchy hierarchy) {
   if (super.dependsOn(hierarchy)) {
     return true;
   }
   for (Type type : ((TupleType) tupleCalc.getType()).elementTypes) {
     // If the expression definitely includes the dimension (in this
     // case, that means it is a member of that dimension) then we
     // do not depend on the dimension. For example, the scalar value of
     //   ([Store].[USA], [Gender].[F])
     // does not depend on [Store].
     //
     // If the dimensionality of the expression is unknown, then the
     // expression MIGHT include the dimension, so to be safe we have to
     // say that it depends on the given dimension. For example,
     //   (Dimensions(3).CurrentMember.Parent, [Gender].[F])
     // may depend on [Store].
     if (type.usesHierarchy(hierarchy, true)) {
       return false;
     }
   }
   return true;
 }
 /**
  * Returns the hierarchies on a non-filter axis.
  *
  * @return List of hierarchies, never null
  */
 private List<Hierarchy> getHierarchiesNonFilter() {
   final Exp exp = queryAxis.getSet();
   if (exp == null) {
     return Collections.emptyList();
   }
   Type type = exp.getType();
   if (type instanceof SetType) {
     type = ((SetType) type).getElementType();
   }
   final MondrianOlap4jConnection olap4jConnection =
       cellSetMetaData.olap4jStatement.olap4jConnection;
   if (type instanceof TupleType) {
     final TupleType tupleType = (TupleType) type;
     List<Hierarchy> hierarchyList = new ArrayList<Hierarchy>();
     for (Type elementType : tupleType.elementTypes) {
       hierarchyList.add(olap4jConnection.toOlap4j(elementType.getHierarchy()));
     }
     return hierarchyList;
   } else {
     return Collections.singletonList((Hierarchy) olap4jConnection.toOlap4j(type.getHierarchy()));
   }
 }