1 13 package com.tonbeller.jpivot.mondrian; 14 15 import java.util.ArrayList ; 16 17 import com.tonbeller.jpivot.olap.model.Dimension; 18 import com.tonbeller.jpivot.olap.model.Hierarchy; 19 import com.tonbeller.jpivot.olap.model.Visitor; 20 import com.tonbeller.jpivot.olap.query.MDXElement; 21 import com.tonbeller.tbutils.res.Resources; 22 23 26 public class MondrianDimension implements Dimension, MDXElement { 27 28 private mondrian.olap.Dimension monDimension = null; 29 private ArrayList aHierarchies; 30 MondrianModel model; 31 Resources resources; 32 33 protected MondrianDimension(mondrian.olap.Dimension monDimension, MondrianModel model) { 34 this.monDimension = monDimension; 35 this.model = model; 36 aHierarchies = new ArrayList (); 37 resources = Resources.instance(model.getLocale(), MondrianDimension.class); 38 } 39 40 44 protected void addHierarchy(MondrianHierarchy hierarchy) { 45 aHierarchies.add(hierarchy); 46 } 47 48 51 public Hierarchy[] getHierarchies() { 52 return (Hierarchy[]) aHierarchies.toArray(new MondrianHierarchy[0]); 53 } 54 55 58 public boolean isTime() { 59 return monDimension.getDimensionType() == mondrian.olap.DimensionType.TimeDimension; 60 } 61 62 65 public boolean isMeasure() { 66 return monDimension.isMeasures(); 67 } 68 69 public String getLabel() { 70 String label = monDimension.getCaption(); 71 return resources.getOptionalString(label, label); 72 } 73 74 77 public void accept(Visitor visitor) { 78 visitor.visitDimension(this); 79 } 80 81 public Object getRootDecoree() { 82 return this; 83 } 84 85 89 public String getUniqueName() { 90 return monDimension.getUniqueName(); 91 } 92 93 96 public mondrian.olap.Dimension getMonDimension() { 97 return monDimension; 98 } 99 100 } | Popular Tags |