Package oracle.olapi.data.cursor

Examples of oracle.olapi.data.cursor.CompoundCursor


    // Create a Cursor for unitsForSelections.
    CursorManagerSpecification cursorMngrSpec =
                   dp.createCursorManagerSpecification(unitsForSelections);
    SpecifiedCursorManager cursorMngr =
                   dp.createCursorManager(cursorMngrSpec);
    CompoundCursor unitsForSelCursor =
                   (CompoundCursor) cursorMngr.createCursor();

    // Get the base ValueCursor.
    ValueCursor specifiedUnitsVals = unitsForSelCursor.getValueCursor();

    // Get the outputs.
    List outputs = unitsForSelCursor.getOutputs();
    ValueCursor chanSelVals = (ValueCursor) outputs.get(0);
    ValueCursor timeSelVals = (ValueCursor) outputs.get(1);
    ValueCursor custSelVals = (ValueCursor) outputs.get(2);
    ValueCursor prodSelVals = (ValueCursor) outputs.get(3);

    // You can now get the values from the ValueCursor objects.
    // When you have finished using the Cursor objects, close the
    // SpecifiedCursorManager.
    int i = 1;
    do
    {
      println(i + ": " +
              chanSelVals.getCurrentString() + ", " +
              timeSelVals.getCurrentString() + ", " +
              custSelVals.getCurrentString() + ", " +
              prodSelVals.getCurrentString() + ", " +
              specifiedUnitsVals.getCurrentValue());
      i++;
    }
    while(unitsForSelCursor.next());

    cursorMngr.close();

    // Create an ArrayList of the Source objects for use by other examples.
    ArrayList sourcesFromExample4 = new ArrayList();
View Full Code Here


    CursorManagerSpecification cursorMngrSpec =
            dp.createCursorManagerSpecification(unitPriceByMonth);
    SpecifiedCursorManager cursorMngr =
            dp.createCursorManager(cursorMngrSpec);
   
    CompoundCursor rootCursor = (CompoundCursor) cursorMngr.createCursor();

    // Determine a starting position and the number of rows to display.
    int start = 7;
    int numRows = 12;
   
    println("Month     Product     Unit Price");
    println("-----     -------     ----------");

    // Iterate through the specified positions of the root CompoundCursor.
    // Assume that the Cursor contains at least (start + numRows) positions.
    for(int pos = start; pos < start + numRows; pos++)
    {
      // Set the position of the root CompoundCursor.
      rootCursor.setPosition(pos);

      // Print the local values of the output and base ValueCursors.
      // The getLocalValue method gets the local value from the unique
      // value of a dimension element.
      String timeValue = ((ValueCursor)rootCursor.getOutputs().get(0))
                          .getCurrentString();
      String timeLocVal = getContext().getLocalValue(timeValue);
      String prodValue = ((ValueCursor)rootCursor.getOutputs().get(1))
                          .getCurrentString();
      String prodLocVal = getContext().getLocalValue(prodValue);
      Object price = rootCursor.getValueCursor().getCurrentValue();
      println("  " + timeLocVal + sp9 + prodLocVal + sp9 +  price);
    }
    cursorMngr.close();

    return unitPriceByMonth;
View Full Code Here

    // Create a Cursor for unitPriceByMonth.
    CursorManagerSpecification cursorMngrSpec =
            dp.createCursorManagerSpecification(unitPriceByMonth);
    SpecifiedCursorManager cursorMngr =
            dp.createCursorManager(cursorMngrSpec);
    CompoundCursor rootCursor = (CompoundCursor) cursorMngr.createCursor();

    // Get the outputs and the ValueCursor.
    List outputs = rootCursor.getOutputs();
    // The first output has the values of timeSel, the slower varying output.
    ValueCursor rowCursor = (ValueCursor) outputs.get(0);
    // The second output has the faster varying values of prodSel.
    ValueCursor columnCursor = (ValueCursor) outputs.get(1);
    // The base ValueCursor has the values from unitPrice.
    ValueCursor unitPriceValues = rootCursor.getValueCursor();

    // Display the values as a crosstab.
    println("\t        PRODUCT_AW");
    println("\t-----------------------");
    print("Month");
