|
Oracle® OLAP Java API Reference 10g Release 2 (10.2) B14348-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.olapi.data.source.CursorSpecification
An object that specifies characteristics of a Cursor
. A CursorSpecification
is created in the context of a CursorManagerSpecification
. When a DataProvider
creates a CursorManagerSpecification
for a Source
, one CursorSpecification
is created for the values of the elements of the Source
and one for each output of the Source
, if any, recursively; that is, if the output of the Source
is a Source
that itself has one or more outputs, then the CursorManagerSpecification
has a CursorSpecification
for the values of the output Source
and one for each of the outputs of that Source
.
After creating a CursorManagerSpecification
, an application can create a CursorManager
by passing the CursorManagerSpecification
to the createCursorManager
method of the DataProvider
. The application can then create a Cursor
by calling the createCursor
method of the CursorManager
. The structure of that Cursor
mirrors the structure of the CursorSpecification
objects of the CursorManagerSpecification
.
A CursorSpecification
can be a ValueCursorSpecification
, which represents the values of the Source
, or a CompoundCursorSpecification
, which represents a Source
with one or more outputs. For example, suppose an application has an MdmPrimaryDimension
that represents a list of products. The application gets a Source
from the MdmPrimaryDimension
and names it productDim
. The elements of productDim
have values that are String
objects. The application calls the createCursorManagerSpecification
method of a DataProvider
and passes productDim
to the method. The CursorManagerSpecification
returned by the method has only one CursorSpecification
, a ValueCursorSpecification
for the values of productDim
. That ValueCursorSpecification
is the root CursorSpecification
of the CursorManagerSpecification
.
A more complex example is a CursorManagerSpecification
created for a Source
that has outputs. Suppose the application has an MdmMeasure
that represents product units sold, and that measure has as inputs MdmPrimaryDimension
objects that represent products, customers, times, and sales channels. The application gets Source
objects for those measure and dimension objects, with the names units
, productDim
, customerDim
, timeDim
, and channelDim
. The application then joins those Source
objects to produce a Source
, unitsSold
, that has the values of the measure organized by the dimensions as outputs, as in the following:
Source unitsSold = units.join(productDim) .join(customerDim) .join(timeDim) .join(channelDim);
The application then calls the createCursorManagerSpecification
method of the DataProvider
and passes unitsSold
to it. The CursorManagerSpecification
returned by the method has the following CursorSpecification
objects:
CompoundCursorSpecification
for unitsSold
, which is the root CursorSpecification
for the CursorManagerSpecification
.ValueCursorSpecification
for the values of unitsSold
.ValueCursorSpecification
for the values of channelDim
.ValueCursorSpecification
for the values of timeDim
.ValueCursorSpecification
for the values of customerDim
.ValueCursorSpecification
for the values of productDim
.With the methods of a CursorSpecification
, an application can specify that it wants information such as the extent of the Cursor
, which is the total number of elements the Cursor
contains, or the position in a parent Cursor
at which a child Cursor
starts or ends. Calculating the extent or the starting or ending positions can take a lot of time and computing resources, so an application should only set the CursorSpecification
to do so when it needs the information.
An application can also set the default fetch size for a Cursor
by calling the setDefaultFetchSize
method of the CursorSpecification
for that Cursor
. The fetch size is the number of elements that a Cursor
retrieves during a single fetch from the data store. If the application sets the default fetch size on a CursorSpecification
, then it can then change the fetch size for the Cursor
by calling the setFetchSize
method of the Cursor
itself.
With other methods of a CursorSpecification
, an application can accept a CursorSpecificationVisitor
or retrieve the Source
for the CursorSpecification
. The Source
for a CursorSpecification
is the Source
that defines the data that the Cursor
retrieves from the data store. For example, if an application calls getSource
of the CompoundCursorSpecification
for allSalesAmounts
, from the example described above, then the Source
returned by the method is allSalesAmounts
. If the application calls the getSource
method of the ValueCursorSpecification
for timeDim
, then the Source
returned by the method is timeDim
.
The OLAP API provides the following methods for gaining access to a CursorSpecification
:
CursorManagerSpecification.getRootCursorSpecification()
CompoundCursorSpecification.getValueCursorSpecification()
CompoundCursorSpecification.getOutputs()
Continuing the example from above, the following gets the CursorSpecification
for timeDim
. Because the ArrayList
of outputs is zero-based, specifying element 1 of the list gets the second output.
CursorManagerSpecification cursorManagerSpecification = dataProvider.createCursorManagerSpecification(unitsSold); CompoundCursorSpecification root = (CompoundCursorSpecification) cursorManagerSpecification.getRootCursorSpecification(); CursorSpecification timeDimCursorSpecification = (CursorSpecification) (new ArrayList(root.getOutputs())).get(1);
Method Summary | |
abstract java.lang.Object |
acceptVisitor(CursorSpecificationVisitor visitor, java.lang.Object context) Calls the visitCursorSpecification method of the specified CursorSpecificationVisitor and passes that method this CursorSpecification and the specified context object. |
int |
getDefaultFetchSize() Gets the fetch size set as the default for this CursorSpecification . |
Source |
getSource() Gets the Source for this CursorSpecification . |
Transaction |
getTransaction() Gets the Transaction object for this CursorSpecification . |
boolean |
isExtentCalculationSpecified() Indicates whether the CursorSpecification is set to calculate the extent for the Cursor . |
boolean |
isParentEndCalculationSpecified() Indicates whether the CursorSpecification is set to calculate the ending position of the Cursor in the parent Cursor . |
boolean |
isParentStartCalculationSpecified() Indicates whether the CursorSpecification is set to calculate the starting position of the Cursor in the parent Cursor . |
void |
setDefaultFetchSize(int defaultFetchSize) Specifies a default fetch size for the Cursor . |
void |
setExtentCalculationSpecified(boolean b) Specifies whether to calculate the extent of the Cursor . |
void |
setParentEndCalculationSpecified(boolean b) Specifies whether to calculate the ending position of the Cursor in the parent Cursor . |
void |
setParentStartCalculationSpecified(boolean b) Specifies whether to calculate the starting position of the Cursor in the parent Cursor . |
void |
setTransaction(Transaction transaction) Specifies the Transaction object for this CursorSpecification . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public final Transaction getTransaction()
Transaction
object for this CursorSpecification
.Transaction
object for this CursorSpecification
.public final void setTransaction(Transaction transaction)
Transaction
object for this CursorSpecification
.transaction
- The Transaction
object for this CursorSpecification
.public abstract java.lang.Object acceptVisitor(CursorSpecificationVisitor visitor, java.lang.Object context)
visitCursorSpecification
method of the specified CursorSpecificationVisitor
and passes that method this CursorSpecification
and the specified context
object.visitor
- A CursorSpecificationVisitor
.context
- An Object
.Object
returned by the visitCursorSpecification
method.public final int getDefaultFetchSize()
CursorSpecification
.CursorSpecification
or Cursor.FETCH_SIZE_NOT_SPECIFIED
if setting the default fetch size is not specified for this CursorSpecification
.public final Source getSource()
Source
for this CursorSpecification
.Source
for this CursorSpecification
.public final boolean isExtentCalculationSpecified()
CursorSpecification
is set to calculate the extent for the Cursor
.true
if the CursorSpecification
is set to calculate the extent for the Cursor
and false otherwise.public final boolean isParentEndCalculationSpecified()
CursorSpecification
is set to calculate the ending position of the Cursor
in the parent Cursor
.true
if the CursorSpecification
is set to calculate the ending position of the Cursor
in the parent Cursor
and false otherwise.public final boolean isParentStartCalculationSpecified()
CursorSpecification
is set to calculate the starting position of the Cursor
in the parent Cursor
.true
if the CursorSpecification
is set to calculate the starting position of the Cursor
in the parent Cursor
and false otherwise.public final void setDefaultFetchSize(int defaultFetchSize) throws java.lang.IllegalArgumentException
Cursor
. The default fetch size must be greater than zero. The fetch size can only be set at one level in the hierarchy of a parent Cursor
and its children.defaultFetchSize
- The value to specify as the default fetch size.public final void setExtentCalculationSpecified(boolean b)
Cursor
. For a CompoundCursorSpecification
, calling this method causes Oracle OLAP to calculate the extents of all of the descendents of the CompoundCursorSpecification
.b
- true
to calculate the extent and false
otherwise.public final void setParentEndCalculationSpecified(boolean b)
Cursor
in the parent Cursor
.b
- true
to calculate the ending position of the Cursor
in the parent and false
otherwise.public final void setParentStartCalculationSpecified(boolean b)
Cursor
in the parent Cursor
.b
- true
to calculate the starting position of the Cursor
in the parent and false
otherwise.
|
Oracle® OLAP Java API Reference 10g Release 2 (10.2) B14348-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |