1 13 14 package mondrian.olap; 15 16 import mondrian.resource.MondrianResource; 17 18 25 public abstract class HierarchyBase 26 extends OlapElementBase 27 implements Hierarchy { 28 29 protected final Dimension dimension; 30 40 protected final String subName; 41 protected final String name; 42 protected final String uniqueName; 43 protected String description; 44 protected Level[] levels; 45 protected final boolean hasAll; 46 protected String allMemberName; 47 protected String allLevelName; 48 49 protected HierarchyBase(Dimension dimension, 50 String subName, 51 boolean hasAll) { 52 this.dimension = dimension; 53 this.hasAll = hasAll; 54 setCaption(dimension.getCaption()); 55 56 this.subName = subName; 57 String name = dimension.getName(); 58 if (this.subName != null) { 59 this.name = name + "." + subName; 61 this.uniqueName = Util.makeFqName(this.name); 63 } else { 64 this.name = name; 66 this.uniqueName = dimension.getUniqueName(); 68 } 69 } 70 71 public String getUniqueName() { 73 return uniqueName; 74 } 75 76 public String getName() { 77 return name; 78 } 79 80 public String getQualifiedName() { 81 return MondrianResource.instance().MdxHierarchyName.str(getUniqueName()); 82 } 83 84 public abstract boolean isRagged(); 85 86 public String getDescription() { 87 return description; 88 } 89 90 public Dimension getDimension() { 91 return dimension; 92 } 93 94 public Level[] getLevels() { 95 return levels; 96 } 97 98 public Hierarchy getHierarchy() { 99 return this; 100 } 101 102 public boolean hasAll() { 103 return hasAll; 104 } 105 106 public boolean equals(OlapElement mdxElement) { 107 return (this == mdxElement); 110 } 111 112 public OlapElement lookupChild(SchemaReader schemaReader, String s) { 113 return lookupChild(schemaReader, s, MatchType.EXACT); 114 } 115 116 public OlapElement lookupChild( 117 SchemaReader schemaReader, String s, MatchType matchType) 118 { 119 OlapElement oe = Util.lookupHierarchyLevel(this, s); 120 if (oe == null) { 121 oe = Util.lookupHierarchyRootMember( 122 schemaReader, this, s, matchType); 123 } 124 if (getLogger().isDebugEnabled()) { 125 StringBuilder buf = new StringBuilder (64); 126 buf.append("HierarchyBase.lookupChild: "); 127 buf.append("name="); 128 buf.append(getName()); 129 buf.append(", childname="); 130 buf.append(s); 131 if (oe == null) { 132 buf.append(" returning null"); 133 } else { 134 buf.append(" returning elementname="+oe.getName()); 135 } 136 getLogger().debug(buf.toString()); 137 } 138 return oe; 139 } 140 141 public String getAllMemberName() { 142 return allMemberName; 143 } 144 } 145 146 | Popular Tags |