View Full Code Here

    // Create a Cursor for unitsForSelections.
    CursorManagerSpecification cursorMngrSpec =
            dp.createCursorManagerSpecification(unitsForSelections);
    SpecifiedCursorManager cursorMngr =
            dp.createCursorManager(cursorMngrSpec);
    CompoundCursor unitsForSelCursor = (CompoundCursor) cursorMngr.createCursor();

    // Display the results in a crosstab.
    getContext().printAsCrosstab(unitsForSelCursor);
   
    // For the printAsCrosstab method, see the CursorPrintWriter class.
View Full Code Here

    prodSelValCSpec.setParentStartCalculationSpecified(true);
    prodSelValCSpec.setParentEndCalculationSpecified(true);

    // Create the CursorManager and the Cursor.
    SpecifiedCursorManager cursorMngr = dp.createCursorManager(cursorMngrSpec);
    CompoundCursor rootCursor = (CompoundCursor) cursorMngr.createCursor();

    // Get the child Cursor objects.
    ValueCursor baseValCursor = rootCursor.getValueCursor();
    List outputs = rootCursor.getOutputs();
    ValueCursor chanSelVals = (ValueCursor) outputs.get(0);
    ValueCursor timeSelVals = (ValueCursor) outputs.get(1);
    ValueCursor custSelVals = (ValueCursor) outputs.get(2);
    ValueCursor prodSelVals = (ValueCursor) outputs.get(3);
   
    // Set the position of the root CompoundCursor.
    rootCursor.setPosition(15);

    // Get the values at the current position and determine the span
    // of the values of the time and product outputs.
    print(chanSelVals.getCurrentValue() + ", ");
    print(timeSelVals.getCurrentValue() + ", ");
