// Get the MdmMeasure for units
MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");
// Get the Source for the measure
Source units = mdmUnits.getSource();
// Get the dimensions and their default hierarchies.
MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
MdmPrimaryDimension mdmCustDim = getMdmPrimaryDimension("CUSTOMER_AW");
MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
MdmPrimaryDimension mdmChanDim = getMdmPrimaryDimension("CHANNEL_AW");
MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
mdmProdDim.getDefaultHierarchy();
MdmLevelHierarchy mdmShipHier = (MdmLevelHierarchy)
mdmCustDim.getDefaultHierarchy();
MdmLevelHierarchy mdmCalendar = (MdmLevelHierarchy)
mdmTimeDim.getDefaultHierarchy();
MdmLevelHierarchy mdmChanHier = (MdmLevelHierarchy)
mdmChanDim.getDefaultHierarchy();
// Get the short description attribute for the dimensions, and the
// Source objects for the attributes.
MdmAttribute mdmProdShortDescr =
mdmProdDim.getShortValueDescriptionAttribute();
Source prodShortDescr = mdmProdShortDescr.getSource();
MdmAttribute mdmCustShortDescr =
mdmCustDim.getShortValueDescriptionAttribute();
Source custShortDescr = mdmCustShortDescr.getSource();
MdmAttribute mdmTimeShortDescr =
mdmTimeDim.getShortValueDescriptionAttribute();
Source timeShortDescr = mdmTimeShortDescr.getSource();
// Get the short description attribute for the channel dimension.
MdmAttribute mdmChanShortDescr =
mdmChanDim.getShortValueDescriptionAttribute();
Source chanShortDescr = mdmChanShortDescr.getSource();
// Get the Source objects for the default hierarchies of the dimensions
// of the measures
Source prodHier = mdmProdHier.getSource();
Source shipHier = mdmShipHier.getSource();
Source calendar = mdmCalendar.getSource();
Source chanHier = mdmChanHier.getSource();
// Select values from the hierarchies
Source prodSel = prodHier.join(prodHier.value(),
getExpressDataProvider().createListSource(
new String[]
{"PRODUCT_PRIMARY_AW::FAMILY_AW::4",
"PRODUCT_PRIMARY_AW::FAMILY_AW::5"}),
Source.COMPARISON_RULE_SELECT,
false);
Source custSel = shipHier.join(shipHier.value(),
getExpressDataProvider().createListSource(
new String[]
{"SHIPMENTS_AW::REGION_AW::9",
"SHIPMENTS_AW::REGION_AW::10"}),
Source.COMPARISON_RULE_SELECT,
false);
Source timeSel = calendar.join(calendar.value(),
getExpressDataProvider().createConstantSource(
"CALENDAR_YEAR_AW::YEAR_AW::4"),
Source.COMPARISON_RULE_SELECT,
false);
Source chanSel = chanHier.join(chanHier.value(),
getExpressDataProvider().createConstantSource(
"CHANNEL_PRIMARY_AW::CHANNEL_AW::4"),
Source.COMPARISON_RULE_SELECT,
false);
Source custSelByTime = custSel.join(timeSel,
getEmptySource(),
Source.COMPARISON_RULE_REMOVE,
true);
Source prodByCustByTime = prodSel.join(custSelByTime,
getEmptySource(),
Source.COMPARISON_RULE_REMOVE,
true);
Source selectedUnits = units.join(prodByCustByTime,
getEmptySource(),
Source.COMPARISON_RULE_REMOVE,
true)
.join(chanSel,
getEmptySource(),
Source.COMPARISON_RULE_REMOVE,
true);
prepareAndCommit();
getContext().displayResult(selectedUnits);
// Create Source objects that have the short description attributes
// as the type values and the dimension selection Source objects
// as outputs.
Source prodSelDescr = prodShortDescr.join(prodSel);
Source custSelDescr = custShortDescr.join(custSel);
Source timeSelDescr = timeShortDescr.join(timeSel);
Source chanSelDescr = chanShortDescr.join(chanSel);
// Recreate the query including the short descriptions
custSelByTime = custSelDescr.join(timeSelDescr,
getEmptySource(),
Source.COMPARISON_RULE_REMOVE,