Oracle® Fusion Middleware Developer's Guide for Oracle Business Intelligence Publisher (Oracle Fusion Applications Edition) 11g Release 1 (11.1.1) Part Number E26385-03 |
|
|
PDF · Mobi · ePub |
This chapter describes how to add a BI Publisher report to an Oracle Application Development Framework (ADF) application using Oracle JDeveloper.
It includes the following sections:
Section 10.1, "Including Oracle BI Publisher Reports in ADF Applications"
Section 10.3, "Adding BI Publisher Content to an ADF Project"
Section 10.6, "Passing Parameters from the Application Page"
Note:
This chapter assumes familiarity with Oracle Application Development Framework (ADF) and Oracle JDeveloper. For more information about these see:
Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework
Oracle JDeveloper 11g Online Help
BI Publisher provides an integration with Oracle Application Development Framework (ADF) that enables you to embed a BI Publisher report in an application (JSF) page. At runtime, your application sends a web service request to the BI Publisher server to run a report in the BI Publisher catalog and retrieve the output to display in your application page. The data for your report can be generated by the BI Publisher data engine, or you can push data from another source to the BI Publisher report formatting engine. The integration also supports passing parameters from your application page back to the BI Publisher server.
To facilitate development of your application, BI Publisher provides an extension to JDeveloper. The extension enables you to drag and drop a report region to your page and establish the connection between this region and the BI Publisher server. The extension also enables you to define aspects of the report format and to set properties for the region.
This integration is illustrated in Figure 10-1.
As shown in the figure, during design time, the BI Publisher extension establishes the connection between your page and the BI Publisher server and enables you to set properties for your report region. After deploying your application, at run time, the ADF application uses a web service to run and retrieve the BI Publisher report back to your page.
To enable communication between your application and the BI Publisher web service, define a policy using Oracle Web Services Policy Manager (OWSM).
Prerequisites
Prerequisites of this integration include:
Oracle JDeveloper 11.1.1.6 or 11.1.1.7.
BI Publisher and your application server are configured to use Oracle Fusion Middleware Security with Oracle Web Services Policy Manager.
BI Publisher and your application server are configured to use the same single sign-on server.
Limitations
Limitations of this integration include:
BI Publisher's interactive output type is not supported.
Oracle Fusion Middleware Security is the only security model supported.
BI Publisher Trial Edition does not support this integration.
Download the BI Publisher extension for JDeveloper, BI Publisher ADF Components, from one of the following locations:
Oracle Extensions for Oracle JDeveloper Update Center
http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/131167.xml
Oracle BI Publisher Downloads page on the Oracle Technology Network:
http://www.oracle.com/technetwork/middleware/bi-publisher/downloads/index.html
Save the zip file to a local directory. Use the JDeveloper Check for Updates wizard available from the Help menu. For the update Source, choose Install From Local File and select the extension file from the saved location.
After you install the BI Publisher extension you can create a project that includes a BI Publisher report region. The following procedures describe how to add BI Publisher content to an ADF project:
Section 10.3.2, "Adding a BI Publisher Region to the JSF Page"
Section 10.3.3, "Configuring Connection to the BI Publisher Server"
Section 10.3.4, "Setting Properties for the BI Publisher Region"
To display the BI Publisher options, add the BI Publisher technology scope to your project.
In Oracle JDeveloper, go to the Projects Pane and right-click the project to which you want to add the technology scopes and select Project Properties.
Select Technology Scope.
In the Available Technologies list, select BI Publisher as shown in Figure 10-2:
Click the right shuttle button to add BI Publisher and its dependent technologies to your project. Dependent technologies are moved together. Figure 10-3 shows the results of this action.
Click Finish.
The BI Publisher region must reside on a JSF page. To add a JSF page to your project:
Right-click your project and select New.
From the Gallery dialog, on the Categories pane, under Web Tier, select JSF.
From the items presented in the right pane, select JSF Page, as shown in Figure 10-4.
On the Create JSF Page dialog, enter a name for your JSF page. Oracle recommends selecting Create as XML Document to create an XML-based JSP document (extension .jspx
).
From the Component Palette list, select BI Publisher, as shown in Figure 10-6.
Drag and drop the BI Publisher Region component from the palette to the page.
Once the BI Publisher Region is dropped to the JSPX page, the Insert BI Publisher Region dialog, shown in Figure 10-7, prompts you to enter a region ID for the BI Publisher Region. The region ID must be unique and must not include the underscore "_" character.
Click OK. When you insert the BI Publisher region notice the following:
A placeholder image displays in the BI Publisher region of your page.
The BI Publisher configuration file, /WEB-INF/xmlp-client-config.xml
is created. Click Refresh on the Projects pane if it does not display immediately.
The Property Inspector presents the BI Publisher region properties when the BI Publisher region is selected.
Figure 10-8 shows these items:
In the Property Inspector, under the Appearance region, enter the report region Width and Height in px to specify the size of the report region in your application page. For example 1000 px and 800 px. No defaults are assigned for height and width, so ensure that you set these fields.
To establish a connection to the BI Publisher server, update the xmlp-client-config.xml
file under Project > Web Content > WEB-INF with the connection information as follows:
Double-click xmlp-client-config.xml to open the file for editing.
Figure 10-9 shows the sample xmlp-client-config.xml file.
Update the properties (keys) as shown in the following example. Add the properties not found in the default file.
The sample xmlp-client-config.xml file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>BIP Server Information</comment> <entry key="bipuri">http://example.com:7001/xmlpserver</entry> <entry key="sso.bipuri">http://example.com:7001/xmlpserver</entry> <entry key="username">username</entry> <entry key="policy">oracle/wss_username_token_client_policy</entry> </properties>
bipuri - enter the URL for the BI Publisher server. This may be behind a firewall. For example: http://hostname.com:7001/xmlpserver
sso.bipuri - enter the external SSO-enabled BI Publisher URL, which is accessible by a client browser. In Oracle Fusion Applications Business Intelligence domains this property is already configured. For other implementations, you must enter this property.
username - enter the secure user name to connect to BI Publisher. This user is the authenticated user used to connect from your application to BI Publisher.
policy- enter the OWSM web service security policy to use when connecting to the BI Publisher web service. See Section 10.4, "Configuring a Security Policy" for more information.
The following properties are available in the Property Inspector:
Table 10-1 Common Properties
Property | Description |
---|---|
Id |
The unique ID for the BI Publisher region. You assign this ID when you insert the BI Publisher region to your page. The ID must not contain spaces. |
Report Path |
The path to the report in the BI Publisher catalog. Reports have the extension ".xdo". Begin the path from the first level beneath "Shared Folders," but do not include "Shared Folders." For example: "/Samples/1.+Overview/Balance+Letter+Report.xdo" |
Rendered |
The control to show or hide the BI Publisher region when the page is rendered. The default is true (show). |
Table 10-2 Advanced Properties
Property | Description |
---|---|
Layout Name |
The layout from the report definition to apply to the report data. For example, "My Layout". If you do not specify a value here the default layout from the report definition is used. |
OutputFormat |
Sets the default output format. See Table 10-4 for the list of valid values. If you do not specify a value here the default output format from the report definition is used. |
Parameters |
To pass parameters from your application page to the BI Publisher report, use this property to specify the backing bean that captures the parameter values. Use the Expression Builder to populate this field. For example: #{UIBackingBean.parameters} See Section 10.6, "Passing Parameters from the Application Page" for information. |
ReportData |
If your report uses a push data model, use this property to specify the backing bean that contains the method that defines the report data location. Use the Expression Builder to populate this field. For example: #{UIBackingBean.reportData} See Section 10.7, "Using a Push Data Model" for more information. |
Locale |
Enter a default locale format using the ISO language code-country code combination, for example en-US. |
Table 10-3 Appearance Properties
Property | Description |
---|---|
Width |
Sets the report region width. Enter the value in pixels, for example, 1000 px. |
Height |
Sets the report region height. Enter the value in pixels, for example, 800 px. |
RenderActionPanel |
Controls whether to show or hide the report viewer action panel. The default is true. Note that if you set this to false, you must set renderReportOnLoad to true. |
RenderFormatList |
Controls whether to show or hide the output Format List. The default is true. |
RenderLocaleList |
Controls whether to show or hide the Locale List. The default is true. |
RenderReportOnLoad |
When set to true, the report is generated when the ADF page is launched. The default is true. |
Table 10-4 Valid Values for OutputFormat
Output Format | Value to Enter for OutputFormat Property | Template Types That Can Generate This Output Format |
---|---|---|
Interactive |
N/A |
Not supported |
HTML |
html |
BI Publisher, RTF, XSL Stylesheet (FO) |
|
|
BI Publisher, RTF, PDF, Flash, XSL Stylesheet (FO) |
RTF |
rtf |
BI Publisher, RTF, XSL Stylesheet (FO) |
Excel (mhtml) |
excel |
BI Publisher, RTF, Excel, XSL Stylesheet (FO) |
Excel (html) |
excel2000 |
BI Publisher, RTF, Excel, XSL Stylesheet (FO) |
Excel (*.xlsx) |
xlsx |
BI Publisher, RTF, XSL Stylesheet (FO) |
PowerPoint (mhtml) |
ppt |
BI Publisher, RTF, XSL Stylesheet (FO) |
PowerPoint (.*pptx) |
pptx |
BI Publisher, RTF, XSL Stylesheet (FO) |
MHTML |
mhtml |
BI Publisher, RTF, Flash, XSL Stylesheet (FO) |
PDF/A |
pdfa |
BI Publisher, RTF, XSL Stylesheet (FO) |
PDF/X |
pdfx |
BI Publisher, RTF, XSL Stylesheet (FO) |
Zipped PDFs |
pdfz |
BI Publisher, RTF, PDF, XSL Stylesheet (FO) |
FO Formatted XML |
xslfo |
BI Publisher, RTF, XSL Stylesheet (FO) |
Data (XML) |
xml |
BI Publisher, RTF, PDF, Excel, Flash, XSL Stylesheet (FO), Etext, XSL Stylesheet (HTML XML/Text) |
Data (CSV) |
csv |
BI Publisher, RTF, PDF, Excel, Flash, XSL Stylesheet (FO), XSL Stylesheet (HTML XML/Text), Etext |
XML |
xml |
XSL Stylesheet (HTML XML/Text) |
Text |
text |
XSL Stylesheet (HTML XML/Text), Etext |
Flash |
flash |
Flash |
For your application to run securely you must ensure that both server-side and client-side web service security policies are configured. In Enterprise installs of Business Intelligence, the server-side policies may be set up by provisioning scripts; in these cases you only configure the client-side service policy.
For more information about the Oracle WebLogic Server web service policies, see "Using Oracle Web Services Manager Security Policies" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.
Once the server-side policy is defined and attached as a global policy or a local policy, you enable it on the client-side by updating the xmlp-server-config.xml
file.
Note:
In a provisioned Oracle Fusion Applications environment the tasks in this section are not required because authentication is configured by the provisioning scripts.
For standalone environments, SSO must be set up and the credentials for login must be identical on the server side and the client side or the user will be challenged for credentials to log in to BI Publisher.
If your environment already includes a global policy or a local policy attached to the BI Publisher web service you do not need to add a policy. Use this procedure to verify the policy on the server side.
To view or set up the server policy:
Log in to Oracle Fusion Middleware Control. The URL is typically: http://hostname.domain:port/em
Open the home page for the server instance where BI Publisher is installed. In simple installations this is the AdminServer.
From the home page menu select Web Services as shown in Figure 10-10.
On the Web Services page, select the BI Publisher (bipublisher(11.1.1)) service PublicReportWSService as shown in Figure 10-11.
In the detail page for the web service, attached global policies display in the Global Policy table. Local policies display in the Directly Attached table. If a policy is already attached, proceed to Section 10.4.2, "Configuring the Client-Side Service Policy."
If there are no policies attached, attach a local (directly attached) policy by clicking Attach/Detach.
From the Available Policies table, select the policy to attach to the BI Publisher web service and click Attach. For example, oracle/wss_saml_or_username_token_service_policy
.
Click OK then restart the BI Publisher application.
Proceed to Section 10.4.2, "Configuring the Client-Side Service Policy."
Configure the client-side service policy by making the appropriate entries in the xmlp-client-config.xml
file.
On your client:
Navigate to the xmlp-client-config.xml
in your project under Project > Web Content > WEB-INF.
To the properties listing, add the entry key="policy" and enter the client policy name, for example:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>BIP Server Information</comment> <entry key="bipuri">http://example.com:7001/xmlpserver</entry> <entry key="sso.bipuri">http://example.com:7001/xmlpserver</entry> <entry key="username">username</entry> <entry key="policy">oracle/wss_username_token_client_policy</entry> </properties>
To deploy and run the application, first copy the required libraries to the client where JDeveloper is installed and then follow the deployment steps.
Copy Libraries
Ensure that Oracle Business Intelligence Publisher shared libraries are installed on your target WebLogic Server instance.
oracle.xdo.runtime: $
MW_HOME
/jdeveloper/xdo/lib/xdoruntime.ea
r
oracle.xdo.webapp: $
MW_HOME
/jdeveloper/xdo/lib/xdowebapp.war
When the shared libraries are installed, you can see them in the WebLogic Server console as shown in Figure 10-13.
Deploying the Application
To deploy and run the application:
From Project Properties, click Deployment, click New and enter a value for the J2EE application name. Figure 10-14 shows the Create Deployment Profile dialog.
Click WEB-INF/lib. BI Publisher Runtime does not have to be included so long as weblogic.xml and weblogic-application.xml are properly configured. Figure 10-15 shows libraries selected for deployment.
Add a shared library reference to weblogic.xml
and weblogic-application.xml
as shown in Figure 10-16 and Figure 10-17.
From the JDeveloper menu, select Run > Start Server Instance. Do not run the JSPX page directly.
Right-click the application and select Deploy - (your BIP ADF Application name) - to IntegratedWLSConnection as shown in Figure 10-18. Make sure the BIP ADF Application deployment profile has your J2EE application name (webapp21 in this example) selected on Application Assembly.
The deployment completed message displays in the Log window.
Open your browser and enter http://<hostname>:<port>/j2eeWebAppName/faces/report.jspx
in the address field. When the page launches, the contents display according to the settings you defined for RenderActionPanel, RenderFormatList, RenderLocaleList, and RenderReportOnLoad.
Figure 10-19 shows an example display when RenderActionPanel, RenderFormatList, and RenderLocaleList are set to true and RenderReportOnLoad is set to false. The Template list, Output Format list, and Locale list display and can be updated by the user. To render the report, the user must click Go.
Click Go. Your report displays, as shown in Figure 10-20.
You can pass parameters entered from your application page to the report using a backing bean. The BIP region tag must define the parameters property and bind it to the backing bean method as shown:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:xdo="http://xmlns.oracle.com/xdo/faces">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:form id="f1">
<p>
<af:inputText label="Employee ID" id="it1"
binding="#{UIBackingBean.empId}"/>
</p>
<p>
?[34m|
</p>
<p>
<af:separator id="s1"/>
</p>
<xdo:BIPRegion id="bipregion1" reportId="/Samples/Overview/Balance+Letter+Report.xdo"
width="1000px" height="800px"
parameters="#{UIBackingBean.parameters}" reportData=""/>
<f:facet name="second"/>
</af:form>
</af:document>
</f:view>
</jsp:root>
Specify the backing bean in the Parameters property of the Property Inspector. See Table 10-2, "Advanced Properties" for more information.
Some reports require XML data from a source other than a BI Publisher data model. For this requirement, you can push data to the BI Publisher server to use as input for your report. For this scenario, store the data in a location that is accessible by your application and create a backing bean that defines the getter method to retrieve the report data from its stored location. You still define the Report Path, Layout Name and other properties for the report as defined on the BI Publisher server.
The BIPRegion
tag must define the reportData
property for the tag, and bind it to the backing bean method. The following sample code shows this binding:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:xdo="http://xmlns.oracle.com/xdo/faces">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:form id="f1">
<xdo:BIPRegion id="id3"
reportId="/Samples/Overview/Balance+Letter+Report.xdo"
width="1000px" height="800px"
reportData="#{UIBackingBean.reportData}"/>
</af:form>
</af:document>
</f:view>
</jsp:root>
The following code sample shows the UIBackingBean
class referenced in the previous sample:
package fusionApp; import java.io.RandomAccessFile; import java.util.Hashtable; import java.util.Properties; import oracle.adf.view.rich.component.rich.input.RichInputText; public class UIBeackingBean { private RichInputText empId; private Properties mParameters; private byte[] reportData; public UIBeackingBean() { mParameters = new Properties(); reportData = null; } public void setEmpId(RichInputText empId) { this.empId = empId; } public RichInputText getEmpId() { return empId; } public Hashtable getParameters() { if(empId != null && empId.getValue() != null) { mParameters.put("userid", new String[]{empId.getValue().toString()}); String[] values = (String[])mParameters.get("userid"); System.out.println("getParameters() is called : " + values[0]); } return mParameters; } public byte[] getReportData() { String dataFile = "/tmp/reportData.xml"; try { RandomAccessFile raf = new RandomAccessFile(dataFile, "r"); reportData= new byte[(int)raf.length()]; raf.read(reportData); raf.close(); //write this to temp java.io.FileOutputStream outStream = new java.io.FileOutputStream("/tmp/output_reportData"); outStream.write(reportData); outStream.close(); } catch (Exception e) { System.out.println("Error reading file : " + e.getMessage()); } return reportData; } }
To define a push data model:
Create a backing bean class that defines the getter method that retrieves your data from its stored location.
In JDeveloper, create the BIP Region for your page and specify all properties for the report that you wish to run on the BI Publisher server (Report Path, Layout Name, Output Format, and so on).
In the Property Inspector, for the ReportData property, enter the expression that defines the variable to pass to the backing bean method to call the appropriate getter method to retrieve the report data from its stored location. Use the Expression Builder to build the unified expression language (EL) syntax.
Depending on the type of report you are running you may need to make other settings for your reports to run as expected.
This section contains the following topics:
To ensure that all the output types can be successfully generated from your page, add the MIME-type mappings to the web.xml
file. Typically you only need to add the MIME-type mappings for Excel output.
To add the MIME-type mappings:
Double-click the Project web.xml
file to open it for editing.
Expand the MIME mappings region.
Click Add.
In the Property Inspector, enter the following:
extension - (Required) Enter the file name extension of the document type you want to map to a particular MIME type for your web application. For example, pdf. This field corresponds to the <extension> tag of the <mime-mapping> subelement.
mime-type - (Required) Enter the document MIME type that you want to map to the specified file name extension. For example, application/pdf for Adobe's Portable Document Format. This field corresponds to the <mime-type> tag of the <mime-mapping> subelement. Note, the official registry of Internet MIME types is managed by the Internet Assigned Numbers Authority (IANA) at www.iana.org.
The following table shows the required MIME types to generate the Microsoft Excel output options supported by BI Publisher:
Extension | Mime-Type |
---|---|
xls |
application/vnd.ms-excel |
xlsx |
application/vnd.openxmlformatsofficedocument.spreadsheetml.sheet |
xlsm |
application/vnd.ms-excel.sheet.macroEnabled.12 |
mhtml |
message/rfc822 |