// Get the PRODUCT dimension.
MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
// Get the default hierarchy of the dimension and the parent attribute
// of the hierarchy.
MdmHierarchy mdmProdHier = mdmProdDim.getDefaultHierarchy();
MdmAttribute mdmProdParentAttr = mdmProdHier.getParentAttribute();
// Get the package attribute and the Source for it.
MdmAttribute mdmPackageAttr = getContext().getAttributeByName(mdmProdDim,
"PACKAGE_AW");
Source prodPkgAttr = mdmPackageAttr.getSource();
// Get the Source objects for the metadata objects.
StringSource prodDim = (StringSource) mdmProdDim.getSource();
StringSource prodHier = (StringSource) mdmProdHier.getSource();
Source prodParent = mdmProdParentAttr.getSource();
// Sort products hierarchically, parents first, in ascending order
// without using the package attribute.
Source result1 = prodHier.recursiveJoin(prodDim.value(),