Tuesday, November 20, 2007

Oracle JDeveloper/ADF Real Life Story on Oracle OpenWorld

Yes, that right - I was presenting Oracle JDeveloper/ADF Real Life Story on Oracle OpenWorld in Unconference section. Everyone was free to come and listen hints I have delivered for Oracle JDeveloper/ADF development based on real life experience. Based on feedback received from auditory, I think session was successful.

I have started session with presentation based on this outline:
  • About Oracle ACE Directors
  • J2EE Development - JDeveloper 11g and Oracle ADF (future book)
  • Oracle JDeveloper/ADF in IBM GBS Norway
  • Real Development with JDeveloper/ADF
  • Demo of Sample Applications from http://andrejusb.blogpost.com
  • Technical Resources
Yes, I'm writing now book about JDeveloper 11g and ADF. This book will based mostly on practical material. I have presented with several slides my current project in IBM GBS Norway and turned to main part of session - Real Development. In this part I was developing Web application with JDeveloper and ADF just on the fly, at the from of auditory. Application development from beginning to testing took for me 45 minutes. And lastly I presented my blog and have talked about technical resources each JDeveloper/ADF developer should know and use in his daily work.

In this post I want to concentrate on application I have developed during real time development. Developed application - OOWUnconference.zip is based on standard HR schema available in Oracle XE database, application contains 3 Web pages - for viewing and editing data from JOBS table, and also for viewing data from EMPLOYEES table.

I have developed this application based on those steps:

1. I created Business Components diagram. I was using declarative approach to create Model layer. Jobs and Employees entities were added to the Model declaration:


2. Second step was to show how test created Model layer with ADF BC Test utility that comes with JDeveloper:


3. Next step was to show how to add validation logic. Jobs entity object was chosen, I added and tested validation rule for MinSalary attribute:


4. When Model layer was done, I moved to ViewController and have created there page structure along with navigation:


5. First page I developed was - jobs.jspx. This page contains one read-only table and two buttons according to logic defined in faces-config.xml file.


6. Second page was editJob.jspx. This page provides a form for data from Jobs entity editing:


7. Third page - employees.jspx. Here employees who belong to specified job are listed in the table:


8. And of course I have tested validation logic in editJob.jspx page, it worked good:

However, there was a question from auditory about how to make Back button work in a case when validation error is displayed. Hint - you should set Immediate=true for Back button:


9. Ok, everything works fine, but one thing is not ok. If you have noticed, it is possible to update minimal salary with some value, even higher comparing to salaries of existing employees. That not good, and I have implemented solution for this as well. At first, I have created new read-only View object that select all employees with selected JOB_ID and SALARY lower comparing to provided value:


10. When View object was created, I implemented custom method in Application Module. This method is used to execute read-only View object and to return result to ViewController:


11. In ViewController I have created methodAction declaration for checkEmployeeSalary method and in editJob page backing bean implemented a call to defined methodAction:


12. Now second validation rule is also implemented:


Oracle OpenWorld was great event, with two Larry Ellison keynotes and a lot of technical material in Oracle Develop. I even don't talk about entertainment part, it was amazing. See you next year in San Francisco ;-).

When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.

No comments: