MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("MEDIA");
// MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("MEDIA");
MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
mdmProdDim.getDefaultHierarchy();
StringSource prodHier = (StringSource) mdmProdHier.getSource();
// Get one of the levels of the hierachy.
MdmLevel mdmLevel = getContext().getLevelByName(mdmProdHier, "MEDIA");
Source levelSrc = mdmLevel.getSource();
int pos = 1;
Source levelElement = levelSrc.at(pos);
// Use levelElement as the comparison to select a level value.
Source levelSel = prodHier.join(prodHier.value(), levelElement);
// Get the Source for the short label attribute of the dimension.
Source prodShortLabel = mdmProdDim.getShortValueDescriptionAttribute()
.getSource();
// Get the parent relation from the hierarchy.
MdmAttribute mdmProdHierParentAttr = mdmProdHier.getParentAttribute();
MdmAttribute mdmProdHierAncestAttr = mdmProdHier.getAncestorsAttribute();
Source prodHierParentAttr = mdmProdHierParentAttr.getSource();
// Get the ancestor relation from the hierarchy.
MdmAttribute mdmProdHierAncsAttr = mdmProdHier.getAncestorsAttribute();
Source prodHierAncsAttr = mdmProdHierAncsAttr.getSource();
// Get ancestors of the level element.
Source levelElementAncs = prodHierAncsAttr.join(prodHier, levelElement);
// Get the parent of the level element.
Source levelElementParent = prodHierParentAttr.join(prodHier, levelElement);
// Reverse the parent relation to get a children relation.
Source prodHierChildren = prodHier.join(prodHierParentAttr,
prodHier.value());
// Select the children of the specified level element.
Source levelElementChildren = prodHierChildren.join(prodHier, levelElement);
//Join the level to the short description attribute.