Oracle OLAP Java API Reference
10g Release 1 (10.1)

B10994-01

oracle.olapi.data.source
Class Template

java.lang.Object
  |
  +--oracle.olapi.data.source.Template

public abstract class Template
extends java.lang.Object

The basis for creating a Source that an application can dynamically change. An application can use a Template to turn the selections made by an end user into Source objects.

A Template has the following component objects:

The components work together as follows:

The application can use the Source produced by the Template in creating a Cursor to fetch the data defined by the Source. It can also use the Source in creating another Source.

The application can use Source objects produced by different Template objects in the process of creating a Source that represents a complex query. The application can change the selection of data for any one of the Template objects that comprise the complex query. Since the DynamicDefinition that gets the Source for a Template is a proxy, the application does not have to recreate all of the component Source objects to produce a Source for the complex query that includes the new selection. Instead, the application just calls the getSource method on the DynamicDefinition for the Template that produces the complex query, and the current state of the changed Template component is used in rebuilding the query.

As an example of using Template objects, suppose an application lets an end user do the following:

The data that the user has selected is the ten products that have the highest total sales amounts of those sold through the direct channel to customers from San Francisco in the first quarter of 2000 during a televised promotion.

Suppose the application can use the following objects:

The constructor methods for the SingleSelectionsTemplate and the TopBottomTemplate both do the following:

The constructor for the TopBottomTemplate then looks like the following:

public class TopBottomTemplate(DataProvider dataProvider)
  {
  super(new TopBottomTemplateState(),
        dataProvider);
  TopBottomTemplateGenerator topBottomTemplateGenerator =
        new TopBottomTemplateGenerator(dataProvider);
  _definition = createDynamicDefinition(topBottomTemplateGenerator)
  }

Along with a DataProvider, the SingleSelectionsTemplate constructor has as an input value a Source that represents the measure.

The Template subclasses also have a method, called getSource, that calls the getSource method on the saved DynamicDefinition and returns the Source for the Template. After receiving the selections from the end user, the application does the following:

Suppose that the end user decides to change the single value selection for the customers dimension from "San Francisco" to "Buffalo". The application receives the new selection, and then does the following:

Note that the application does not need to call the getSource method on the SingleSelectionsTemplate. The current state for that Template, with the "Buffalo" selection, is used in the process of generating the Source for the TopBottomTemplate. The application does not need to repeat all of the other steps in producing either of the Template objects.

See Also:
DynamicDefinition, MetadataState, SourceGenerator, TransactionProvider

Constructor Summary
protected Template(MetadataState initialState, DataProvider dataProvider)
          Creates a new Template.

 

Method Summary
protected  DynamicDefinition createDynamicDefinition(SourceGenerator sourceGenerator)
          Creates a DynamicDefinition that acts as a proxy for the SourceDefinition that is immutably paired to the Source generated by the SourceGenerator.
protected  MetadataState getCurrentState()
          Gets the current state for this Template.
protected  MetadataState getCurrentStateForRead()
          Gets the current state for this Template.
protected  MetadataState getCurrentStateForWrite()
          Gets the current state for this Template.
 DataProvider getDataProvider()
          Gets the DataProvider for this Template.
protected  void setCurrentState(MetadataState state)
          Specifies a state as the current state for this Template.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Template

protected Template(MetadataState initialState,
DataProvider dataProvider)
            throws TransactionTypeUnavailableException,
TransactionInactiveException
Creates a new Template.
Parameters:
initialState - The MetadataState to use with this Template.
dataProvider - A DataProvider for internal use by the Template.
Method Detail

createDynamicDefinition

protected DynamicDefinition createDynamicDefinition(SourceGenerator sourceGenerator)
Creates a DynamicDefinition that acts as a proxy for the SourceDefinition that is immutably paired to the Source generated by the SourceGenerator.
Parameters:
sourceGenerator - The SourceGenerator that generates the Source produced by the current state of this Template.
Returns:
A DynamicDefinition for accessing the Source produced by this Template.

getCurrentState

protected MetadataState getCurrentState()
                                 throws TransactionalObjectInvalidException,
TransactionTypeUnavailableException,
TransactionInactiveException
Gets the current state for this Template.
Returns:
The current state for this Template.

getCurrentStateForRead

protected MetadataState getCurrentStateForRead()
                                        throws TransactionalObjectInvalidException,
TransactionTypeUnavailableException,
TransactionInactiveException
Gets the current state for this Template. Do not modify the state returned by this method; use it only for read operations.
Returns:
The current state for this Template.

getCurrentStateForWrite

protected MetadataState getCurrentStateForWrite()
                                         throws TransactionalObjectInvalidException,
TransactionTypeUnavailableException,
TransactionInactiveException
Gets the current state for this Template. The returned state is a clone of the actual state, so you can modify it. If you modify it, then you must reset the state by passing it to the setCurrentState method.
Returns:
The current state for this Template.

getDataProvider

public DataProvider getDataProvider()
Gets the DataProvider for this Template.
Returns:
The DataProvider with which this Template was constructed.

setCurrentState

protected void setCurrentState(MetadataState state)
                        throws CursorLockException,
WriteLockException,
TransactionTypeUnavailableException,
TransactionInactiveException
Specifies a state as the current state for this Template.
Parameters:
state - The state to specify as the current state for this Template.

Oracle OLAP Java API Reference
10g Release 1 (10.1)

B10994-01

Copyright © 2002, 2003, Oracle. All Rights Reserved.