In this lesson, you learn how you can use an OmniPortlet to publish data from various data sources in a variety of layouts. You learn to select and configure different data sources to publish content by using the OmniPortlet. You learn to modify the layout, and add parameter support to your OmniPortlet. You also learn how to enhance the reusability of an OmniPortlet by controlling the flow of parameters and events across your OmniPortlet and portal pages.
This module discusses the following topics:
Place the cursor on this icon to display all screenshots. You can also place the cursor on each icon to see only the screenshot associated with it.
An OmniPortlet enables portal developers to quickly and easily publish data from various data sources in a variety of layouts by using a Web-based wizard. The OmniPortlet can be based on almost any kind of data source such as a spreadsheet, XML, Web services, database, or even application data from an existing Web page. The OmniPortlet provides you with a wizard-based portlet creation experience and supports content caching to improve performance.
An OmniPortlet provides the most common layouts for portlets: tabular, chart, news, bulleted list, and form. The OmniPortlet enables you to select different layouts and change them independently of the data source, giving maximum flexibility. You can refine the retrieved data by applying filters to it.
The OmniPortlet Web provider enables content contributors and content managers to:
Display data from multiple sources
Sort the data to display
Format data by using a variety of layouts
Define public portlet parameters
Map public portlet parameters with page parameters
Raise portlet events
Expose customizable settings to page viewers
In order for this lesson to work successfully, you need to have performed the following:
| 1. | Complete the Installing the Oracle Application Server 10g Infrastructure lesson. |
| 2. | Complete the Installing the Oracle Application Server 10g Portal and Wireless lesson. |
| 3. | Download portalOBE.zip and unzip into your working directory. |
| 4. | Complete the Building the Portal Site lesson. |
| 5. | Complete the Publishing and Searching Content lesson. |
Note: You can download the latest release of the OracleAS Portal Developer Kit (PDK) from Portal Studio to upgrade the Portal Tools applications.
The OmniPortlet provider is installed as part of OracleAS Portal. You can add this OmniPortlet to your portal page from the Portlet Repository where it is found under Portlet Builders. If the portal administrator has reorganized the Portlet Repository, the default portlets may be in different locations within the Portlet Repository.
If you have downloaded the OmniPortlet as part of the OracleAS Portal Developer Kit, you must perform either of the following tasks:
You can then add the OmniPortlet to any portal page.
In this section, you add an OmniPortlet instance to your portal page.
| 1. | Access your portal. Click the
Navigator link.
|
| 2. |
Your path must be Path: Page Groups > <YourName> Oracle By Example > Pages .
|
| 3. |
Click the Edit link to the right of the <YourName> OBE Home Page link.
|
| 4. | Click the
Key Indices tab.
|
| 5. | Click the
Add Portlet
|
| 6. | Click
Portlet Builders.
Note: If you are not using the OmniPortlet that is readily available and have installed the OmniPortlet in another OracleAS Portal instance, then you can locate your OmniPortlet in the Portlet Staging Area. By default, all newly registered providers and portlets are available in the Portlet Staging Area in the Portlet Repository.
|
| 7. | Click the
OmniPortlet link to move it to the
Selected Portlets area.
|
| 8. | Click
OK to return to the portal page.
|
The first step in building an OmniPortlet is to define the data source and configure it to create a personalized portlet. You can publish content using an OmniPortlet by performing the following tasks:
Choosing the type of data
Configuring the access to secure data
Filtering the data
Setting the title, header, and footer text for the OmniPortlet
Selecting the layout format
Specifying the layout options
An OmniPortlet offers an easy way to publish data from a database by using the SQL data source. The SQL data source option uses standard Java Database Connectivity (JDBC) drivers and provides ready-to-use access to the Oracle database along with other databases supporting Open Database Connectivity (ODBC). You can enter the database connection information or reuse existing saved connection information to access a specific database. After the connection information is correctly entered, any SQL statement can be written and parameterized.
In this section, you configure an OmniPortlet to publish data from a database by using a SQL statement.
| 1. | Click the
Define link for the new portlet. The first page of the OmniPortlet wizard displays where you can specify the data source.
|
||||||||||||||||||||||||
| 2. | You configure your OmniPortlet to use a SQL data source. Select the
SQL option button.
|
||||||||||||||||||||||||
| 3. | Click
Next.
|
||||||||||||||||||||||||
| 4. | In the
Connection section, click the
Edit Connection button to define the database connection used to retrieve the data.
|
||||||||||||||||||||||||
| 5. |
Create a new connection by using the details given in the following table:
Note: You must specify appropriate values in the Connection String field to connect to a database.
|
||||||||||||||||||||||||
| 6. | Click
Test to check the connection information.
You see the Connection Successful message in the Connection Test Result window.
|
||||||||||||||||||||||||
| 7. | Click
Close to close the window.
|
||||||||||||||||||||||||
| 8. |
Click OK to return to the OmniPortlet wizard page.
The new Connection Name now appears in the Connection section.
|
||||||||||||||||||||||||
| 9. |
In the SQL section, enter the following statement: select * from scott.dept
|
||||||||||||||||||||||||
| 10. | Click
Test to test the SQL query.
|
||||||||||||||||||||||||
| 11. |
Click Close to close the Query Results window.
|
||||||||||||||||||||||||
| 12. |
Click Next. You can use this page to filter and order the data that appears in your portlet. An OmniPortlet supports filtering of data in two areas:
Note: It is always more efficient to filter and sort the data at the data source because you can streamline the process by retrieving only the necessary data. The best practice to use the middle-tier filtering is when the data source does not support any filtering or sorting capability (for example, a spreadsheet).
|
||||||||||||||||||||||||
| 13. | Click
Next as you do not want to apply any filters to the query results.
|
||||||||||||||||||||||||
| 14. | In the
Header and Footer Text section, enter
Department Details in the
Title field.
|
||||||||||||||||||||||||
| 15. | Enter
Data retrieved using the SQL data source in the
Footer Text field.
|
||||||||||||||||||||||||
| 16. | Ensure that the
Show Footer Text check box is selected.
|
||||||||||||||||||||||||
| 17. | Deselect the
Show Header Text check box.
|
||||||||||||||||||||||||
| 18. |
In the Layout Style section, select the Form layout for the portlet data.
|
||||||||||||||||||||||||
| 19. |
In the Caching section, select the Don’t Cache the Portlet Content option button. When you select this option, the OmniPortlet does not cache the portlet content and displays dynamic content.
|
||||||||||||||||||||||||
| 20. | Click
Next.
|
||||||||||||||||||||||||
| 21. |
In the Column Layout section, enter the details as shown in the following table:
|
||||||||||||||||||||||||
| 22. | Click
Finish.
The OmniPortlet displays the results of your SQL query on your portal page.
|
An event is a specific action that the portlet can perform. Portlet events model the page navigation and the data output of a portlet when a user clicks a link or submits a form. An OmniPortlet can raise events, and you can use these events to send one or more parameters to a page. This feature enables you to create dynamic pages that are based on each user’s interaction with the page. You can configure up to three OmniPortlet events. Each event can pass up to three parameters. Each parameter can be a portlet parameter, such as Param1, or a data source field.
Earlier, you configured an OmniPortlet to display data in a Form layout from a SQL statement. In this section, you set up your SQL OmniPortlet to raise an event when the user clicks a Department Number link. After the user clicks the link, the OmniPortlet retrieves the department number for the selected department, and passes that value to the event parameter, Event1Param1. Events are configured using the Events tab when you select the Edit Defaults function for the OmniPortlet.
| 1. | Click the
Edit
|
| 2. | Click the
Layout tab.
|
| 3. |
In the Column Layout section, define an action for the DEPTNO column. Select Event1 from the Action list. This setting triggers a predefined event called Event1 for the Department Number field.
|
| 4. | Click the
Events tab.
|
| 5. | In the
Event Outputs section, select
DEPTNO from the
Event1Param1 list.
|
| 6. | Click
OK.
OmniPortlet events enable you to generate interportlet communication. Now, when Event1 is raised, the department value is passed to the page parameter, Param1, on the target page. Later, you pass this page parameter, Param1, to another OmniPortlet on the same page Later in this lesson, you configure another instance of the OmniPortlet to receive a value from a public portlet parameter and send this value to its data source. You personalize this OmniPortlet by mapping its portlet parameter to the page parameter, Param1, so that the second OmniPortlet responds to this raised event.
|
XML is increasingly used as a method of providing controlled access to data sets over the intranet and the Internet. You can use XML as a data source with an OmniPortlet and specify the URL to XML content. An OmniPortlet requires that your data be in a <Rowset>/<Row> format or a tabular format. However, the names of various tags used in the XML file need not be <Rowset>/<Row> .
If the XML data source does not exactly match this format, you can specify the URL to an Extensible Style Sheet Language (XSL) filter to transform the data to the required format. Regardless of the format of the XML file, the OmniPortlet introspects the XML data source to determine the column names that are used to define the layout. However, you can specify this information by using the URL of an XML schema file, which defines the structure of the XML data to be used by the OmniPortlet.
In this section, you add and define an OmniPortlet to publish data by using an XML data source. Add another instance of the OmniPortlet to the Key Indices tab on your portal page by using the steps listed in Adding an OmniPortlet to an OracleAS Portal Page.
| 1. | After adding an OmniPortlet to your page, click the
Define link for the new portlet.
|
||||||||||||||||||||||||||||||||||||
| 2. | Select the
XML option button.
|
||||||||||||||||||||||||||||||||||||
| 3. | Click
Next.
|
||||||||||||||||||||||||||||||||||||
| 4. | Enter
/htdocs/omniPortlet/sampleData/employees.xml in the
XML URL field.
|
||||||||||||||||||||||||||||||||||||
| 5. | Click
Next.
|
||||||||||||||||||||||||||||||||||||
| 6. |
You use this page to filter the data that appears in your OmniPortlet. You configure this page later in the lesson. Click Next.
|
||||||||||||||||||||||||||||||||||||
| 7. | In the
Header and Footer Text section, enter
Data retrieved using the XML data source in the
Title field.
|
||||||||||||||||||||||||||||||||||||
| 8. | Deselect the
Show Footer Text check box.
|
||||||||||||||||||||||||||||||||||||
| 9. |
In the Layout Style section, select the Tabular layout for the portlet data.
|
||||||||||||||||||||||||||||||||||||
| 10. |
Click Next.
|
||||||||||||||||||||||||||||||||||||
| 11. |
In the Column Layout section, enter the details as shown in the following table:
|
||||||||||||||||||||||||||||||||||||
| 12. |
Click Finish.
|
Public portlet parameters enhance your portlets’ flexibility by enabling you to reuse your portlets on multiple pages. Because of this, you need not make changes to the portlet code when adding the portlet to different pages. Using public portlet parameters, any portlet on a page can easily receive its value from the mapped page parameter, regardless of the portlet parameter names.
An OmniPortlet can accept parameters and render results in any format, including HTML, depending on the parameter values. The OmniPortlet can receive up to five parameters. Each parameter is specified as ##ParamX##, where X is an integer between 1 and 5 (for example , Param1). The OmniPortlet parameters are passed as name-value pairs. You must specify a default value in the Portlet Parameters section or specify a value at run time. You can configure an instance of the OmniPortlet to receive a specific parameter and send this parameter to a data source.
In this section, you add a parameter to the Employee Details OmniPortlet created by using the XML data source. You use this parameter value to filter the results returned by the XML data source. Instead of showing the data for all departments, your OmniPortlet displays the information for the department number indicated in the parameter you used, and the header text is updated accordingly.
| 1. | Click the
Edit
|
||||||||||||
| 2. |
Access the Source tab. In the Portlet Parameters section, enter the following details:
You can use the Portlet Parameters section to add interactivity to the OmniPortlet. You can also parameterize the credential information used to access secure data.
|
||||||||||||
| 3. | Click the
Filter tab.
|
||||||||||||
| 4. |
Enter the following filter condition in the Conditions section:
By specifying the filter value to ##Param1##, you set the portlet to use the value of Param1 for the value of the DEPARTMENT_NO column. For example, if Param1 is 10, then the filter condition evaluates to DEPARTMENT_NO Equals 10.
|
||||||||||||
| 5. |
In the Order Section, select EMPLOYEE_ID as the first column to order the results by. Select Ascending for the sort order.
|
||||||||||||
| 6. |
Click the View tab.
|
||||||||||||
| 7. |
Enter Employee Details in Department ##Param1## in the Header Text field.
|
||||||||||||
| 8. |
Ensure that the Show Header Text check box is selected and the Show Footer Text is deselected.
|
||||||||||||
| 9. |
Click OK.
|
||||||||||||
| 10. |
You have specified 10 as the default value for the portlet parameter, Param1. The OmniPortlet uses the value of portlet parameter to filter the data. Now, you see the details of employees in Department 10.
|
After creating the portlet parameter and event, you must set the page parameters and events to relate the two portlets together on your portal page. You can create page parameters by using a declarative user interface. The purpose of creating page parameters is to map external parameters to portlet parameters. Page parameters and events can be used with an OmniPortlet to create a cohesive application. You can pass parameters between portlets residing on the same page or on different pages by using page parameters and events. This powerful technology permits unrelated portlets to work together easily.
In this section, you integrate the portlet parameter with your page parameter and event. At the end of this section, when you click the Department Number link on the Department Details OmniPortlet, an event is raised that sends a DEPTNO parameter to all the portlets on that page. The Employee Details OmniPortlet uses the value of this parameter to display information about the employees in the selected department.
To do this, you set a value by using a page parameter and map this page parameter to the portlet parameter, Param1.
| 1. | To create a department parameter on the
<YourName> OBE Home Page, click the
Page Properties link.
|
| 2. | Click the
Parameters tab.
Note: The Parameters and Events tabs show for all pages that are owned by a page group that has parameters and events enabled. Parameters and events are enabled by default in OracleAS Portal.
|
| 3. | In the
New Page Parameter section, enter
department in the
Parameter Name field.
|
| 4. | Click
Add.
You use page parameters to declare a public data input interface to a page. This interface can then be used to transmit data from a page to one or more portlets residing on the same page or on different pages.
|
| 5. | The
department parameter now appears in the
Page Parameter Properties section.
In the Default Value field, enter 30. Enter This is a page param. in the Description field.
Later in this lesson, you see how parameter values that are passed from the page override the default values of the portlet parameter for the Employee Details OmniPortlet.
|
| 6. | You have a page parameter with the default value 30. Next, you must pass this parameter value to the
Employee Details OmniPortlet created by using the XML data source.
In the Portlet Parameter Values section, click the Key Indices: OmniPortlet link that contains the portlet parameters. If you created a new page specifically for the steps in this lesson, then this portlet is the second instance of Key Indices: OmniPortlet in the list.
|
| 7. |
When defining the XML OmniPortlet, you created a public portlet parameter, Param1 . You can use this portlet parameter to receive a value from the page. Next to Param1, select Page Parameter from the list. This renders another list.
|
| 8. | In this list, you choose the page parameter to bind to the portlet parameter.
Select department. The portlet parameter Param1 is now mapped to the department page parameter you created in the previous steps.
|
| 9. | Click the
Events tab.
|
| 10. | In the
Portlets Events section, click the first instance of the
Key Indices: OmniPortlet link.
Note: If you are not able to access the OmniPortlet event in the Page Properties, refresh your OmniPortlet Provider. To refresh your OmniPortlet Provider, access the Navigator in Portal. Click the Providers tab. Click the Locally Built Providers link. You should be able to see OmniPortlet Provider. Click the Refresh link.
|
| 11. | Click the
Event1 link.
You specified this event in the Department Details OmniPortlet. Now, you have to specify what should happen when this event is raised. In this lesson, you refresh the OBE Home Page with the new parameter value.
|
| 12. |
The right side of the page refreshes where you can set the event information. Click the List of Values icon on the right of the Go to page field.
|
| 13. | Find the
<YourName> Oracle By Example page group in the list.
Click the plus icon to expand your page group.
|
| 14. | Click the
Return Object link to the right of
<YourName> OBE Home Page.
|
| 15. |
When you select your portal page, the page parameters are displayed in the Page Input section. Next, you must specify the values that must be passed to the page from the output of the portlet. In the Page Input section, select Event Output in the list.
|
| 16. |
Select Event1Param1 from the second list.
This maps the event output to the department page parameter. You have now set the Department page parameter to display the contents of the OmniPortlet event parameter, Event1Param1.
|
| 17. | Click
OK.
|
| 18. |
Click the View Page link in the upper right corner to preview the page and test your changes.
|
| 19. |
Click the browser’s Back button, or the Edit smart link to return to Edit mode on the page.
|
In this section, you add and define an OmniPortlet to publish data by using a Web service data source. This Web service exposes the DEPT and EMP tables of the Oracle Database SCOTT schema as Web services.
Now, add an OmniPortlet to the Key Indices tab on your portal page by using the steps listed in Adding an OmniPortlet to an OracleAS Portal Page.
| 1. | Click the
Define link for the new portlet.
|
||||||||||||||||||||||||||||||||||||
| 2. | Choose the
Web Service option button.
|
||||||||||||||||||||||||||||||||||||
| 3. | Click
Next.
|
||||||||||||||||||||||||||||||||||||
| 4. | Enter
http://webservices.oracle.com/ws/emp/oracle.ws.scott.OTNDeptEmp?WSDL in the
WSDL URL field.
Click Show Methods to see what methods are available from this Web service.
|
||||||||||||||||||||||||||||||||||||
| 5. | In the
Web Service Methods section, select the
OTNDeptEmp.getEmpXML method from the
Available Methods
for this Web Service list. This Web service method returns all the employees of the
Employee table as XML.
Note: The methods exposed in a Web service enable you to interact with the Web service. Some methods expose parameters.
|
||||||||||||||||||||||||||||||||||||
| 6. |
Click Show Parameters to check whether the OTNDeptEmp.getEmpXML method accepts any parameters.
|
||||||||||||||||||||||||||||||||||||
| 7. |
You could note that the selected method does not accept any parameters. Now, click Next to filter the data returned from the data source. In this lesson, you restrict the returned data to only one department from the Employee table.
|
||||||||||||||||||||||||||||||||||||
| 8. |
In the Conditions section, select DEPTNO from the Column list, Equals from the Operator list, and enter 20 for the Value field.
|
||||||||||||||||||||||||||||||||||||
| 9. | Click
Next.
|
||||||||||||||||||||||||||||||||||||
| 10. | Enter
Employees in Department 20
in the
Title field.
|
||||||||||||||||||||||||||||||||||||
| 11. |
Deselect the Show Header Text check box. Enter OmniPortlet using Web services as data source in the Show Footer Text field. Ensure that the Show Footer Text check box is selected.
|
||||||||||||||||||||||||||||||||||||
| 12. | Select the
Tabular option button for
Layout Style section and click
Next.
|
||||||||||||||||||||||||||||||||||||
| 13. |
In the Tabular Style section, select the Alternating option button. In the Column Layout section, enter the details as shown in the following table:
|
||||||||||||||||||||||||||||||||||||
| 14. | Click
Finish.
You can see the details of all the employees in department 20 being dispalyed in a tabular format.
|
In this lesson, you learned to build OmniPortlets that publish data from different data sources. You also learned how to create portlet parameters and events. You learned to add interactivity to the OmniPortlet by mapping the portlet parameters with the portal page parameters and events. Thank you for completing this OracleAS Portal Oracle by Example.
For more information about OracleAS Portal, please visit Oracle Portal Center Home.
If you have questions or comments, please post them in the Oracle by Example discussion forum on the Oracle Technology Network.
Place the cursor on this icon to hide all screenshots.
| |
||
| Copyright © 2004, Oracle Corporation. All rights reserved. | Contact Us Legal Notices and Terms of Use Privacy Statement | |
