This sample demonstrates how to implement a custom QueryTool and how to use
it stand-alone with the thin crosstab. The implementation class (BIQueryToolServlet
)
inherits user login functionality from BIServlet
(sample 1). QueryTool
demonstrates how the view's query can be modified by applying simple conditions
such as "Select Cities where Sales are in top 10".
The modification of the View's Query is done when the QueryTool processes QueryTool.QUERY_EVENT
.
In method handleQueryEvent()
the QueryTool reads the following
event parameters:
QueryTool.DIMENSION_PARAMETER
QueryTool.HIERARCHY_PARAMETER
QueryTool.LEVEL_PARAMETER
QueryTool.OPERATOR_PARAMETER
QueryTool.NUMBER_PARAMETER
Based on the QueryTool.OPERATOR_PARAMETER
, the QueryTool creates
oracle.dss.selection.step.TopBottomStep
or oracle.dss.selection.step.MeasValStep
and then replaces the selection for the specified dimension with a new selection
that contains the created step.
Create a new TopBottomStep
(e.g. "Select Top 10 Products based
on Sales")
if (m_operator.equals(QueryTool.OPERATOR_TOP))
{
step = new TopBottomStep(m_dimension,
m_hierarchy, levels, m_measure, TopBottomStep.TOP, new Integer(m_number), false);
}
Create a new TopBottomStep
(e.g. "Select Bottom 10 Products based
on Sales")
else if (m_operator.equals(QueryTool.OPERATOR_BOTTOM))
{
step = new TopBottomStep(m_dimension, m_hierarchy, levels, m_measure,
TopBottomStep.BOTTOM, new Integer(m_number), false);
}
Create a new MeasValStep
(e.g. "Select Products where Sales >
1,000,000")
else if (m_operator.equals(QueryTool.OPERATOR_GREATER))
{
step = new
MeasValStep(m_dimension, m_measure, m_hierarchy, levels, MeasValStep.OP_GREATER,
new Float(m_number));
}
Create a new MeasValStep
(e.g. "Select Products where Sales <
1,000,000")
else if (m_operator.equals(QueryTool.OPERATOR_LESS))
{
step = new MeasValStep(m_dimension, m_measure, m_hierarchy, levels,
MeasValStep.OP_LESS, new Float(m_number));
}
To simplify the user interface, this sample does not provide the user with a way to fully qualify the Measure for the Query condition. Instead, the Step is initialized with the QDR for the first slice on the column edge of the Query.
After initializing the Step
, QueryTool creates a new Selection
for the specified dimension, adds the new Step
and replaces the
existing Selection
for that dimension on the Query:
Create a new selection for the specified dimension:
Selection selection
= new Selection(m_dimension);
Set the selected hierarchy on the selection.
selection.setHierarchy(m_hierarchy);
Add the new step to the selection.
selection.addStep(step);
Apply the new selection to the current Query.
query.applySelection(selection);
BIQueryToolServlet
extends BIServlet
and provides
implementation for the processRequest()
method, which is called
by the base class after a successful user login. This method renders the actual
HTML page that contains a crosstab and a QueryTool by executing the following
sequence of actions:
Ensures that the ThinCrosstab
and QueryTool
are
stored on the HTTP session and registered with ServletRequestHandler
(see initializeThinBeans()
).
Asks the ServletRequestHandler
to handle potential application
events (such as modifying the query of the view, drilling, paging, etc.)
Renders simple HTML and uses UIX components to display the ThinCrosstab
and the QueryTool
.
Copyright © 2004 Oracle Corporation.
All Rights Reserved. |