01: package com.calipso.reportgenerator.reportmanager;
02:
03: import com.calipso.reportgenerator.common.InfoException;
04: import java.util.Iterator;
05: import com.calipso.reportgenerator.reportcalculator.Pivot;
06: import com.calipso.reportgenerator.reportcalculator.DataTree;
07: import com.calipso.reportgenerator.common.ReportQuery;
08: import com.calipso.reportgenerator.common.ReportSpec;
09:
10: /**
11: * Representa los datos de un reporte de tipo estatico
12: */
13:
14: public class StaticReportData extends ReportData {
15: private DataTree dataTree;
16:
17: public Object[] getMetricValues(int[] ints, Object[] objects) {
18: return null;
19: }
20:
21: /**
22: * Inicializa una instancia de <code>StaticReportData</code>
23: * @param reportSpec
24: */
25: public StaticReportData(ReportSpec reportSpec) {
26: super (reportSpec);
27: dataTree = new DataTree();
28: dataTree.setDefinition(reportSpec);
29: }
30:
31: public Iterator valuesFor(int dimension, int[] previousDimensions,
32: Object[] values) {
33: return getDataTree().valuesFor(dimension, previousDimensions,
34: values);
35: }
36:
37: /**
38: * Retorna el iterador del <code>StaticReportData</code>
39: * @return
40: */
41: public ReportDataIterator iterator() {
42: return new StaticReportDataIterator(getDataTree().iterator());
43: }
44:
45: public Object[] measuresAtDimensionsValues(int[] dimensions,
46: Object[] values) {
47: return getDataTree().measuresAtDimensionsValues(dimensions,
48: values);
49: }
50:
51: /**
52: * Asigna la <code>StaticQuery</code> a la instancia de <code>DataTree</code>
53: * @param query
54: * @param pivot
55: * @throws InfoException
56: */
57: protected void doSetQuery(ReportQuery query, Pivot pivot)
58: throws InfoException {
59: getDataTree().setQuery(query.getStaticQuery());
60: pivot.fill(getDataTree());
61: }
62:
63: /**
64: * Devuelve el <code>DataTree</code> correspondiente al <code>StaticReportData</code>
65: * @return
66: */
67: public DataTree getDataTree() {
68: return dataTree;
69: }
70: }
|