by Rohan Walia
One of the most useful features of Webcenter Portal is Data Presenter. Data Presenter allows developers/administrators to create data controls at runtime, and they are readily and immediately available for application usage, without any restart of servers. One more advantage of Data Presenter is ability to create task flows at runtime. Both data controls and task flows can be created at runtime in the Webcenter Portal PS7, with no coding needed in JDeveloper. These newly created data controls can be used in the task flows to create UI and these task flows can be reused wherever needed across the application.
This is useful for Developers, Technical Leads and Technical Architects as earlier, they need to take a decision to create custom task flows separately in JDeveloper and deploy them on Weblogic and use them inside the Webcenter Portal. This is highly useful for developers and Webcenter administrators due to easy learning, and saves significant effort. All this requires quite an effort and is little cumbersome to set it up at the beginning. Data Presenter marks this problem and provides solution to this in quite good way.This article provides an overview of WebCenter Data Presenter and hands-on instructions, steps to implement above functionality.
A common need that is consistently requested is to retrieve data from various data sources and display in an interactive format on a single page. Typically the data source could be Databases or Web Services. With the earlier versions of Webcenter (prior to PS7), developers needed to create a custom task flow in JDeveloper, with a page that displayed data from data controls created in JDeveloper. Next, this task flow needed to be deployed as shared library and made available to Webcenter Portal application. This was time consuming, and the intermediate steps needed a big learning curve. Additionally, there are requests from business to Webcenter administrators for creating/configuring simple pages. The need to use JDeveloper and go through the specific development process is difficult and really cumbersome.
In this article, Data Presenter framework of WebCenter Portal is used to create Data Controls and Task Flows. HR Schema is used and Data source is created on standalone Weblogic Server. Data Presenter uses the same Data Source to create Data Controls out of Employee table. This data control is used in a Task Flow, easily created using Data Presenter framework. The task flow and data control uses the filter option provided by the framework to filter out the employees based out of Departments.
Data Presenter Assets
Data Presenter comes up with Assets which will be building block of creating simple functionalities on WebCenter Portal. Below are the Assets provided by Data Presenter:
- Data Controls: Data Controls are exactly the same data controls which we have in ADF applications. Their main job is to retrieve data from the Data Source. There are two types of Data Controls supported by Data Presenter. We will have a look at them.
- Task Flows: The Data Controls created in the last step are of no use, if they are not consumed by the UI assets to create UI.
The process which is generally adopted in WebCenter Implementations is shown in Figure 1. The task flows are created in JDeveloper, which consume Web Services and DB Business services using Data Controls created on top of them. Then these task flows are deployed as shared libraries on WebCenter Spaces Domain and Consumed by WebCenter Portal Pages. This approach involves development on local JDeveloper and then deploying the assets from local JDeveloper to WebCenter, which consumes them.As shown in Figure 2, using Data Presenter framework, data controls and task flows are created inside the WebCenter only. As Oracle now recommends now using Portal Builder to create WebCenter Implementations, it adds a lot of value to create assets as far as possible in WebCenter only. This saves considerable amount of time in development phase to develop task flows in JDeveloper and then export/import it in WebCenter Portal.
Pre requisite for using Data Presenter
To use Data Presenter feature in WebCenter PS7, there needs to be a Data Source configured and deployed to Spaces Managed Server. Data Source named HRSchemaDS will be used in this article which points to local XE data base and HR Schema provided by Oracle.
Let’s start by creating Data controls. Data Controls are of two types. This means that Data Controls can be created using two types of data sources.
- Conventional Database.
- Using Web Services.
In this document we will create Data Control out of Database.
Creating SQL Data Control
SQL Data controls uses a Data Source defined in Weblogic Server. The queries used to create SQL Data Controls are fired against the specified Data Source. Below are the steps to create SQL Data control.
Step 1: Login into WebCenter Portal and go to Administration Shared Assets
Login into WebCenter Portal and open Administration -> Shared Assets as below:
Step 2 : Open Data Controls tab
Step 3: Click on create Button in the toolbar and provide the name of Data Control. Select SQL as SQL Data Control is being created at this point.
Step 4: Select the Data Source against which Data Controls needs to be created. Enter the password of the data source. Enter the SQL Query which will be used to create data control.
Step 5: Click on Test to check the results returned by the Query. So it basically returned the results of the query in the SQL Statement. This result set will be the default result set which will make a DC.
Step 6: Bind variable can also be added to the query. To add bind variable, add variable in the query.
The bind variables act as filter to the query. These bind variables can be set from UI layer dynamically and change the data returned by the Data Control.
Step 7: Click Enter Bind Variables and enter the value for bind variable.
Step 8: Click on Test button to filter the results based on Bind Variable.
Click on create button on top right to create a data control. Now data control is created and all set to be used.
Step 9: Finally Available needs to be checked so that this Data Control is available to be used in other assets.
Creating Task Flow for consuming Data Control
Using Data Presenter, Task Flows can be created and used as assets. Creating task flows in WebCenter portal is quite easy and these task flows can be added to the Portal pages and can be rendered to provide a particular functionality. Visible task flows are available in task flow section of Portal builder and can be used to drag and drop on the Portal Pages.
Step 1: Go to Task Flows in Shared Assets.
Step 2: Click Create, and enter name and description of task flow.
Step 3: Mark it available and edit the task flow. By making it available, task flow is made visible. By making it visible, it will be available in Portal builder and can be used in Portal Pages.
Step 4: On the Employee Task Flow Page, Right panel has all the assets which you can add to the task flow. Search for Data Control in the search bar.
Step 5: Get into Data Controls and open EmployeeDC. Click on add. This gives options as how the data control can be added as which Visual Component.
Step 6: Select one the options for data control to be displayed. We will select table in this document. Once Table is selected, it gives a pop up to configure the UI Table.
Step 7: Let’s select and create a Read Only Table with Row Selection, Filtering and sorting all three options as selected. Click on next.
Step 8: On next screen, there is an optiong to include or exclude the columns from the Data control to be visible in the table. For now let’s just include all the columns.
Step 9: In the next screen, there is an option to set Header, Display as and Align for each column of the table. We have added these properties for only EMPLOYEE_ID field for now.
Step 10: Next is Visualization Parameter screen. Here value of binding parameter can be specified. Also if the parameter is selected, the bind parameter will be placed on the top of the table and its value can be specified by user and table can be refreshed to filter results as per value specified by the user.
Step 11: Click on Save on top right.
Now the Task flow is there with the ADF Table and Bind Variable on top of it table. By Default it shows the default value provided in the data control. One can add a new value and click on refresh to pull new results filtered based on the value.
Integration of task flow on the Page
Next step is to use the Employee Task Flow and add it to the page. We will use “Test Data Presenter” page and will edit it. On click of edit, Portal Builder comes up.
Search the right Assets Panel with “Task Flows”.
Now open Task Flows in the right panel. Employees Task Flow created will be seen here. Click on Add button and Task flow will be added to the page.
Save the page from “Save” button on top Right corner.
Below is how the page looks:
Data Presenter is a very strong and useful framework provided in Oracle WebCenter Portal PS7. If used in the implementations, it will help to save a lot of development and code management effort. Data Presenter should be used for the task flows which can be created using it rather than doing custom task flow development in JDeveloper and making it available to WebCenter Portal.
Note: The author wishes to thank Sriharsha Donthi and Srini Angara for their invaluable assistance in producing this article.
About the Author
Rohan Walia (rohanwalia) is an Oracle ADF & Webcenter Consultant with extensive experience in ADF and Webcenter project implementations. He is been into Java and the Oracle application development space for quite a long time. He is a contributor to Oracle JDeveloper extensions - ADF EMG Audit Rules Project, is an Oracle Certified ADF Implementation Specialist, and is part of the Oracle Webcenter Certification (126.96.36.199) Authors and Reviewers team. Rohan currently works with Oracle Consulting India. He is an active blogger, speaker, mentor and open networker.
Follow his blog: http://rohanwalia.blogspot.in/
Follow him on Twitter - @rohanwalia17