1 package com.calipso.reportgenerator.reportmanager; 2 3 import com.calipso.reportgenerator.reportcalculator.Cube; 4 import com.calipso.reportgenerator.reportcalculator.Pivot; 5 import com.calipso.reportgenerator.reportcalculator.CubeQuery; 6 import com.calipso.reportgenerator.common.ReportQuery; 7 import com.calipso.reportgenerator.common.ReportSpec; 8 import com.calipso.reportgenerator.common.InfoException; 9 10 import java.util.Iterator ; 11 import java.util.Set ; 12 13 16 public class CubeReportData extends ReportData { 17 private Cube cube; 18 19 23 public CubeReportData(ReportSpec reportSpec){ 24 super(reportSpec); 25 cube = new Cube(); 26 cube.setDefinition(reportSpec); 27 } 28 29 33 protected Cube getCube() { 34 return cube; 35 } 36 37 public Iterator valuesFor(int dimension, int[] previousDimensions, Object [] values) { 38 return getCube().valuesFor(dimension, previousDimensions, values); 39 } 40 41 45 public ReportDataIterator iterator() { 46 return new CubeReportDataIterator(getCube().iterator()); 47 } 48 49 public Object [] measuresAtDimensionsValues(int[] dimensions, Object [] values) { 50 return getCube().measuresAtDimensionsValues(dimensions, values); 51 } 52 53 59 protected void doSetQuery(ReportQuery query, Pivot pivot) throws InfoException { 60 CubeQuery oldQuery = getCube().getQuery(); 61 CubeQuery newQuery = query.getCubeQuery(); 62 boolean eqvQuery = newQuery.equivalentQuery(oldQuery); 63 getCube().setQuery(newQuery); 64 if (!eqvQuery) { 65 pivot.fill(getCube()); 66 } 67 } 68 69 75 public Set [] getDimensionValues() { 76 return getCube().getDimensionValues(); 77 } 78 79 public Object [] getMetricValues(int[] groupingDimensionsIndexArray, Object [] values){ 80 return getCube().getMetricsValuesAt(groupingDimensionsIndexArray, values); 81 } 82 83 public Set getDimensionValues(int index) throws InfoException { 84 return getCube().getDimensionValues(index); 85 } 86 87 } 88 | Popular Tags |