Sunday, May 13, 2007

Templating in Oracle JDeveloper 11g

As probably everyone of you have heard - this week was released Oracle JDeveloper 11g Technical Preview. I have looked through 11g release and should say, that if Oracle JDeveloper 10.1.3 was smart enough tool, then Oracle JDeveloper 11g is simply smart :). There are a lot of new and useful functionality implemented in tool itself. During sample application development I have noticed many enhancements comparing to previous release, those enhancements available in Oracle JDeveloper 11g will help to be more productive and to develop more effective applications.

I have decided to build my first sample on Oracle JDeveloper 11g to describe Oracle ADF templating functionality. In fact, it was real pain when implementing applications with many pages and similar functionality in each page. However, now that pain should go away, because in Oracle JDeveloper 11g UI and also data logic templating becomes really simple. If you are interested, you can watch the online screencast - JSF Page Templating, available on OTN.

Developed sample application - Templating.zip is based on standard HR schema and provides three JSPX pages, two of them are based on developed template. I have developed this sample in similar way like in Frank Nimphius screencast, however additionally I have used page definition file for template. Developed template contains two parts - Master and Detail area. Master area is empty, there facet 'master' is declared, later when real page will be created from template, I will put into this area Master data for Employees entity. Into Detail area I have dragged and dropped a read-only table based on Employees entity. This means, that structure in Master will be specific for each form, but structure created in Detail area will be the same in all forms. If requirements will be changed, Detail part structure can be easily updated in template document, all forms created based on template will be updated automatically. Developed template:


To show how this template can be used, I have created two pages (editDepEmpl1.jspx and editDepEmpl2.jspx) based on the same template. Both of those pages contain Master-Detail relationship implemented, Detail part is the same and Master part is different. Page flow diagram:


First page provides a form for Department name editing, second page provides a form for Department location editing. Both pages are invoked from main.jspx:


Page for editing Department name:


Page for editing Department location:


Oracle ADF in JDeveloper 11g provides additional feature for data tables - filtering (have you noticed that line with empty fields above table header?). Let's say we want to apply filtering for First Name column using 'A%' string:


Ok, application is working and everything is fine. But, let's imagine such situation - our analyst isn't working so good as we - he/she have decided to change primary functional requirements and to remove filtering feature from detail table. If you are working with previous release, you will iteratively apply the same routine steps for all tables needed to be changed. But, in Oracle JDeveloper 11g situation is different, here you can go directly to template document and make changes only once - remove filtering option. Changes in template document will be applied for all pages based on that template. And really, table is changed:


It seems Oracle JDeveloper 11g doesn't put standard JAR libraries into application folders, application size is reduced and there is no need now to copy into WEB-INF/lib standard libraries.

5 comments:

Rajender Singh said...

nice review!

OracleBrains.Com

Djoman Constant YAPI said...

Good review, thanks

chemic said...

hello Andre...., nice tutorial
i got problem, when implement multiple template in my project, so how to change one template with another template..?

can you explain it..
Thx.... :)

Michael Oakes said...

Great tutorial Andre but again, similar to agungdmt, do you know if there is an easy way to switch the templates on a page, or to even disassociate a page from any template?

Many Thanks,

Mike Oakes.

Andrej Baranovskij said...

Yes - its easy :) You can define expression language for template id and switch it dynamically...

Andrejus