View Full Code Here

  private static List<LazyDynaBean> convertDimensionShortDescCursor2List(Cursor rootCursor){
    List<LazyDynaBean> result = new ArrayList<LazyDynaBean>();
    do
      {
      if(rootCursor instanceof CompoundCursor){
        CompoundCursor compoundCursor = (CompoundCursor)rootCursor;
        LazyDynaBean ldb = null;
        ValueCursor valueCursor = compoundCursor.getValueCursor();
        if (valueCursor.hasCurrentValue()) {
          ldb = new LazyDynaBean();
          ldb.set("text", valueCursor.getCurrentValue());
        }
        
        List<Cursor> oList = compoundCursor.getOutputs();
        for(int i=0;i<oList.size();i++){
          Cursor cursor = oList.get(i);
          if(cursor instanceof ValueCursor){
            valueCursor = (ValueCursor)cursor;
            if(valueCursor.hasCurrentValue()){
View Full Code Here

  private static List<LazyDynaBean> convertCursor2List(Cursor rootCursor,List<String> dimNames,String measureName){
    List<LazyDynaBean> result = new ArrayList<LazyDynaBean>();
    do
      {
      if(rootCursor instanceof CompoundCursor){
        CompoundCursor compoundcursor = (CompoundCursor)rootCursor;
        LazyDynaBean ldb = null;
        ValueCursor valueCursor = compoundcursor.getValueCursor();
        if (valueCursor.hasCurrentValue()) {
          ldb = new LazyDynaBean();
          ldb.set("value", valueCursor.getCurrentValue());
          ldb.set("valueID", measureName);
        }else{
          ldb = new LazyDynaBean();
          ldb.set("value", 0);
          ldb.set("valueID", measureName);
//          continue;
        }
        
        List<Cursor> oList = compoundcursor.getOutputs();
        if(oList!=null&&dimNames!=null&&oList.size()==dimNames.size()){
          for(int i=0;i<oList.size();i++){
            Cursor cursor = oList.get(i);
            if(cursor instanceof CompoundCursor){
              CompoundCursor compoundCursor = (CompoundCursor)cursor;
              setBeanAttribute(ldb,dimNames.get(i),compoundCursor);
            }
          }
        }
        result.add(ldb);
View Full Code Here

                        
    // Create a Cursor for the query.
    CursorManagerSpecification cMngrSpec =
                                 dp.createCursorManagerSpecification(cube);
    SpecifiedCursorManager  spCMngr = dp.createCursorManager(cMngrSpec);
    CompoundCursor cubeCursor = (CompoundCursor) spCMngr.createCursor();
    getContext().displayCursorAsCrosstab(cubeCursor);
                        
    // Change the customer parameter value.
    custParam.setValue("SHIPMENTS_AW::REGION_AW::10");
                        
    // Reset the Cursor position to 1.
    cubeCursor.setPosition(1);
    println();
    getContext().displayCursorAsCrosstab(cubeCursor);
                        
    // Pivot the column and row edges.
    columnEdge = timeSel.join(timeShortDescr);
    rowEdge = chanSel.join(chanShortDescr);
                        
    // Join the dimension selections to the measure.
    cube = units.join(columnEdge)
                .join(rowEdge)
                .join(page2)
                .join(page1);
                        
    prepareAndCommit();
                        
    // Create another Cursor.
    cMngrSpec = dp.createCursorManagerSpecification(cube);
    spCMngr = dp.createCursorManager(cMngrSpec);
    cubeCursor = (CompoundCursor) spCMngr.createCursor();
    getContext().displayCursorAsCrosstab(cubeCursor);
                        
    // Change the product parameter value.
    prodParam.setValue("PRODUCT_PRIMARY_AW::FAMILY_AW::5");
                        
    // Reset the Cursor position to 1
    cubeCursor.setPosition(1);
    println();
    getContext().displayCursorAsCrosstab(cubeCursor);
   
  }
View Full Code Here

  private void settingTheCCPosAndGettingTheCurrentVals(Cursor queryCursor)
  {
    println("\nSetting the CompoundCursor Position and Getting the " +
            "Current Values");

    CompoundCursor rootCursor = (CompoundCursor) queryCursor;
    ValueCursor baseValueCursor = rootCursor.getValueCursor();
    List outputs = rootCursor.getOutputs();
    ValueCursor output1 = (ValueCursor) outputs.get(0);
    ValueCursor output2 = (ValueCursor) outputs.get(1);
    int pos = 5;
    rootCursor.setPosition(pos);
    println("CompoundCursor position set to " + pos + ".");
    println("The current position of the CompoundCursor is " +
             rootCursor.getPosition() + ".");
    println("Output 1 position is " + output1.getPosition() +
            ", value = " + output1.getCurrentValue());
    println("Output 2 position is " + output2.getPosition() +
            ", value = " + output2.getCurrentValue());
    println("VC position is " + baseValueCursor.getPosition() +
View Full Code Here

    CursorManager cursorManager =
                        dp.createCursorManager(cursorMngrSpec);
    Cursor queryCursor2 = cursorManager.createCursor();

    // Get the ValueCursor and the outputs.
    CompoundCursor rootCursor = (CompoundCursor) queryCursor2;
    ValueCursor baseValueCursor = rootCursor.getValueCursor();
    List outputs = rootCursor.getOutputs();
    ValueCursor output1 = (ValueCursor) outputs.get(0);

    String sp6 = "      ";
    String sp7 = sp6 + " ";
    String sp13 = sp6 + sp7;

    // Get the positions and values and display them.
    println("CompoundCursor Output ValueCursor" + "    ValueCursor");
    println("  position      position | value  position | value");
    do
    {
      println(sp6 + rootCursor.getPosition() + // sp6 is 6 spaces
              sp13 + output1.getPosition() + // sp13 is 13 spaces
              sp7 + getLocalValue(output1.getCurrentString()) + // sp7 is 7 spaces
              sp7 + baseValueCursor.getPosition() +
              sp7 + getLocalValue(baseValueCursor.getCurrentString()));
    }
View Full Code Here

TOP

Related Classes of oracle.olapi.data.cursor.CompoundCursor

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.