Package oracle.olapi.data.source

Examples of oracle.olapi.data.source.Source


    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(),
                                            prodHier.getDataType(),
                                            prodParent,
                                            Source.COMPARISON_RULE_ASCENDING);

    // Sort products hierarchically, parents first, in ascending order
    // by package attribute value with null values first.
    // Nulls first is the default, so this should this should produce
    // the same results as COMPARISON_RULE_ASCENDING.
    Source sortedHierNullsFirst =
          prodHier.recursiveJoin(prodPkgAttr,
                                 prodPkgAttr.getDataType(),
                                 prodParent,
                                 Source.COMPARISON_RULE_ASCENDING_NULLS_FIRST);
    Source result2 = prodPkgAttr.join(sortedHierNullsFirst);

    // Sort all products hierarchically, parents first, in ascending order
    // by package attribute value with null values first.
    Source sortedHierNullsLast =
          prodHier.recursiveJoin(prodPkgAttr,
                                 prodPkgAttr.getDataType(),
                                 prodParent,
                                 Source.COMPARISON_RULE_DESCENDING_NULLS_FIRST);

    Source result3 = prodPkgAttr.join(sortedHierNullsLast);

    prepareAndCommit();

    println("\nresult1, using COMPARISON_RULE_ASCENDING, without package attribute:");
    getContext().displayResult(result1);
View Full Code Here


    println("Getting the Share of Units Sold");
       
    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");
       
    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    Source prodDim = mdmProdDim.getSource();
       
    MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
                                       mdmProdDim.getDefaultHierarchy();
   
    // Get the Source for the default product hierarchy.
    StringSource prodHier = (StringSource) mdmProdHier.getSource();
       
    // Get the Source objects for the measure and for the default hierarchies
    // of the other dimensions.
    NumberSource units = (NumberSource) mdmUnits.getSource();
    StringSource custHier = (StringSource)
        getMdmPrimaryDimension("CUSTOMER_AW").getDefaultHierarchy().getSource();
    StringSource chanHier = (StringSource)
        getMdmPrimaryDimension("CHANNEL_AW").getDefaultHierarchy().getSource();
    StringSource timeHier = (StringSource)
        getMdmPrimaryDimension("TIME_AW").getDefaultHierarchy().getSource();
       
    Source totalProds =
           prodHier.selectValue("PRODUCT_PRIMARY_AW::TOTAL_PRODUCT_AW::1");
       
    MdmLevel mdmProdFamilies = getContext().getLevelByName(mdmProdHier,
                                                           "FAMILY_AW");
    Source prodFamilies = mdmProdFamilies.getSource();
   
    // Get the Source for the short value description attribute of the dimension.
    Source prodShortLabel = mdmProdDim.getShortValueDescriptionAttribute()
                                      .getSource();
       
    Source prodFamiliesShortDesc = prodShortLabel.join(prodFamilies);
       
    NumberSource totalUnits = (NumberSource) units.joinHidden(totalProds);
       
    Source productShare = units.div(totalUnits).times(100);
       
    Source result =
          //productShare.join(prodFamilies)
          productShare.join(prodFamiliesShortDesc)
                      .join(timeHier, "CALENDAR_YEAR_AW::YEAR_AW::4")
                      .join(chanHier, "CHANNEL_PRIMARY_AW::CHANNEL_AW::2")
                      .join(custHier, "SHIPMENTS_AW::TOTAL_CUSTOMER_AW::1");
       
    Source sortedResult = result.sortAscending();
   
    prepareAndCommit();
    println("The share of units sold by product family in ascending " +
            "order are:");
    //getContext().displayResult(result);
View Full Code Here

    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
                                     mdmProdDim.getDefaultHierarchy();
    StringSource prodHier = (StringSource) mdmProdHier.getSource();
    Source prodSel = prodHier.selectValue("PRODUCT_PRIMARY_AW::FAMILY_AW::5");

    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
    MdmLevelHierarchy mdmTimeHier = (MdmLevelHierarchy)
                                     mdmTimeDim.getDefaultHierarchy();
    StringSource timeHier = (StringSource) mdmTimeHier.getSource();

    MdmLevel mdmQuarterLevel = getContext().getLevelByName(mdmTimeHier,
                                                           "QUARTER_AW");
    Source quarterLevel = mdmQuarterLevel.getSource();

    NumberSource unitPriceLag4 = unitPrice.lag(mdmTimeHier, 4);
    Source measuresDim =
        getExpressDataProvider().createListSource(new Source[] {unitPrice,
                                                                unitPriceLag4});

    Source lagResult = measuresDim.extract()
                                  .join(measuresDim)
                                  .join(quarterLevel)
                                  .joinHidden(prodSel);

    prepareAndCommit();
View Full Code Here

TOP

Related Classes of oracle.olapi.data.source.Source

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.