Package oracle.olapi.data.source

Examples of oracle.olapi.data.source.Source


    MdmStandardDimension mdmProdStdDim =
                (MdmStandardDimension) getMdmPrimaryDimension("PRODUCT_AW");
    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
       
    // Get the Source for the Product dimension.
    Source prodStdDim = mdmProdStdDim.getSource();
       
    // Get the default hierarchies of the dimensions and the Source objects for
    // them.
    MdmLevelHierarchy mdmCalendar = (MdmLevelHierarchy)
                                     mdmTimeDim.getDefaultHierarchy();
    MdmLevelHierarchy mdmProdPrimary = (MdmLevelHierarchy)
                                     mdmProdStdDim.getDefaultHierarchy();
    StringSource calendar = (StringSource) mdmCalendar.getSource();
    StringSource prodHier = (StringSource) mdmProdPrimary.getSource();
       
    // Get the measures and the Source objects for them.
    MdmMeasure mdmUnitCost = getMdmMeasure("UNIT_COST_AW");
    MdmMeasure mdmUnitPrice = getMdmMeasure("UNIT_PRICE_AW");
       
    NumberSource unitCost = (NumberSource) mdmUnitCost.getSource();
    NumberSource unitPrice = (NumberSource) mdmUnitPrice.getSource();
   
    DataProvider dp = getContext().getDataProvider();
       
    // Get the placeholder Source for the Number data type.
    Source ph = dp.getFundamentalMetadataProvider().getNumberPlaceholder()
                                                   .getSource();
       
    // Create a Source that specifies the value to assign as the
    // value of a measure for the custom dimension member.
    Source calc = ((NumberSource)
                   (ph.join(prodHier, "PRODUCT_PRIMARY_AW::ITEM_AW::14")))
                  .plus(
                  (NumberSource)
                  (ph.join(prodHier, "PRODUCT_PRIMARY_AW::ITEM_AW::15")));
       
    // Get the level to which the dimension members belong.
    MdmLevel mdmItemLevel = getContext().getLevelByName(mdmProdPrimary,
                                                        "ITEM_AW");
       
    // Create the custom dimension member.
    MdmStandardMember mdmItem60 = mdmProdStdDim.createCustomMember(
                                                "60"// member local value
                                                 mdmItemLevel, // member level
                                                 "4",   // parent local value
                                                 calc, // calculation Source
                                                 10);   // precedence value
       
    // Select a set of Product member values.
    StringSource prodSel = prodHier.selectValues(
                               new String[]{"PRODUCT_PRIMARY_AW::ITEM_AW::14",
                                            "PRODUCT_PRIMARY_AW::ITEM_AW::15",
                                            "PRODUCT_PRIMARY_AW::ITEM_AW::60"});
                       
    // Produce a query that specifies the unit price and the unit cost for the
    // selected products and the specified month. The month does not appear
    // in the result.
    Source result = unitPrice.join(unitCost)
                             .join(prodSel)
                             .join(calendar, "CALENDAR_YEAR_AW::MONTH_AW::47");
                       
    // Prepare and commit the current Transaction.
    prepareAndCommit();
View Full Code Here


    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
   
    // Get the package attribute and the Source for it.   
    MdmAttribute mdmPackageAttr = getContext().getAttributeByName(mdmProdDim,
                                                                  "PACKAGE_AW");
    Source pkgAttr = mdmPackageAttr.getSource();
   
    // Get the default hierarchy for the dimension and the Source for it.
    MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
                                     mdmProdDim.getDefaultHierarchy();
    Source prodHier = mdmProdHier.getSource();
       
    // Get the short value description attribute and the Source for it.
    MdmAttribute mdmProdShortDescrAttr =
                              mdmProdDim.getShortValueDescriptionAttribute();
    Source prodShortDescrAttr = mdmProdShortDescrAttr.getSource();
       
    // Produce a Source that has a short description for each product.
    Source prodByShortDescr = prodShortDescrAttr.join(prodHier);
       
    // Produce a Source that has the package for each product.
    Source prodByPkg = pkgAttr.join(prodByShortDescr);
       
    // Prepare and commit the current Transaction, create a Cursor for the
    // Source, and display the values of the Cursor.
    prepareAndCommit();
    getContext().displayResult(prodByPkg);
