<!--
 * BIDrillOutGraphPopup.jsp
 *
 * Copyright © 1994-2004, Oracle. All rights reserved. Oracle grants
 * you ("Licensee") a non-exclusive, royalty-free, worldwide license to use,
 * modify and redistribute this software in source and binary code form, provided
 * that (i) this copyright notice and license appear on all copies of the
 * software; (ii) Licensee does not utilize the software in a manner disparaging
 * to Oracle; and (iii) Licensee does not utilize the software in a manner that
 * violates the terms of any Licensee agreement with Oracle.
 -->
<%@ taglib uri="http://xmlns.oracle.com/bibeans/jsp" prefix="orabi" %>
<%@ page contentType="text/html;charset=windows-1252"%>

<%-- Imports --%>
<%@ page import="oracle.dss.dataSource.client.QueryClient" %>
<%@ page import="oracle.dss.selection.Selection" %>
<%@ page import="oracle.dss.selection.step.MemberStep" %>
<%@ page import="oracle.dss.thin.beans.dataView.ThinDataviewCommon" %>
<%@ page import="oracle.dss.thin.beans.dataView.Presentation"%>

<%-- Constants --%>
<%! public static final String PRODUCT_ID = "MDM!D_CS_OLAP.SHAWPRODUCTS"; %> 
<%! public static final String GEOGRAPHY_ID = "MDM!D_CS_OLAP.SHAWGEOGRAPHIES"; %>
<%! public static final String PRODUCT_STANDARD_HIERARCHY_ID = "MDM!D_CS_OLAP.SHAWPRODUCTS.PRODUCTS"; %> 
<%! public static final String GEOGRAPHY_STANDARD_HIERARCHY_ID = "MDM!D_CS_OLAP.SHAWGEOGRAPHIES.STANDARD"; %>
<%! public static final String PRODUCT_LEVEL_ID = "MDM!D_CS_OLAP.SHAWPRODUCTS.PRODUCTS.L.PRODUCT"; %> 
<%! public static final String GEOGRAPHY_LEVEL_ID = "MDM!D_CS_OLAP.SHAWGEOGRAPHIES.STANDARD.L.COUNTRY"; %>

<%-- Start synchronization of the BI tags --%>
<% synchronized(session){ %>
<orabi:BIThinSession id="BIThinSession1"  configuration="/catalogOLAPConfig1.xml" >
<orabi:Presentation id="salesGraph" location="SampleCatalog/Applications/Samples/Reports/SalesGraph" pagingControlVisible="false" imageHeight="550" imageWidth="550"/>
</orabi:BIThinSession>
<%
// Get the Product and Geography members from the URL 
String product = request.getParameter("PRODUCT");
String geography = request.getParameter("GEOGRAPHY");

if (product != null && geography != null)
{
  // Update the Product selection
  Selection prodSel = new Selection(PRODUCT_ID);
  prodSel.setHierarchy(PRODUCT_STANDARD_HIERARCHY_ID);
  MemberStep prodMS = new MemberStep(PRODUCT_ID);
  prodMS.setHierarchy(PRODUCT_STANDARD_HIERARCHY_ID);
  prodMS.addMember(product, PRODUCT_LEVEL_ID);
  prodSel.addStep(prodMS);

  // Update the Geography selection
  Selection geogSel = new Selection(GEOGRAPHY_ID);
  geogSel.setHierarchy(GEOGRAPHY_STANDARD_HIERARCHY_ID);
  MemberStep geogMS = new MemberStep(GEOGRAPHY_ID);
  geogMS.setHierarchy(GEOGRAPHY_STANDARD_HIERARCHY_ID);
  geogMS.addMember(geography, GEOGRAPHY_LEVEL_ID);
  geogSel.addStep(geogMS);

  try
  {
    // Retrieve the query from the Graph and change the Product and Geography selections
    Presentation salesGraph = (Presentation)pageContext.findAttribute("salesGraph");
    ThinDataviewCommon graph = salesGraph.getView();
    QueryClient query = (QueryClient)graph.getDataSource();
    query.applySelections(new Selection[] {prodSel, geogSel}); 
  }
  catch (Exception e)
  {
    e.printStackTrace();
  }
}
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>
Sales Details
</title>
</head>
<orabi:BIBody>
<form name="BIForm" method="POST"  action="BIDrillOutGraphPopup.jsp" >
<orabi:InitBITags parentForm="BIForm"/>
<!-- Insert your Business Intelligence tags here -->
<orabi:Render parentForm="BIForm" targetId="salesGraph"/>

<%-- The InsertHiddenFields tag adds state fields to the parent form tag --%>
<orabi:InsertHiddenFields parentForm="BIForm"  biThinSessionId="BIThinSession1" />
</form>
</orabi:BIBody>
</html>
<% } %>
<%-- End synchronization of the BI tags --%>

