Oracle® OLAP Java API Reference
10g Release 2 (10.2.0.4)

B14348-04

oracle.olapi.data.cursor
Interface CompoundCursor

All Superinterfaces:
Cursor

public interface CompoundCursor
extends Cursor

A Cursor for a Source that has outputs. A CompoundCursor has a child base ValueCursor, the elements of which have the values of the Source. A CompoundCursor also has one or more outputs, one for each output of the Source. The outputs of the CompoundCursor are child CompoundCursor or ValueCursor objects.

The order of the outputs of a CompoundCursor is determined by the order in which the outputs of the Source were specified. The value of the base ValueCursor at any position in a CompoundCursor is determined by the set of the values of the elements of the outputs specified by that position.

For example, in the following code unitPrice is the Source for an MdmMeasure, and prodHier and timeHier are StringSource objects for the default MdmLevelHierarchy objects for the Product and Time dimensions, which are the dimensions of the measure.

 Source prodSel = prodHier.selectValues(new String[]
                                        {"PRODUCT_PRIMARY_AW::ITEM_AW::40",
                                         "PRODUCT_PRIMARY_AW::ITEM_AW::41",
                                         "PRODUCT_PRIMARY_AW::ITEM_AW::42",
                                         "PRODUCT_PRIMARY_AW::ITEM_AW::45"});
 Source timeSel = timeHier.selectValues(new String[] 
                                        {"CALENDAR_YEAR_AW::MONTH_AW::36",
                                         "CALENDAR_YEAR_AW::MONTH_AW::48"});
 Source productPrice = unitPrice.join(prodSel).join(timeSel);
The productPrice Source specifies the price of the selected products on the selected months. It has the unitPrice values as element values, and it has prodSel and timeSel as outputs. The following code prepares and commits the current Transaction, and then creates a CursorManagerSpecification, a CursorManager, and finally a Cursor for productPrice. The tp object is the TransactionProvider in use and the dp object is the DataProvider.
 try
 {
   tp.prepareCurrentTransaction();
 }
 catch(NotCommittableException e)
 {
   println("Cannot prepare the Transaction for committing. " + e);
 }
 tp.commitCurrentTransaction();

 CursorManagerSpecification cmSpec =
                   dp.createCursorManagerSpecification(productPrice);
 SpecifiedCursorManager cursorManager = dp.createCursorManager(cmSpec);
 Cursor result = cursorManager.createCursor();
Because the productPrice has outputs, result is a CompoundCursor. The base ValueCursor of the CompoundCursor has the values from unitPrice that are specified by the set of the values of the outputs. The outputs of the CompoundCursor are two ValueCursor objects. The first output has the element values of timeSel and the second output has the element values of prodSel.

The following table is a display of the values of result, formatted into columns. The table shows the current value of each ValueCursor at each position of the CompoundCursor. The left column has the values of the ValueCursor for the first output, the middle column has values of the ValueCursor for the second output, and right column has the values of the base ValueCursor. The display contains only the local values of the dimensions, not the three-part unique values.

 Month  Item  Price
 -----  ----  -----
  36     40   67.13
  36     41   78.30
  36     42   78.85
  36     45   NA   
  48     40   63.88
  48     41   78.00
  48     42   79.54
  48     45   73.08
The following table shows the positions of the CompoundCursor and the child Cursor objects and the value at each ValueCursor position. The left column has the positions of the parent CompoundCursor. The second column from the left has the positions of the ValueCursor for timesSel and the values at those positions. The third column from the left has the positions of the ValueCursor for productsSel and the values at those positions. The right column has the positions of the base ValueCursor and the values at those positions.
 CompoundCursor      Output 1               Output 2       Base ValueCursor
 --------------  ------------------     ----------------   ----------------
    Position     Position     Value     Position   Value   Position   Value
    --------     --------     -----     --------   -----   --------   -----
       1            1          36          1        40        1       67.13
       2            1          36          2        41        1       78.30
       3            1          36          3        42        1       78.85
       4            1          36          4        45        1       NA   
       5            2          48          1        40        1       63.88
       6            2          48          2        41        1       78.00
       7            2          48          3        42        1       79.54
       8            2          48          4        45        1       73.08
In the example, each set of output values specifies only one unit price value. The base ValueCursor therefore has only one position for each set of output values.


Field Summary
 
Fields inherited from interface oracle.olapi.data.cursor.Cursor
FETCH_SIZE_NOT_SPECIFIED
 
Method Summary
 java.util.List getOutputs()
          Gets the outputs of the CompoundCursor.
 ValueCursor getValueCursor()
          Gets the base ValueCursor of the CompoundCursor.
 
Methods inherited from interface oracle.olapi.data.cursor.Cursor
getExtent, getFetchSize, getParentEnd, getParentStart, getPosition, getSource, next, setFetchSize, setPosition
 

Method Detail

getValueCursor

public ValueCursor getValueCursor()
Gets the base ValueCursor of the CompoundCursor. The base ValueCursor has the values of the Source for the CompoundCursor.

Returns:
The base ValueCursor of the CompoundCursor.

getOutputs

public java.util.List getOutputs()
Gets the outputs of the CompoundCursor. An output is a ValueCursor or a CompoundCursor. A CompoundCursor has one output for each output of the Source associated with it.

Returns:
A List whose elements are the outputs of this CompoundCursor.

Oracle® OLAP Java API Reference
10g Release 2 (10.2.0.4)

B14348-04

Copyright © 2002, 2007, Oracle. All rights reserved.