View Full Code Here

    // Get the MdmMeasureDimension of the root MdmSchema, and the Source for it.
    MdmMeasureDimension mdmMeasDim = rootSchema.getMeasureDimension();
    StringSource measDim = (StringSource) mdmMeasDim.getSource();
       
    // Specify a calculation for the custom measure.
    Source calculation = unitPrice.minus(unitCost);
       
    // Create custom measure as a custom member of the MdmMeasureDimension.
    MdmMeasure mdmMarkup = mdmMeasDim.createCustomMeasure("MARKUP_AW",
                                                           rootSchema,
                                                           calculation,
                                                           10);
    // Set the short and long value descriptions.
    mdmMarkup.setShortDescription("UNIT_PRICE_AW MINUS UNIT_COST_AW");
    mdmMarkup.setDescription("Unit price minus unit cost.");
       
    // Produce a Source that specifies the values of the members of the
    // measure dimension.
    Source measDimSel = measDim.selectValues(new String[]
                                            {mdmMarkup.getValue(),
                                             mdmUnitCost.getValue(),
                                             mdmUnitPrice.getValue()});
                
    // Get the Source objects for the short value description attributes
    // of the Product and Time dimensions.
    Source timeShortDesc =
                    mdmTimeDim.getShortValueDescriptionAttribute().getSource();
    Source prodShortDesc =
                    mdmProdDim.getShortValueDescriptionAttribute().getSource();
                
    // Select members of the product and time hierarchies.
    StringSource prodSel =
                    prodHier.selectValue("PRODUCT_PRIMARY_AW::ITEM_AW::13");
    StringSource timeSel = calendarYear.selectValues(new String[]
                                           {"CALENDAR_YEAR_AW::MONTH_AW::43",
                                            "CALENDAR_YEAR_AW::MONTH_AW::44",
                                            "CALENDAR_YEAR_AW::MONTH_AW::45"});
                         
    // Produce a query that specifies the values of the members of the measure
    // dimesion for the specified product and times. Include the short
    // descriptions of the Product and Time dimension members.
    Source result = measDim.extract()
                           .join(measDimSel)
                           .join(timeShortDesc.join(timeSel))
                           .join(prodShortDesc.join(prodSel));
                         
    // Prepare and commit the current Transaction.
View Full Code Here

    // The storedMdmDim object is an MdmPrimaryDimension that is assigned in
    // the getSchemaInfo method. The getSource method of the MdmPrimaryDimension
    // gets the Source object for the MdmPrimaryDimension.
    showOutput("\nGetting the primary Source object for dimension " +
                storedMdmDim.getName() + ".");
    Source dimSource = storedMdmDim.getSource();
    showInfo("The ID of the Source for " + storedMdmDim.getName() + " is " +
             dimSource.getID() + ".\n");
  }
View Full Code Here

    // Create a SingleSelectionTemplate.
    // Get the MdmMeasure for the measure.
    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");

    // Get the Source for the measure.
    Source units = mdmUnits.getSource();

    // Get the MdmPrimaryDimension objects for the dimensions of the measure.
    MdmPrimaryDimension mdmCustDim = getMdmPrimaryDimension("CUSTOMER_AW");
    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    MdmPrimaryDimension mdmChanDim = getMdmPrimaryDimension("CHANNEL_AW");
    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");

    // Get the default hierarchy of the Product dimension.
    MdmHierarchy mdmProdHier = mdmProdDim.getDefaultHierarchy();

    // Get the StringSource for the hierarchy.
    StringSource prodHier = (StringSource) mdmProdHier.getSource();

    // Create a SingleSelectionTemplate to produce a Source that
    // represents the measure values specified by single members of each of
    // the dimensions of the measure other than the base dimension.
    SingleSelectionTemplate singleSelections =
                                     new SingleSelectionTemplate(units, dp);

    // Create MdmDimensionMemberInfo objects for single members of the
    // other dimensions of the measure.
    MdmDimensionMemberInfo timeMemInfo =
                new MdmDimensionMemberInfo(mdmTimeDim,
                                           "CALENDAR_YEAR_AW::YEAR_AW::4");
    MdmDimensionMemberInfo custMemInfo =
                new MdmDimensionMemberInfo(mdmCustDim,
                                           "SHIPMENTS_AW::REGION_AW::8");
    MdmDimensionMemberInfo chanMemInfo =
             new MdmDimensionMemberInfo(mdmChanDim,
                                        "CHANNEL_PRIMARY_AW::CHANNEL_AW::2");

    // Add the dimension member information objects to the
    // SingleSelectionTemplate.
    singleSelections.addDimMemberInfo(custMemInfo);
    singleSelections.addDimMemberInfo(chanMemInfo);
    singleSelections.addDimMemberInfo(timeMemInfo);

    println("Rolling Back a Transaction");

    // ***** Beginning of the Rolling Back a Transaction example *****
    // The current Transaction is a read Transaction, t1.
    // Create a TopBottomTemplate using a hierarchy of the Product dimension
    // as the base and dp as the DataProvider.
    TopBottomTemplate topNBottom = new TopBottomTemplate(prodHier, dp);

    // Changing the state of a Template requires a write Transaction, so a
    // write child Transaction, t2, is automatically started.
    topNBottom.setTopBottomType(TopBottomTemplate.TOP_BOTTOM_TYPE_TOP);
    topNBottom.setN(10);
    topNBottom.setCriterion(singleSelections.getSource());

    // Prepare and commit the Transaction t2.
    try
    {
      tp.prepareCurrentTransaction();
    }
    catch(NotCommittableException e)
    {
      println("Cannot commit the Transaction. " + e);
    }
    tp.commitCurrentTransaction();           //t2 disappears

    // The current Transaction is now t1.
    // Get the dynamic Source produced by the TopBottomTemplate.
    Source result = topNBottom.getSource();

    // Create a Cursor and display the results.
    println("\nThe current state of the TopBottomTemplate " +
            "\nproduces the following values:\n");
    getContext().displayTopBottomResult(result);
