Permalink
Browse files

Add hierarchy structure.

  • Loading branch information...
1 parent 61bb4bd commit 7fa9028a6e1e725dfa88c0d4eee2bfe0a828ade1 Fernando Arbeiza committed with julianhyde Jan 22, 2013
@@ -1421,14 +1421,24 @@ public void handle(
stringElement(row, "ALL_MEMBER");
final String defaultMemberUniqueName =
stringElement(row, "DEFAULT_MEMBER");
+ final Integer structureCode = integerElement(row, "STRUCTURE");
+ Hierarchy.Structure structure = null;
+ if (structureCode != null) {
+ structure =
+ Hierarchy.Structure.DICTIONARY.forOrdinal(structureCode);
+ }
+ if (structure == null) {
+ structure = Hierarchy.Structure.FULLYBALANCED;
+ }
XmlaOlap4jHierarchy hierarchy = new XmlaOlap4jHierarchy(
context.getDimension(row),
hierarchyUniqueName,
hierarchyName,
hierarchyCaption,
description,
allMember != null,
- defaultMemberUniqueName);
+ defaultMemberUniqueName,
+ structure);
list.add(hierarchy);
cubeForCallback.hierarchiesByUname.put(
hierarchy.getUniqueName(),
@@ -38,6 +38,7 @@
final NamedList<XmlaOlap4jLevel> levels;
private final boolean all;
private final String defaultMemberUniqueName;
+ private final Structure structure;
XmlaOlap4jHierarchy(
XmlaOlap4jDimension olap4jDimension,
@@ -46,13 +47,16 @@
String caption,
String description,
boolean all,
- String defaultMemberUniqueName) throws OlapException
+ String defaultMemberUniqueName,
+ Structure structure) throws OlapException
{
super(uniqueName, name, caption, description);
assert olap4jDimension != null;
+ assert structure != null;
this.olap4jDimension = olap4jDimension;
this.all = all;
this.defaultMemberUniqueName = defaultMemberUniqueName;
+ this.structure = structure;
String[] hierarchyRestrictions = {
"CATALOG_NAME",
@@ -113,6 +117,10 @@ public Member getDefaultMember() throws OlapException {
return Olap4jUtil.cast(list);
}
+ public Structure getStructure() {
+ return structure;
+ }
+
public boolean equals(Object obj) {
return (obj instanceof XmlaOlap4jHierarchy)
&& this.uniqueName.equals(
@@ -71,7 +71,7 @@
Member getDefaultMember() throws OlapException;
/**
- * Returns the root member or members of this Dimension.
+ * Returns the root member or members of this <code>Hierarchy</code>.
*
* <p>If the dimension has an 'all' member, then this will be the sole
* root member.
@@ -91,6 +91,13 @@
*/
NamedList<Member> getRootMembers() throws OlapException;
+ /**
+ * Returns the structure of this <code>Hierarchy</code>.
+ *
+ * @return hierarchy structure, never null
+ */
+ Structure getStructure();
+
/** Source of a hierarchy. */
enum Origin implements XmlaConstant {
/**

0 comments on commit 7fa9028

Please sign in to comment.