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.Level; 20 import com.tonbeller.jpivot.olap.model.Visitor; 21 import com.tonbeller.jpivot.olap.query.MDXElement; 22 import com.tonbeller.tbutils.res.Resources; 23 24 27 public class MondrianHierarchy implements Hierarchy, MDXElement { 28 29 private mondrian.olap.Hierarchy monHierarchy; 30 private MondrianDimension dimension; 31 private ArrayList aLevels; 32 private MondrianModel model; 33 private Resources resources; 34 35 40 protected MondrianHierarchy( mondrian.olap.Hierarchy monHierarchy, 41 MondrianDimension dimension, MondrianModel model ) { 42 this.monHierarchy = monHierarchy; 43 this.dimension = dimension; 44 this.model = model; 45 this.resources = Resources.instance(model.getLocale(), MondrianHierarchy.class); 46 aLevels = new ArrayList (); 47 dimension.addHierarchy(this); 48 } 49 50 54 protected void addLevel(MondrianLevel level) { 55 aLevels.add(level); 56 } 57 58 59 62 public Dimension getDimension() { 63 return dimension; 64 } 65 66 69 public Level[] getLevels() { 70 return (Level[]) aLevels.toArray( new MondrianLevel[0] ); 71 } 72 73 public String getLabel() { 74 String label = monHierarchy.getCaption(); 75 return resources.getOptionalString(label, label); 76 } 77 78 81 public void accept(Visitor visitor) { 82 visitor.visitHierarchy(this); 83 } 84 85 89 public mondrian.olap.Hierarchy getMonHierarchy() { 90 return monHierarchy; 91 } 92 93 public Object getRootDecoree() { 94 return this; 95 } 96 97 101 public String getUniqueName() { 102 return monHierarchy.getUniqueName(); 103 } 104 public boolean hasAll() { 105 return monHierarchy.hasAll(); 106 } 107 } 108 | Popular Tags |