View Full Code Here

    println("Creating a Cube and Pivoting Its Edges");
       
    // Get the MdmMeasure for units.
    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");
    // Get the Source for the measure.
    Source units = mdmUnits.getSource();
       
    // Get the dimensions of the measure and the default hierarchies of
    // the dimensions.
       
    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
    MdmPrimaryDimension mdmChanDim = getMdmPrimaryDimension("CHANNEL_AW");
    MdmPrimaryDimension mdmCustDim = getMdmPrimaryDimension("CUSTOMER_AW");
       
    MdmLevelHierarchy mdmProdDefLvlHier = (MdmLevelHierarchy)
                                           mdmProdDim.getDefaultHierarchy();
       
    MdmLevelHierarchy mdmTimeDefLvlHier = (MdmLevelHierarchy)
                                           mdmTimeDim.getDefaultHierarchy();
       
    MdmLevelHierarchy mdmChanDefLvlHier = (MdmLevelHierarchy)
                                            mdmChanDim.getDefaultHierarchy();
       
    MdmLevelHierarchy mdmCustDefLvlHier = (MdmLevelHierarchy)
                                           mdmCustDim.getDefaultHierarchy();
       
    // Get the Source objects for the hierarchies.
    StringSource prodHier = (StringSource) mdmProdDefLvlHier.getSource();
    StringSource timeHier = (StringSource) mdmTimeDefLvlHier.getSource();
    StringSource chanHier = (StringSource) mdmChanDefLvlHier.getSource();
    StringSource custHier = (StringSource) mdmCustDefLvlHier.getSource();
       
    // Get the DataProvider.
    ExpressDataProvider dp = getExpressDataProvider();
       
    // 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();
       
    // Create Parameter objects with values from the CUSTOMER_AW and
    // PRODUCT_AW dimensions.
    StringParameter custParam =
                      new StringParameter(dp, "SHIPMENTS_AW::REGION_AW::9");
    StringParameter prodParam =
                new StringParameter(dp, "PRODUCT_PRIMARY_AW::FAMILY_AW::4");
       
    // Create parameterized Source objects for the default hierarchies of
    // the CUSTOMER_AW and PRODUCT_AW dimensions.
    StringSource custParamSrc = dp.createParameterizedSource(custParam);
    StringSource prodParamSrc = dp.createParameterizedSource(prodParam);
       
    // Create derived Source objects from the hierarchies, using the
    // parameterized Source objects as the comparison Source objects.
    Source paramCustSel = custHier.join(custHier.value(), custParamSrc);
    Source paramProdSel = prodHier.join(prodHier.value(), prodParamSrc);
       
    // Select elements from the other dimensions of the measure
    Source timeSel = timeHier.selectValues(new String[]
                                            {"CALENDAR_YEAR_AW::YEAR_AW::2",
                                             "CALENDAR_YEAR_AW::YEAR_AW::3",
                                             "CALENDAR_YEAR_AW::YEAR_AW::4"});
               
    Source chanSel = chanHier.selectValues(new String[]
                                       {"CHANNEL_PRIMARY_AW::CHANNEL_AW::2",
                                        "CHANNEL_PRIMARY_AW::CHANNEL_AW::3",
                                        "CHANNEL_PRIMARY_AW::CHANNEL_AW::4"});
                        
    // Join the dimension selections to the short description attributes
    // for the dimensions.
    Source columnEdge = chanSel.join(chanShortDescr);
    Source rowEdge = timeSel.join(timeShortDescr);
    Source page1 = paramProdSel.join(prodShortDescr);
    Source page2 = paramCustSel.join(custShortDescr);
                        
    // Join the dimension selections to the measure.
    Source cube = units.join(columnEdge)
                       .join(rowEdge)
                       .join(page2)
                       .join(page1);
                        
    // Prepare and commit the current Transaction.
