1 13 package com.tonbeller.jpivot.xmla; 14 15 import java.util.ArrayList ; 16 import java.util.HashMap ; 17 import java.util.Map ; 18 19 import com.tonbeller.jpivot.olap.mdxparse.CompoundId; 20 import com.tonbeller.jpivot.olap.mdxparse.Exp; 21 import com.tonbeller.jpivot.olap.mdxparse.ExpVisitor; 22 import com.tonbeller.jpivot.olap.model.Dimension; 23 import com.tonbeller.jpivot.olap.model.Hierarchy; 24 import com.tonbeller.jpivot.olap.model.Visitor; 25 import com.tonbeller.jpivot.olap.query.MDXElement; 26 27 30 public class XMLA_Dimension implements Dimension, Exp, MDXElement { 31 32 private String name; 33 private String uniqueName; 34 private String caption; 35 private int ordinal; 36 private int type; 37 private int cardinality; 38 private String defaultHier; 39 private boolean isVirtual; 40 private boolean isReadWrite; 41 private int uniqueSettings; 42 private boolean isVisible; 43 private String description; 44 45 private ArrayList aHierarchies = new ArrayList (); 46 47 private Map props = new HashMap (); 49 public static final int MD_DIMTYPE_TIME = 1; 51 public static final int MD_DIMTYPE_MEASURE = 2; 52 public static final int MD_DIMTYPE_OTHER = 3; 53 54 57 public boolean isMeasure() { 58 return type == MD_DIMTYPE_MEASURE; 59 } 60 61 64 public boolean isTime() { 65 return type == MD_DIMTYPE_TIME; 66 } 67 68 public String getLabel() { 69 return caption; 70 } 71 72 75 public Hierarchy[] getHierarchies() { 76 return (Hierarchy[]) aHierarchies.toArray(new XMLA_Hierarchy[0]); 77 } 78 79 82 public void accept(Visitor visitor) { 83 visitor.visitDimension(this); 84 } 85 86 public Object getRootDecoree() { 87 return this; 88 } 89 90 94 public String getCaption() { 95 return caption; 96 } 97 98 102 public int getCardinality() { 103 return cardinality; 104 } 105 106 110 public String getDefaultHier() { 111 return defaultHier; 112 } 113 114 118 public boolean isReadWrite() { 119 return isReadWrite; 120 } 121 122 126 public boolean isVirtual() { 127 return isVirtual; 128 } 129 130 134 public boolean isVisible() { 135 return isVisible; 136 } 137 138 142 public String getName() { 143 return name; 144 } 145 146 150 public int getOrdinal() { 151 return ordinal; 152 } 153 154 158 public int getType() { 159 return type; 160 } 161 162 166 public String getUniqueName() { 167 return uniqueName; 168 } 169 170 174 public int getUniqueSettings() { 175 return uniqueSettings; 176 } 177 178 182 public void setCaption(String caption) { 183 this.caption = caption; 184 } 185 186 190 public void setCardinality(int cardinality) { 191 this.cardinality = cardinality; 192 } 193 194 198 public void setDefaultHier(String defaultHier) { 199 this.defaultHier = defaultHier; 200 } 201 202 206 public void setReadWrite(boolean isReadWrite) { 207 this.isReadWrite = isReadWrite; 208 } 209 210 214 public void setVirtual(boolean isVirtual) { 215 this.isVirtual = isVirtual; 216 } 217 218 222 public void setVisible(boolean isVisible) { 223 this.isVisible = isVisible; 224 } 225 226 230 public void setName(String name) { 231 this.name = name; 232 } 233 234 238 public void setOrdinal(int ordinal) { 239 this.ordinal = ordinal; 240 } 241 242 246 public void setType(int type) { 247 this.type = type; 248 } 249 250 254 public void setUniqueName(String uniqueName) { 255 this.uniqueName = uniqueName; 256 } 257 258 262 public void setUniqueSettings(int uniqueSettings) { 263 this.uniqueSettings = uniqueSettings; 264 } 265 266 270 public void addHier(Hierarchy hier) { 271 aHierarchies.add(hier); 272 } 273 274 278 public String toMdx() { 279 return uniqueName; 280 } 281 282 286 public Object clone() { 287 String str = uniqueName.substring(1, uniqueName.length() - 1); 288 String [] nameParts = new String [] { str }; 289 290 CompoundId clone = new CompoundId(nameParts[0], false); 291 return clone; 292 } 293 294 297 public Map getProps() { 298 return props; 299 } 300 301 304 public void addProp(XMLA_MemberProp prop) { 305 if (!props.containsKey(prop.getXmlTag())) { 306 props.put(prop.getXmlTag(), prop); 307 } 308 } 309 310 313 public XMLA_MemberProp getProp(String xmlTag) { 314 return (XMLA_MemberProp) props.get(xmlTag); 315 } 316 317 320 public void accept(ExpVisitor visitor) { 321 visitor.visitDimension(this); 322 } 323 324 } | Popular Tags |