Oracle Business Intelligence Beans Sample

Drill Out in a JSP Application

Overview

This sample demonstrates how to drill out from a Crosstab displayed in a JSP:

Code Highlights

The following section provides a walkthrough and explanations of the code highlights.

The following code fragment associates the drill out images with the Crosstab:

ThinCrosstab crosstab = (ThinCrosstab)pres1.getView();
crosstab.setGraphicImagePath(0, "drillOut/info.gif");
crosstab.setGraphicImagePath(1, "drillOut/graph.gif");
crosstab.setGraphicImagePath(2, "drillOut/detail.gif");

The following code fragment sets the image and tooltip for the row header drill out:

ViewStyle rowViewStyle = crosstab.getRowHeader().getViewStyle();
rowViewStyle.setGraphicImageIndex(0);
rowViewStyle.setGraphicImageTooltip("Search for Maps");

The following code fragment sets the image and tooltip for the data body drill out to a related Graph:

ViewStyle dataViewStyle = new ViewStyle();
dataViewStyle.setGraphicImageIndex(1);
dataViewStyle.setGraphicImageTooltip("Show Related Graph");

The following code fragment specifies that the drill out icons should appear in the 17" LCD Monitor column in the Crosstab data body. This is specified using the DiscriminatorRule and a Qualifying Data Reference (QDR).
For more information, please consult the BI Beans Help Topic "How Rules Work".

ViewStyle dataViewStyle = new ViewStyle();
QDR qdr = new QDR();
qdr.addDimMemberPair(PRODUCT_ID, "14");

Create a QDR discriminator based on this QDR:

QDRDiscriminator qdrDisc = new QDRDiscriminator(qdr, QDRDiscriminator.SUPERSET);

Tell the RuleManager to use this rule when displaying the image in the Crosstab:

RuleManager ruleManager = (RuleManager)crosstab.getGridViewDatabodyStyleManager();
Vector ruleBundles = new Vector();
RuleBundle bundle = new RuleBundle();
bundle.addRule(new DiscriminatorRule(qdrDisc, dataViewStyle));
ruleBundles.addElement(bundle);
ruleManager.setBundles(crosstab, ruleBundles);

The following code fragment constructs the drill-out URL for the icon displayed in the Crosstab row header:

crosstab.setDrillOutCallback(new DrillOutCallback() {
public String getHeaderDrillOutURI(ThinGridView gridView, int edge, int layer, int slice)
{

Get the header label from the DataAccess:

String geographyLabel = (String)gridView.getModel().getDataAccess().getSliceLabel(edge, slice, MetadataMap.METADATA_LONGLABEL);

Construct a URL that will open a new window with the results of a Google search "Map of 'Geography'":

return ("javascript: window.open(" + "'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=map%20of%20" + geographyLabel + "','','status=yes, width=500,height=500,scrollbars=yes,resizable=yes'); void('');");
}

The following code fragment constructs the drill-out URL for the icon displayed in the Crosstab cell:

public String getDataDrillOutURI(ThinGridView gridView, int row, int column)
{

Get the current Product and Geography member from the cell QDR:

QDR qdr = gridView.getModel().getDataAccess().getValueQDR(row, column, DataAccess.QDR_WITH_PAGE);
String geography = qdr.getDimMember(GEOGRAPHY_ID).toString();
String product = qdr.getDimMember(PRODUCT_ID).toString();

Pass the Product and Geography members to the popup JSP page that will display a Graph for the selected Product and Geography:

return ("javascript: window.open('" + GRAPH_POPUP_PAGE + "?GEOGRAPHY=" + geography + "&PRODUCT=" + product + "','','status=yes, width=800,height=400,scrollbars=yes,resizable=yes'); void('');");

How To Run

In JDeveloper, expand the bibeans workspace and the jsp project. Right-click on BIDrillOutHome.jsp and select Run from the popup menu.

When the crosstab appears, click on the icons in the row header cells to drill to a URL outside of the application (a Google search URL). Click on the icons in the 17" LCD Monitor column to display a new JSP page with a Graph displaying the data for row and column of the clicked cell. Click on the icons in the 18" LCD Monitor column to display a JSP page with detail from relational table in the CS_OLAP schema.


Copyright © 2004 Oracle Corporation.
All Rights Reserved.