View Full Code Here

    StringSource prodHier =  (StringSource) mdmProdHier.getSource();
       
    // Get one of the levels of the hierachy.
    MdmLevel mdmLevel = getContext().getLevelByName(mdmProdHier, "FAMILY_AW");
       
    Source levelSrc = mdmLevel.getSource();
       
    int pos = 5;
    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();
    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.
    Source levelSrcWithShortDescr = prodShortLabel.join(levelSrc);
       
    // Join the parent to the short description attribute.
    Source levelElementParentWithShortDescr =
                                      prodShortLabel.join(prodHier,
                                                          levelElementParent,
                                                          true);
       
    //Join the children to the short description attribute.
    Source levelElementChildrenWithShortDescr =
                                     prodShortLabel.join(levelElementChildren);
       
    //Join the ancestors to the short description attribute.
    Source levelElementAncsWithShortDescr =
                                     prodShortLabel.join(prodHier,
                                                         levelElementAncs,
                                                         true);
       
    // Prepare and commit the current Transaction.
View Full Code Here

    dp = getContext().getDataProvider();

    try
    {
      MdmMeasure mdmUnitPrice = getMdmMeasure("UNIT_PRICE_AW");
      Source unitPrice = mdmUnitPrice.getSource();

      MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
      MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
      MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
                                       mdmProdDim.getDefaultHierarchy();
      MdmLevelHierarchy mdmTimeHier = (MdmLevelHierarchy)
                                       mdmTimeDim.getDefaultHierarchy();

      // Get the Source for the hierarchy.
      StringSource prodHier = (StringSource) mdmProdHier.getSource();
      StringSource timeHier = (StringSource) mdmTimeHier.getSource();

      Source prodSel = prodHier.selectValues(new String[]
                                          {"PRODUCT_PRIMARY_AW::ITEM_AW::13",
                                           "PRODUCT_PRIMARY_AW::ITEM_AW::14",
                                           "PRODUCT_PRIMARY_AW::ITEM_AW::15"});

      Source timeSel = timeHier.selectValues(new String[]
                                          {"CALENDAR_YEAR_AW::MONTH_AW::55",
                                           "CALENDAR_YEAR_AW::MONTH_AW::58",
                                           "CALENDAR_YEAR_AW::MONTH_AW::61",
                                           "CALENDAR_YEAR_AW::MONTH_AW::64"});

      // The Creating the querySource Query example.
      Source querySource = creatingQuerySourceExample(unitPrice,
                                                      timeSel,
                                                      prodSel);

      // Informal example in the "Positions of a ValueCursor" section.
      productSelVal(prodSel);
View Full Code Here

    // See the run method for the code that produces the prodSel
    // and timeSel selections.
   
    // timeSel is the first output of querySource, prodSel is the second.
    Source querySource = unitPrice.join(timeSel).join(prodSel);
   
    prepareAndCommit();
    getContext().displayResult(querySource);
   
    return(querySource);
View Full Code Here

  {
    println("\nPositions in an Asymmetric Query");

    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");
    NumberSource units = (NumberSource) mdmUnits.getSource();
    Source unitsGT1 = units.gt(1);

    MdmPrimaryDimension mdmChanDim = getMdmPrimaryDimension("CHANNEL_AW");
    MdmPrimaryDimension mdmCustDim = getMdmPrimaryDimension("CUSTOMER_AW");
    MdmLevelHierarchy mdmChanHier = (MdmLevelHierarchy)
                                     mdmChanDim.getDefaultHierarchy();
    MdmLevelHierarchy mdmCustHier = (MdmLevelHierarchy)
                                     mdmCustDim.getDefaultHierarchy();

    StringSource chanHier = (StringSource) mdmChanHier.getSource();
    StringSource custHier = (StringSource) mdmCustHier.getSource();

    Source chanSel = chanHier.selectValue("CHANNEL_PRIMARY_AW::CHANNEL_AW::2");
    Source custSel = custHier.selectValue("SHIPMENTS_AW::SHIP_TO_AW::61");

    // Create the query
    Source querySource2 = prodSel.join(chanSel)
                                 .join(custSel)
                                 .join(timeSel)
                                 .select(units.gt(1));

    //Prepare and commit the current Transaction.
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.